From patchwork Tue Jan 30 10:48:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vineeth Karumanchi X-Patchwork-Id: 13537235 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DB35966B22; Tue, 30 Jan 2024 10:48:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.40 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706611741; cv=fail; b=JEQPRiUavcBok5tgFVFh3q7PZjpgOLUDwhudm008VkP06UpIiGP3nmMHfsnY2zLjqM77x0FcgFpFLZdcyQPZPirl8KbUDG4nAEcC1XZku/WuH33rlmsV17SgkzsaUr88ZpYSI5+ECv/W8nC4N7HwGr3+untzKuXdr+mVd3hFS9I= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706611741; c=relaxed/simple; bh=Qequ1IVsS1BQdiniE5mD/vBqDc+onkO31YS0hN4l7lU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GlxL2cIsNmU1dDeWT+o/Mn8j4tXXGkD3KI2KjcMsisxhTdU4LIZ4SSIawNgeD+BpkguOgOKEz0IppvkEKhyvW/nOYRhiHswzYHiIaenl0MC6mCaiu+iHYK7zjOQYg5119fBVigp4LIcC+PmkX9fPKiA9Boq68o+U+FsvRmMOciM= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=3ZtgkQCb; arc=fail smtp.client-ip=40.107.236.40 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="3ZtgkQCb" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ffolRYVj2IUwCUZ6LU8Fworv+ziE/gfw/F4C6H1aDlf8xYdZ+qqMkKjBG8OOSSkQIEkExdxKWSW2hXl4Pj2h0yGNw12PWmZQ6Nw41zRQfyapwBChVAvgmepwJDa5V+Jhi2sg38jWGGL+uM+kzeN0DxvbP4l/1V3aPIUAwXZqBWqas9tAGIwTVOASRiZ0JTBlEvs/jpGnZTt7M5F12kCIiF2TX1guJONzn0XCqeGL204fxCFY0w7FE2shD/Kunat1y3dDKHVdu/PyFxCBr2k8Y1j19EYMjWrE6gv6G/jCKCJzVDOf623/FQwcD/aUArVIPKoZxzYS744RuM0UD2eh8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8+UW9/ESkCmmO9wG0qNOFySaz+ckqDKSNqfxL8QHC80=; b=BVJfWjfazwbWkvuSe7lTJIJW2hnmdyTm4JieWdfNmq5Fm7n6+ABoxxPsf+l4DlLNkThTdvtysm6jgsHaXM3c/x95MdWSW6YoUl99FSg6cKbhdcm45yY0wK5mba7IRBBJWh8YBmYXSM8NtEtE7AoSGc6k6eaLlN7NANBGEWdYzJy0NfIZgvnLQRFVNcYdfFzfKAc1gBAZrA4v+P/aTkHqumZ6AO7d2oPISoiqdwORurvS7bHdlL+ABI6AuJFlrBgtI8kWsjWZh/NU4Yq7v/FeSQevlD/elWkQasGTb5oKCmDrzGZsjfLXMMuEIELxEMCAjX1m35LgIDOfISVzCs210w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=microchip.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8+UW9/ESkCmmO9wG0qNOFySaz+ckqDKSNqfxL8QHC80=; b=3ZtgkQCbbj90jFu2NMv+CaQelyEC2u9dKcTYBn2vbhfyF1h8NnjHanYcP1jQ3WXFI0myHdpxyY/ZLxhrpA4Ghrskeci1hzwOfIeO+VqjW24rMDoqakxU1mwJonHV4bizvju9bW0sYslR+ULpyFaRS90sSfTGMA/5JTHm55hR+NY= Received: from BN0PR04CA0120.namprd04.prod.outlook.com (2603:10b6:408:ec::35) by MN2PR12MB4287.namprd12.prod.outlook.com (2603:10b6:208:1dd::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.22; Tue, 30 Jan 2024 10:48:55 +0000 Received: from BN3PEPF0000B06A.namprd21.prod.outlook.com (2603:10b6:408:ec:cafe::5) by BN0PR04CA0120.outlook.office365.com (2603:10b6:408:ec::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.34 via Frontend Transport; Tue, 30 Jan 2024 10:48:55 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by BN3PEPF0000B06A.mail.protection.outlook.com (10.167.243.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7270.0 via Frontend Transport; Tue, 30 Jan 2024 10:48:54 +0000 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Tue, 30 Jan 2024 04:48:53 -0600 Received: from xhdvineethc40.xilinx.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2507.34 via Frontend Transport; Tue, 30 Jan 2024 04:48:50 -0600 From: Vineeth Karumanchi To: , , , , , , , , , CC: , , , , Subject: [PATCH net-next 1/3] net: macb: queue tie-off or disable during WOL suspend Date: Tue, 30 Jan 2024 16:18:43 +0530 Message-ID: <20240130104845.3995341-2-vineeth.karumanchi@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240130104845.3995341-1-vineeth.karumanchi@amd.com> References: <20240130104845.3995341-1-vineeth.karumanchi@amd.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B06A:EE_|MN2PR12MB4287:EE_ X-MS-Office365-Filtering-Correlation-Id: a1e4b64d-d498-46f3-34e8-08dc21810dfd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rbsOld1MWFe110IdbKf8rPMJ/sj55G2Owateu2jUapwFoYxB0DZYO3RL7OhsVjHW6XOFK7LCQpbMn+OzJHjwSb8Lwmkqwcj4xHR7W4oX2FBFtu+ROfjjzuTBfrXKpara1napQ+Y2uScKlqvbTNbyIU+9W3W4T7csuoyFoTlWt/1g/T3nuy/wQ2pOAXe7/L3LxY7Va2uY1TYgRrI0whYhUC1DOkKbNQEtV8H3B19KRulWczuuDyj6RvzmchydAbjQtS2bkq7lXCqevbjOmaXHBfZ+GS6dy2pIso/NiMkMA5tx31mVe1Ha0X6L6/5f/mBYRzQywvbj//15fJaJooT2wpdN5xwyQQPkHm1VipbBH0LOdEtR9GhUn1vUesPq7NY/pr/J3db7OVCGWq0TeQTK3KVbzR6J2g+L/ZX/XJidp26Lc/Upw8iGcwXH6xLAzFK01W59LJA5GFdtwTbI5yjZdcLO5TKLjh9MjlQAapcHnjfFV7J+uXwB+nukh4Yc6J8kub1uaoy0/4/xFyahEc3ZhtPHHM/3vetNFLyNzZgvc51+NeundskPZJh1qG33Yh/J6dTFKkMkOT6HE8afhAa5Bet/asXWzfCKCZ/2YUGwEfIqJXoQCEUK028zcpXMHfRBZyCvOW8lIxvQoI8yZZRPg22DKS03cz4d1cUugxOxYHBSv8CbUyNP9i8d5rVMcdL0EkTSO8beu062Fu8y+lrsD4iGCpIRMH29pX82++r7V+KFLUY71mRE8GDczAGiWRlD5+vjzNrHNbS+TOMSWzAlvAMACox/R+f4IvBPAaF03xo= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(136003)(376002)(346002)(39860400002)(396003)(230922051799003)(82310400011)(186009)(451199024)(64100799003)(1800799012)(36840700001)(46966006)(40470700004)(426003)(336012)(6666004)(2616005)(83380400001)(478600001)(86362001)(110136005)(70586007)(70206006)(54906003)(316002)(41300700001)(921011)(1076003)(26005)(36860700001)(44832011)(5660300002)(8936002)(4326008)(8676002)(7416002)(356005)(81166007)(40480700001)(40460700003)(47076005)(82740400003)(15650500001)(2906002)(36756003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jan 2024 10:48:54.8494 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a1e4b64d-d498-46f3-34e8-08dc21810dfd X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN3PEPF0000B06A.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4287 X-Patchwork-Delegate: kuba@kernel.org When GEM is used as a wake device, it is not mandatory for the RX DMA to be active. The RX engine in IP only needs to receive and identify a wake packet through an interrupt. The wake packet is of no further significance; hence, it is not required to be copied into memory. By disabling RX DMA during suspend, we can avoid unnecessary DMA processing of any incoming traffic. During suspend, perform either of the below operations: tie-off/dummy descriptor: Disable unused queues by connecting them to a looped descriptor chain without free slots. queue disable: The newer IP version allows disabling individual queues. Co-developed-by: Harini Katakam Signed-off-by: Harini Katakam Signed-off-by: Vineeth Karumanchi --- drivers/net/ethernet/cadence/macb.h | 7 +++ drivers/net/ethernet/cadence/macb_main.c | 58 +++++++++++++++++++++++- 2 files changed, 64 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h index aa5700ac9c00..f68ff163aa18 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h @@ -645,6 +645,9 @@ #define GEM_T2OFST_OFFSET 0 /* offset value */ #define GEM_T2OFST_SIZE 7 +/* Bitfields in queue pointer registers */ +#define GEM_RBQP_DISABLE BIT(0) + /* Offset for screener type 2 compare values (T2CMPOFST). * Note the offset is applied after the specified point, * e.g. GEM_T2COMPOFST_ETYPE denotes the EtherType field, so an offset @@ -737,6 +740,7 @@ #define MACB_CAPS_HIGH_SPEED 0x02000000 #define MACB_CAPS_CLK_HW_CHG 0x04000000 #define MACB_CAPS_MACB_IS_EMAC 0x08000000 +#define MACB_CAPS_QUEUE_DISABLE 0x00002000 #define MACB_CAPS_FIFO_MODE 0x10000000 #define MACB_CAPS_GIGABIT_MODE_AVAILABLE 0x20000000 #define MACB_CAPS_SG_DISABLED 0x40000000 @@ -1254,6 +1258,7 @@ struct macb { u32 (*macb_reg_readl)(struct macb *bp, int offset); void (*macb_reg_writel)(struct macb *bp, int offset, u32 value); + struct macb_dma_desc *rx_ring_tieoff; size_t rx_buffer_size; unsigned int rx_ring_size; @@ -1276,6 +1281,8 @@ struct macb { struct gem_stats gem; } hw_stats; + dma_addr_t rx_ring_tieoff_dma; + struct macb_or_gem_ops macbgem_ops; struct mii_bus *mii_bus; diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index 898debfd4db3..47cbea58e6c3 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -2479,6 +2479,12 @@ static void macb_free_consistent(struct macb *bp) bp->macbgem_ops.mog_free_rx_buffers(bp); + if (bp->rx_ring_tieoff) { + dma_free_coherent(&bp->pdev->dev, macb_dma_desc_get_size(bp), + bp->rx_ring_tieoff, bp->rx_ring_tieoff_dma); + bp->rx_ring_tieoff = NULL; + } + for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) { kfree(queue->tx_skb); queue->tx_skb = NULL; @@ -2568,6 +2574,16 @@ static int macb_alloc_consistent(struct macb *bp) if (bp->macbgem_ops.mog_alloc_rx_buffers(bp)) goto out_err; + /* Required for tie off descriptor for PM cases */ + if (!(bp->caps & MACB_CAPS_QUEUE_DISABLE)) { + bp->rx_ring_tieoff = dma_alloc_coherent(&bp->pdev->dev, + macb_dma_desc_get_size(bp), + &bp->rx_ring_tieoff_dma, + GFP_KERNEL); + if (!bp->rx_ring_tieoff) + goto out_err; + } + return 0; out_err: @@ -2575,6 +2591,16 @@ static int macb_alloc_consistent(struct macb *bp) return -ENOMEM; } +static void macb_init_tieoff(struct macb *bp) +{ + struct macb_dma_desc *d = bp->rx_ring_tieoff; + /* Setup a wrapping descriptor with no free slots + * (WRAP and USED) to tie off/disable unused RX queues. + */ + macb_set_addr(bp, d, MACB_BIT(RX_WRAP) | MACB_BIT(RX_USED)); + d->ctrl = 0; +} + static void gem_init_rings(struct macb *bp) { struct macb_queue *queue; @@ -2598,6 +2624,8 @@ static void gem_init_rings(struct macb *bp) gem_rx_refill(queue); } + if (!(bp->caps & MACB_CAPS_QUEUE_DISABLE)) + macb_init_tieoff(bp); } static void macb_init_rings(struct macb *bp) @@ -2615,6 +2643,8 @@ static void macb_init_rings(struct macb *bp) bp->queues[0].tx_head = 0; bp->queues[0].tx_tail = 0; desc->ctrl |= MACB_BIT(TX_WRAP); + + macb_init_tieoff(bp); } static void macb_reset_hw(struct macb *bp) @@ -4917,7 +4947,8 @@ static const struct macb_config sama7g5_emac_config = { static const struct macb_config versal_config = { .caps = MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_JUMBO | - MACB_CAPS_GEM_HAS_PTP | MACB_CAPS_BD_RD_PREFETCH | MACB_CAPS_NEED_TSUCLK, + MACB_CAPS_GEM_HAS_PTP | MACB_CAPS_BD_RD_PREFETCH | + MACB_CAPS_QUEUE_DISABLE | MACB_CAPS_NEED_TSUCLK, .dma_burst_length = 16, .clk_init = macb_clk_init, .init = init_reset_optional, @@ -5214,6 +5245,7 @@ static int __maybe_unused macb_suspend(struct device *dev) struct macb_queue *queue; unsigned long flags; unsigned int q; + u32 ctrlmask; int err; if (!device_may_wakeup(&bp->dev->dev)) @@ -5224,6 +5256,30 @@ static int __maybe_unused macb_suspend(struct device *dev) if (bp->wol & MACB_WOL_ENABLED) { spin_lock_irqsave(&bp->lock, flags); + + /* Disable Tx and Rx engines before disabling the queues, + * this is mandatory as per the IP spec sheet + */ + ctrlmask = macb_readl(bp, NCR); + ctrlmask &= ~(MACB_BIT(TE) | MACB_BIT(RE)); + macb_writel(bp, NCR, ctrlmask); + for (q = 0, queue = bp->queues; q < bp->num_queues; + ++q, ++queue) { + /* Disable RX queues */ + if (bp->caps & MACB_CAPS_QUEUE_DISABLE) { + queue_writel(queue, RBQP, GEM_RBQP_DISABLE); + } else { + /* Tie off RX queues */ + queue_writel(queue, RBQP, + lower_32_bits(bp->rx_ring_tieoff_dma)); + queue_writel(queue, RBQPH, + upper_32_bits(bp->rx_ring_tieoff_dma)); + } + } + /* Enable Receive engine */ + ctrlmask = macb_readl(bp, NCR); + ctrlmask |= MACB_BIT(RE); + macb_writel(bp, NCR, ctrlmask); /* Flush all status bits */ macb_writel(bp, TSR, -1); macb_writel(bp, RSR, -1); From patchwork Tue Jan 30 10:48:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vineeth Karumanchi X-Patchwork-Id: 13537236 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 49EE066B5B; Tue, 30 Jan 2024 10:49:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.40 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706611742; cv=fail; b=ofxF1ZaFu/aA8PxpycsS1Fe76RP7G9yA/BGap1pndsuOgu6gL+w8M8Tgb3TtOcK3C5Va7ohgrGq5Ti1zs6XobR5eHsYRYSgKNMK4i9LjLX1F4my07XLfhSxKeXX4T+Pyb/yhH6FHEtzVavOtvNqInXIYR8XQYothnUh9e4kSdl0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706611742; c=relaxed/simple; bh=biTXvryiZ3WQTBqxPgXjsX2gkI1slSAyXaVbQ3CBY5o=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=I5oLYv15Kf6U6Twl/OQDhafa4bKdPJMP2Xcj8MnLtkjHBn/J9tFAi4EBLW7sGJLOX2a/eGl+a16uJzBduCASvF/kO1uW4IrySWDRNhCq5WFQKxjyNd7vn4OoWe7YQWa7UoFsEY759srKdzin8a6qt8Gto8wyt8aRi5y/yuGzzhI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=RckPYNw2; arc=fail smtp.client-ip=40.107.236.40 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="RckPYNw2" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O2MVALKGhnbDYhR6d9M1jacRV3C1WEdIcHRnHkFcr2PsG3EJXiNeoOQUzkVV7CHchl1f0E2DnMHRkXoYRt7rpuIzF3nFcWz/5A35+UmDUFQf5WGcZoJWhDC3wyoB392c7lH0oBs9V74Qa1OU7lXsX022iDhHUhgrBqAw9QVI3i2DEk0FvWq2ZiVP5aM+HmEIExOTge2fkecH8y2OidkrBJ+8h3oz8zvSNu7a9DrLGTra8Wkp4JHbsO+qsAZPeWz3VuDYAR1M8NW4Yyz9FXkkr5EpW/WpGeetUk3vh72aX/lCXKC0pc0ZZYQ3owoRT9AHFHsJqrP0Fg28JYPVdQfgKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=obFxm1giMMeF4glfS4zrlTKUuRz9I220oRhmyWlRqcw=; b=mHpMaNHtaO/gxmDZ3qpU6kLYifF/qetbTAf3ZLjptrtKjL06gLrKT2p4iFJWYnu1iGEf/EQEZk6Xn6Kxjr477yOEFR/Kl5ZT4uUs/K4FqhGwP77yWJQnwHp5bz02LpkA/huWI9G6RgjdhNuKTUH/qs0zACbryWPTokmggdwadJWv+xvSEHEu21/m5IG574V6YYy3nQaGjr70juETJE6gfXTJBzIbGImeITRJKtYsQiHyQT5ImzCy+YQLnrev1425barAWjJOv9Hur9onxnYjFrXmqDFYI8pcO5X1wwEIIR08a8h4tKCyhOYGuTZAQ81W2FVmjRHgtUOBhMcH2t+huQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=microchip.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=obFxm1giMMeF4glfS4zrlTKUuRz9I220oRhmyWlRqcw=; b=RckPYNw2bbxtwVj5ZKRyAKPXxl6EWH1+l2/Q6Rb//xf6kEhBLAj+P8fSk1O3+bmA/HLD47x9eg/Q2kELcGx1GEQP08mNn6shLq9H0sktNjln5pEY3WpAf3KGdrIIhOujllr33G7LaF4iq89hoT/JDhydvV9jkjpEzN30fFATg5o= Received: from BN9PR03CA0556.namprd03.prod.outlook.com (2603:10b6:408:138::21) by PH0PR12MB5417.namprd12.prod.outlook.com (2603:10b6:510:e1::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.32; Tue, 30 Jan 2024 10:48:58 +0000 Received: from BN3PEPF0000B070.namprd21.prod.outlook.com (2603:10b6:408:138:cafe::24) by BN9PR03CA0556.outlook.office365.com (2603:10b6:408:138::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.34 via Frontend Transport; Tue, 30 Jan 2024 10:48:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by BN3PEPF0000B070.mail.protection.outlook.com (10.167.243.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7270.0 via Frontend Transport; Tue, 30 Jan 2024 10:48:58 +0000 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Tue, 30 Jan 2024 04:48:57 -0600 Received: from xhdvineethc40.xilinx.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2507.34 via Frontend Transport; Tue, 30 Jan 2024 04:48:54 -0600 From: Vineeth Karumanchi To: , , , , , , , , , CC: , , , , Subject: [PATCH net-next 2/3] dt-bindings: net: cdns,macb: Add wol-arp-packet property Date: Tue, 30 Jan 2024 16:18:44 +0530 Message-ID: <20240130104845.3995341-3-vineeth.karumanchi@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240130104845.3995341-1-vineeth.karumanchi@amd.com> References: <20240130104845.3995341-1-vineeth.karumanchi@amd.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B070:EE_|PH0PR12MB5417:EE_ X-MS-Office365-Filtering-Correlation-Id: b20269a0-1106-4709-4747-08dc2181102b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PsGxUehBtKWwkyCxm0s23VoHdCkVIU2/8j8MIZSjfbBYZlMnYiB2V9QwdiI4KViytxugQqYkmiCrnKBgIkz7Y0Ois24zQv5H3v3VjBtYjPRYwR7S2cqKc2RsDiEFXV/Pr6Xv4ljY4/VcQKgOTFlWZB7t7r0Ykef0COxiBD1xln+BTtY4fhF9hyb+Vue+o3W4pYi2+Y2kCTJhmmBXYU25mG9vZ+JAWerChuTY5C8PfZWnxH66eKjerWZte9Be2592NxdCz8uCR1K1tTP8TvX6u5r/mra8EWyIrrXv5SFLpGo4wZWTlG58MJueE7Iq4+gsYDT+qoq08a/rhPytZIhpcxOIQD4flMJVFOGr2dePV4KPuEggViaKrfVEo4upnV5eKbTnU/KDDSQOcxg8zW8lI19ph/SfSuhgb+rUBzhek5x3+Vq8fHwr2YP8FovcxN2xAun/PcIZDbpTfzaSi5bxJwOsRJM0eCToHwiGssgRL2Yn5gY2Tw3ArZvpMEk+hRklngda4s0OEDGwOe6bObYmZuIo04SGSmroMDeFPlhmAVnuUi/5ZdeESX2D64/adPGAIVIP0LYRdVe0o1hgnZECh8j4jY5lqvRf50hVLLI97QdYFmN21qGqCyIDQjMxVkRjSKztPwHegFlPbsiWUlxrjrR/Lqtm1AIH2eQZpJDSE+HDsf0fSF6wZu0MAbF3J+JPIcyDZYZ5UWwX59FJiWkABhDZm1HKCKJajwLNTabO9ayR6zzFxzN4cDYT0sWcktnX5S/KO6YZF98GFueViOf1zv7URr6AOnfdNe6tATEEEx4= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(346002)(136003)(396003)(376002)(39860400002)(230922051799003)(82310400011)(186009)(64100799003)(1800799012)(451199024)(36840700001)(46966006)(40470700004)(26005)(40480700001)(40460700003)(426003)(336012)(6666004)(1076003)(36756003)(86362001)(82740400003)(356005)(44832011)(4744005)(8936002)(41300700001)(4326008)(5660300002)(36860700001)(478600001)(2616005)(316002)(47076005)(110136005)(70206006)(54906003)(921011)(2906002)(7416002)(81166007)(8676002)(70586007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jan 2024 10:48:58.5068 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b20269a0-1106-4709-4747-08dc2181102b X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN3PEPF0000B070.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB5417 X-Patchwork-Delegate: kuba@kernel.org "wol-arp-packet" property enables WOL with ARP packet. It is an extension to "magic-packet for WOL. Signed-off-by: Vineeth Karumanchi --- 7c4a1d0cfdc1 net: macb: make magic-packet property generic which added magic-property support and wol-arp-packet addition is similar extension. --- Documentation/devicetree/bindings/net/cdns,macb.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/net/cdns,macb.yaml b/Documentation/devicetree/bindings/net/cdns,macb.yaml index bf8894a0257e..4bea177e85bc 100644 --- a/Documentation/devicetree/bindings/net/cdns,macb.yaml +++ b/Documentation/devicetree/bindings/net/cdns,macb.yaml @@ -144,6 +144,11 @@ patternProperties: description: Indicates that the hardware supports waking up via magic packet. + wol-arp-packet: + type: boolean + description: + Indicates that the hardware supports waking up via ARP packet. + unevaluatedProperties: false required: From patchwork Tue Jan 30 10:48:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vineeth Karumanchi X-Patchwork-Id: 13537237 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2082.outbound.protection.outlook.com [40.107.244.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 98872657BC; Tue, 30 Jan 2024 10:49:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.82 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706611769; cv=fail; b=JGRqtkdXK0b8xwyrR7S7G7r1vhkH/9v1Yr526Dhc6YsOMKKvK3nJPymGaoFaqsyNKiEuA4B52hnWlrvpq2+5oE/g8snWbJ9NE59Y99zpdzjdnB66YdMS1HYoelVo9ZZHJsb069BXX9r7tfH4XbSyi76+kMTva/3UFcNUIKdMxuk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706611769; c=relaxed/simple; bh=rfKB6Tjw513uE/Mn59JQN06GgBjAn6OG1rKqvXyxNC8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ArPCOLP1BLhf82nX68RQUXDs4ddp2Ug79UZry1D1jqw3WWCyZTx4VfrhHbHIQ4eSG9IOOCNnhmK7ZfrL0t1HeYMG/kYAwS66hyQymgf+ijeIVr14Uc3DlmE1J86WiZALeIDwt8x7oeXRFLI5o5HkzkuqgKpkNjM8Di0Y43RBmJ0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=yCUrT+NS; arc=fail smtp.client-ip=40.107.244.82 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="yCUrT+NS" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eH5OHh7OxbefTIaiW5rILgvADlMF7P19bc3SmsJxoHOlmzIceWGEuj2d4DP71BmTewYNbaC/C43ApLzBhgtJGNUMO2qMHPNqUIvzj6iwUT4CgVbT196YmxCWyLbQJehKHLdvtDuOR5PE6uDA3LTPeB+KCnBss8c3/bISBNTeeo2UlakVy+9JRMdDOoCDQCGCsSVwOuxY+D6QPyChD8Ue37uSzSiO5FeRBiQzxNLS+Kcy3uGOnSB/yihE9J1AdErMq3MKJZ5ZQzBvY3MgOTdJDDCn5cJIxJqDUZuZkpdgK3U8MK9MkStL1soT8+bvhrPiFAHTERVHwzmIJCuN1gjYMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=O3vQd3iu1TOr+f1V8gLySnLPSkuaLzFhNYZYEgmFLGU=; b=VtX5/JE1NdBBi4FtGThVm/UJ1AGQDVqVJ6faNQZfrDzsB1wPOo/rCH+HwMuNZnQMzmic6fMkF05YmP6FRY3jcENvs8hQbRtXMtCcglIEKYnFP4Pb8r6OrUNQ27srPuLMBEpmqvnAxcb0avU4Klf1bwPWWImZBUPa8myC8LuOOX0JY1I79z77xYdOS3Q8rHarqywn44NO1Ffyj0a6C+ljnDmLsACh+z1x20yYnTQ7qm3e1txvHe/ebhvGJpLFUhm7nkwlgw6VNxt6A/06j/xxw9R3OQPuRwBZ8fyLYcUJgE6foqFY0IFNbzE9nWcN5wpaP+olrHapKxqKYA1jJALeqQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=microchip.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=O3vQd3iu1TOr+f1V8gLySnLPSkuaLzFhNYZYEgmFLGU=; b=yCUrT+NS+DvW8GBmnEKW/oylv48qByoocoWgLJBFpqlzG8FGH5FDxZi4IIgZbMhS5lEZ8bXZcCRbYwV89A+ZBs918hHznoqjOjycxvkD555s/JRtyBPrXX0VucNrLdr0+VK/BuqiTsNni7iDk6FSS0x9oW7chByEn4xc4vVxuWg= Received: from BYAPR01CA0038.prod.exchangelabs.com (2603:10b6:a03:94::15) by SA0PR12MB7462.namprd12.prod.outlook.com (2603:10b6:806:24b::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.22; Tue, 30 Jan 2024 10:49:23 +0000 Received: from SJ1PEPF00001CE8.namprd03.prod.outlook.com (2603:10b6:a03:94:cafe::4b) by BYAPR01CA0038.outlook.office365.com (2603:10b6:a03:94::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.34 via Frontend Transport; Tue, 30 Jan 2024 10:49:22 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ1PEPF00001CE8.mail.protection.outlook.com (10.167.242.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7202.16 via Frontend Transport; Tue, 30 Jan 2024 10:49:22 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Tue, 30 Jan 2024 04:49:22 -0600 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Tue, 30 Jan 2024 04:49:01 -0600 Received: from xhdvineethc40.xilinx.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2507.34 via Frontend Transport; Tue, 30 Jan 2024 04:48:58 -0600 From: Vineeth Karumanchi To: , , , , , , , , , CC: , , , , Subject: [PATCH net-next 3/3] net: macb: Add ARP support to WOL Date: Tue, 30 Jan 2024 16:18:45 +0530 Message-ID: <20240130104845.3995341-4-vineeth.karumanchi@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240130104845.3995341-1-vineeth.karumanchi@amd.com> References: <20240130104845.3995341-1-vineeth.karumanchi@amd.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00001CE8:EE_|SA0PR12MB7462:EE_ X-MS-Office365-Filtering-Correlation-Id: 6817d231-7a7d-4eb8-e473-08dc21811e97 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6U3eXpwBbQyo6a1eeXWZC9ym/IfTTOaEdb1zWmXmlQHsKYwDJWLxPuxZFxH87syu7RVIsnSjJBdRav9N+xyNUFbi2Vs94fFu/knb1GxAuuPU/C1OPeL/BVO1BC4o6KoIyYF+URJO6FHQZ4QyB1yUOp4mMp8KackEDwLc6pEgHfGyyFqcGpdpa1gnpjnE/j12u8L/VhUIyiLkUG4wD9JETfkq9gso/ZOcWErbRB6z8wEGictc73a1evjtDQn4AmGfUTi1AfuUJ0W0aLJvOVWCL07oZtNCAgtJuu7PO6bIrWBP+TGpPha8pFjQGzUzxZ26TV1H5mafHBrK5v0Ez5S/AGRUiq1kAQHypgxahjpXA/kuLrtkPfYvi0hZYLiMi8HFRwdi65DA/3CDP+22ogg+lGANXVR+NBkmQaMG+WOSKCqDKHCLxFo2L3tEjIMMzMpI1wYbeqfHYq8QiWxdFOQ4jXpi2b3Hh0h8rdfNGaBTuZs0pqgqSQcfZ355e4CZfQHg87/iEZV3i0JD+jn4N3RcGcuXVJ3mKrb06pkfMITJzcw28mLiXjy+o/n+Z58zsFLP4rStLHTXbfqcoMtt12ly+3ezwjvpwEAyaWnt3w4DPbV/ijYu3ll/xGN/lztSin9xsyYM289dKuSwa2Ept3/pU+aXk1XCMtZ4/miRhyHdJBlorKGRhjQZ8w5C7NcUgyCVeglPrmnU3TnAa7UkblVKPpZLewiHWyHecq7qDaS4E83grVOZMOxFpp9WZiDC2lyyl7AesB0LXhVKmnnWqVnndh4D1fDDkRJ++0taDIOpR8o= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(396003)(39860400002)(136003)(376002)(346002)(230922051799003)(186009)(451199024)(82310400011)(64100799003)(1800799012)(40470700004)(46966006)(36840700001)(8676002)(4326008)(8936002)(7416002)(2906002)(44832011)(5660300002)(86362001)(70586007)(110136005)(316002)(70206006)(54906003)(36756003)(36860700001)(47076005)(82740400003)(81166007)(356005)(6666004)(478600001)(2616005)(83380400001)(1076003)(336012)(426003)(921011)(41300700001)(26005)(40480700001)(40460700003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jan 2024 10:49:22.6442 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6817d231-7a7d-4eb8-e473-08dc21811e97 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF00001CE8.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB7462 X-Patchwork-Delegate: kuba@kernel.org Add wake-on LAN support using ARP with the provision to select through ethtool. Advertise wakeup capability in the probe and get the supported modes from the device tree. Re-order MACB_WOL_<> macros for ease of extension. Add ARP support configurable through ethtool, "wolopts" variable in struct macb contains the current WOL options configured through ethtool. For WOL via ARP, ensure the IP address is assigned and report an error otherwise. Co-developed-by: Harini Katakam Signed-off-by: Harini Katakam Signed-off-by: Vineeth Karumanchi --- drivers/net/ethernet/cadence/macb.h | 1 + drivers/net/ethernet/cadence/macb_main.c | 54 ++++++++++++++++++------ 2 files changed, 43 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h index f68ff163aa18..db7e95dc56e3 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h @@ -1306,6 +1306,7 @@ struct macb { unsigned int jumbo_max_len; u32 wol; + u32 wolopts; /* holds value of rx watermark value for pbuf_rxcutthru register */ u32 rx_watermark; diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index 47cbea58e6c3..cbe1a9de692a 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -38,6 +38,7 @@ #include #include #include +#include #include "macb.h" /* This structure is only used for MACB on SiFive FU540 devices */ @@ -84,8 +85,9 @@ struct sifive_fu540_macb_mgmt { #define GEM_MTU_MIN_SIZE ETH_MIN_MTU #define MACB_NETIF_LSO NETIF_F_TSO -#define MACB_WOL_HAS_MAGIC_PACKET (0x1 << 0) -#define MACB_WOL_ENABLED (0x1 << 1) +#define MACB_WOL_ENABLED (0x1 << 0) +#define MACB_WOL_HAS_MAGIC_PACKET (0x1 << 1) +#define MACB_WOL_HAS_ARP_PACKET (0x1 << 2) #define HS_SPEED_10000M 4 #define MACB_SERDES_RATE_10G 1 @@ -3276,19 +3278,21 @@ static void macb_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) { struct macb *bp = netdev_priv(netdev); - if (bp->wol & MACB_WOL_HAS_MAGIC_PACKET) { + if (bp->wol & (MACB_WOL_HAS_MAGIC_PACKET | MACB_WOL_HAS_ARP_PACKET)) phylink_ethtool_get_wol(bp->phylink, wol); + if (bp->wol & MACB_WOL_HAS_MAGIC_PACKET) wol->supported |= WAKE_MAGIC; - - if (bp->wol & MACB_WOL_ENABLED) - wol->wolopts |= WAKE_MAGIC; - } + if (bp->wol & MACB_WOL_HAS_ARP_PACKET) + wol->supported |= WAKE_ARP; + /* Pass wolopts to ethtool */ + wol->wolopts = bp->wolopts; } static int macb_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) { struct macb *bp = netdev_priv(netdev); int ret; + bp->wolopts = 0; /* Pass the order to phylink layer */ ret = phylink_ethtool_set_wol(bp->phylink, wol); @@ -3298,11 +3302,16 @@ static int macb_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) if (!ret || ret != -EOPNOTSUPP) return ret; - if (!(bp->wol & MACB_WOL_HAS_MAGIC_PACKET) || - (wol->wolopts & ~WAKE_MAGIC)) + if (!(bp->wol & (MACB_WOL_HAS_MAGIC_PACKET | MACB_WOL_HAS_ARP_PACKET)) || + (wol->wolopts & ~(WAKE_MAGIC | WAKE_ARP))) return -EOPNOTSUPP; if (wol->wolopts & WAKE_MAGIC) + bp->wolopts |= WAKE_MAGIC; + if (wol->wolopts & WAKE_ARP) + bp->wolopts |= WAKE_ARP; + + if (bp->wolopts) bp->wol |= MACB_WOL_ENABLED; else bp->wol &= ~MACB_WOL_ENABLED; @@ -5086,7 +5095,10 @@ static int macb_probe(struct platform_device *pdev) bp->wol = 0; if (of_property_read_bool(np, "magic-packet")) bp->wol |= MACB_WOL_HAS_MAGIC_PACKET; - device_set_wakeup_capable(&pdev->dev, bp->wol & MACB_WOL_HAS_MAGIC_PACKET); + if (of_property_read_bool(np, "wol-arp-packet")) + bp->wol |= MACB_WOL_HAS_ARP_PACKET; + + device_set_wakeup_capable(&pdev->dev, (bp->wol) ? true : false); bp->usrio = macb_config->usrio; @@ -5243,6 +5255,7 @@ static int __maybe_unused macb_suspend(struct device *dev) struct net_device *netdev = dev_get_drvdata(dev); struct macb *bp = netdev_priv(netdev); struct macb_queue *queue; + struct in_ifaddr *ifa; unsigned long flags; unsigned int q; u32 ctrlmask; @@ -5255,6 +5268,12 @@ static int __maybe_unused macb_suspend(struct device *dev) return 0; if (bp->wol & MACB_WOL_ENABLED) { + /* Check for IP address in WOL ARP mode */ + ifa = rtnl_dereference(bp->dev->ip_ptr->ifa_list); + if ((bp->wolopts & WAKE_ARP) && !ifa) { + netdev_err(netdev, "IP address not assigned\n"); + return -EOPNOTSUPP; + } spin_lock_irqsave(&bp->lock, flags); /* Disable Tx and Rx engines before disabling the queues, @@ -5291,6 +5310,17 @@ static int __maybe_unused macb_suspend(struct device *dev) if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE) queue_writel(queue, ISR, -1); } + + ctrlmask = 0; + if (bp->wolopts & WAKE_MAGIC) + ctrlmask = MACB_BIT(MAG); + if (bp->wolopts & WAKE_ARP) { + ctrlmask |= MACB_BIT(ARP); + /* write IP address into register */ + ctrlmask |= cpu_to_be32p(&ifa->ifa_local) + & GENMASK(MACB_IP_SIZE - 1, 0); + } + /* Change interrupt handler and * Enable WoL IRQ on queue 0 */ @@ -5306,7 +5336,7 @@ static int __maybe_unused macb_suspend(struct device *dev) return err; } queue_writel(bp->queues, IER, GEM_BIT(WOL)); - gem_writel(bp, WOL, MACB_BIT(MAG)); + gem_writel(bp, WOL, ctrlmask); } else { err = devm_request_irq(dev, bp->queues[0].irq, macb_wol_interrupt, IRQF_SHARED, netdev->name, bp->queues); @@ -5318,7 +5348,7 @@ static int __maybe_unused macb_suspend(struct device *dev) return err; } queue_writel(bp->queues, IER, MACB_BIT(WOL)); - macb_writel(bp, WOL, MACB_BIT(MAG)); + macb_writel(bp, WOL, ctrlmask); } spin_unlock_irqrestore(&bp->lock, flags);