From patchwork Wed Sep 18 19:34:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Shenwei Wang X-Patchwork-Id: 13807140 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D1812CDD553 for ; Wed, 18 Sep 2024 19:37:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version: Content-Transfer-Encoding:Content-Type:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=X5/SM/0l1qlyf2sZmxs2dMvV6GRHGhExzB78rxEp9Jg=; b=Qkr6ZxHZImcYRLZ24PRk4Xsb6A Uny8/S6afZ6ui0dZA/rl8ypaMStDb/Rv6/TvXvmCSTviqAU4qNHE50QJ3VIsE1wmiaLsAhf7NL4Va 2iiBR5Aad9vMy391Hre8C/wP7f35q6QXJcmeS2EIF2/JOBvWIRSgiQHnDwabhche4vI24K5ehyEbt pwIr9bRtrFa9v0EXaMXnELX0xg9Si2qGZOR8qZNpoanaOr6HdrmgMVkNgg20xNabz+XEblyupyFgH l4KH+MNK4m0Ink8d9j7MsU+M58IG/15fv7NHvndKdq6u3o74CzpLQSRvnp1wK5xBnaLAmzW7YqOTA gJsW0etQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sr0Tn-00000008tcA-2x2a; Wed, 18 Sep 2024 19:36:47 +0000 Received: from mail-westeuropeazlp170110003.outbound.protection.outlook.com ([2a01:111:f403:c201::3] helo=AS8PR04CU009.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sr0Sh-00000008tYB-0z3k for linux-arm-kernel@lists.infradead.org; Wed, 18 Sep 2024 19:35:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=eDyEJ/XZQTIQgmKj+EXUFFdHUn6IgBnYZFxKc9ZZiL4DU/TSg4qdW7464In7MSiH59cXJuCziF5vgFcqniNpBY4sf255MZWSQyxUMrKh5LpUb0SV9eC4TBhqfvSWxkvoBsyeBi0kE2J4PZkOJuCMAWzK5quOpq8dkF76h4KBXMXJCu5MV32GtFT3rUKFYQRnCMfofjzWrKNGjiYb5aa2rkCRU5yfWdQg5SUTrtjzb/BNJwcY5uYsL/3MdnkVqaVCIQ71YbW8QGgu6HiGYB/IbP1ZOdsFsUY2qca6jgDwcV2zc6fphsXb4606MOrCoFb2kMMuomHH8gh6k6xsljDeCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=X5/SM/0l1qlyf2sZmxs2dMvV6GRHGhExzB78rxEp9Jg=; b=q80lD84eNziV8KUT+H8qw0P4g06s3cAwyBRTNs3nWEwB9Bd9cJvMt6wXExO9MRFDsRhXm7hdYIu/koq6mM0Copq/9MOyn3q8oat565BrH8iy7esDfBkIuFgsqsDcnNLMZ+Mid3PpWm/+4SA6mR1kuJM3LCf/ja4NRDbqwGnADIFSFTRNGyRmOZlfVxTpb4SthBCO0FyLf+pmcHaIUp9eweiUzILvOz4ae9ZUZPI6C2m/zdyIy41zn6veCkGbrN+YQZ02v8JqduyQkqr6tVGPXDoSsItRM8A2+OVI54R3Z18HJHlXLqZ4ZvmJ0bCM+e8BcAhoTG2FcimiNRt3aQRwKw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=X5/SM/0l1qlyf2sZmxs2dMvV6GRHGhExzB78rxEp9Jg=; b=gOzCvwjKOhNYSeOa/C1d8Jcwv5z5MUwiyP08EE6elImZYZGu3E0heO72ye9IBcP1AZ3VIzuvFek38Su19tTNRwR58eVWrNZhCxR71/5NMWNSglQHUL/6JAJNcZeQMNLQrdvBoOdYuu6qiGcRdLzXwQQNeWG4GcHDjiuPwJSKp4L4KY3fLYpLklC1U3gLlHL+P7DhuUQyeb+K4rQX7xM17d3D9t8qLpiGpLHBENI3bxH8eRTOAr/FliWa4ma1AxbKlMcP+gJNvZiUqM/XyO5YpFwFhMafbpnz/xSq8wDot8r895OYWmpTz5qEhltuev8w1ttSaskhsXeyxvJqXKJtRg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9185.eurprd04.prod.outlook.com (2603:10a6:102:231::11) by VI2PR04MB10764.eurprd04.prod.outlook.com (2603:10a6:800:271::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.16; Wed, 18 Sep 2024 19:35:24 +0000 Received: from PAXPR04MB9185.eurprd04.prod.outlook.com ([fe80::21bf:975e:f24d:1612]) by PAXPR04MB9185.eurprd04.prod.outlook.com ([fe80::21bf:975e:f24d:1612%3]) with mapi id 15.20.7939.022; Wed, 18 Sep 2024 19:35:23 +0000 From: Shenwei Wang To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , horms@kernel.org Cc: Alexandre Torgue , Jose Abreu , Ong Boon Leong , Wong Vee Khee , Chuah Kim Tatt , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, linux-imx@nxp.com, Shenwei Wang Subject: [PATCH v2 net] net: stmmac: dwmac4: extend timeout for VLAN Tag register busy bit check Date: Wed, 18 Sep 2024 14:34:52 -0500 Message-Id: <20240918193452.417115-1-shenwei.wang@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SJ0PR13CA0174.namprd13.prod.outlook.com (2603:10b6:a03:2c7::29) To PAXPR04MB9185.eurprd04.prod.outlook.com (2603:10a6:102:231::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9185:EE_|VI2PR04MB10764:EE_ X-MS-Office365-Filtering-Correlation-Id: 6750c744-e610-4099-1f3e-08dcd8190a17 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|52116014|376014|7416014|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?PE/4snlwAuw6e+RPzFlfZgPMDqZIOWr?= =?utf-8?q?FSg01v0BDvB9f9d1mjDRRfZMPJwUDwc7XDSdc374ttcQmy9CNVbwumjNJz/eX23Rn?= =?utf-8?q?avDpebjk0y2b6KPv/rBcXfgeU81Skc7hkXTzQpidK6+5rqvwVdxgj55VGMLW618Sf?= =?utf-8?q?VoujS8FK87Q6F5t6qMqfTwD9xviFuPR+z6wmmu6si1dnsVuZP5psdFNX4tuRRaRu/?= =?utf-8?q?2TacQeoOsHCRf5yyZYRYPsSLw6LYh48X+iInHhrUeUcnrMajoC+b0Rhe8r+KsXpB4?= =?utf-8?q?egNf0OVBCydFg+BXjTKmQHf+vY7HuU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TBlQ6KZ+OVbAaNG6+1HNmFGDRUT065?= =?utf-8?q?M7GhyYY3cVOqteupblHeXVQgC+3l6AvGVO1KjcXbj2Yfyiy6UQVkIPKnpRBGkMAyE?= =?utf-8?q?+o3/q1TazPcs3oS3oS0PfXiOhtJJqnmxxTCW6fq2rI8e0eGylXrCfqcuvyMofF9yu?= =?utf-8?q?Sumrro7j3fzXNnEWe0ORkOMI5OVNVALtJg=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9185.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(52116014)(376014)(7416014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?m6Retq303COJsUsGlfOJ19SpyPJ0?= =?utf-8?q?OuzlsFZ4VYDQbpIrQ6UZAchWMj1krKozf+BwOsvbqIMVh1MyVkxiYp8uz0vgebk1e?= =?utf-8?q?q756/fT/FXMhdkPF1qaYcKFEFcFV7EneghAHuE8V/073gcpeXRKugeljmGLELwKoz?= =?utf-8?q?NMPiDuYfFFJoSrYqt9u7ByxAZ5IX25bvS2bl9UNAuU0NWCCobJugrs2RksMGYR3C4?= =?utf-8?q?Xaow3f722gj+JU3VdrophYD/U4s39uHKZqgtduwdY80sftOg6jNGbxWYWd0sMEoRO?= =?utf-8?q?w5Nnp0q1+mF3llt4i+Mec4cMYxoaYpyZboJkggnkoESSSyaOlo1Knu5EXcp0o6OZa?= =?utf-8?q?pmt0EKZF8IIdoibbHaroy1EaQbtGOEDL+JFzQFEI7iyQKq72xKMzEtwEOG7YsMsPv?= =?utf-8?q?nsOcgio8XX6k+k2uC2usAIxdRzXZwb4xaMpM+ETloLEFa1MxBXE9NAJGMKl8H7pZi?= =?utf-8?q?MdLz4dRymavyrUYNeTRWByJQNquWC5g7Zqz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EBdo5MOFgPz3s88Rx?= =?utf-8?q?jwF2e4WE8qglaFAEKbXw/sRS7rxi3z7aQ2p4nM91fdHzHZ5zEXjBIQoZgAQoVlx8L?= =?utf-8?q?eTfQQSKfvIRl+Qn4/HM6MyCqoZLFXnCtN0SHC00VhAcTsZnFYq9t9hB0YvnQbIuxV?= =?utf-8?q?lZg4CSA1Kchd?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6750c744-e610-4099-1f3e-08dcd8190a17 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9185.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2024 19:35:23.7930 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 0gRCBvQ9cEodzeJXxQiYIOLhLXR5/ElMNjj8/JbMPCCL6GB5aQ0ZMV53EzmiPPUPtcCsJ3NfZHVOZQmQs5FCtw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI2PR04MB10764 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240918_123539_306798_05827C20 X-CRM114-Status: GOOD ( 15.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Increase the timeout for checking the busy bit of the VLAN Tag register from 10µs to 500ms. This change is necessary to accommodate scenarios where Energy Efficient Ethernet (EEE) is enabled. Overnight testing revealed that when EEE is active, the busy bit can remain set for up to approximately 300ms. The new 500ms timeout provides a safety margin. Fixes: ed64639bc1e0 ("net: stmmac: Add support for VLAN Rx filtering") Signed-off-by: Shenwei Wang Reviewed-by: Andrew Lunn --- Changes in v2: - replace the udelay with readl_poll_timeout per Simon's review. --- drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) -- 2.34.1 diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c index a1858f083eef..a0cfa2eaebb4 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c @@ -14,6 +14,7 @@ #include #include #include +#include #include "stmmac.h" #include "stmmac_pcs.h" #include "dwmac4.h" @@ -471,7 +472,7 @@ static int dwmac4_write_vlan_filter(struct net_device *dev, u8 index, u32 data) { void __iomem *ioaddr = (void __iomem *)dev->base_addr; - int i, timeout = 10; + int ret, timeout = 500000; //500ms u32 val; if (index >= hw->num_vlan) @@ -487,12 +488,11 @@ static int dwmac4_write_vlan_filter(struct net_device *dev, writel(val, ioaddr + GMAC_VLAN_TAG); - for (i = 0; i < timeout; i++) { - val = readl(ioaddr + GMAC_VLAN_TAG); - if (!(val & GMAC_VLAN_TAG_CTRL_OB)) - return 0; - udelay(1); - } + ret = readl_poll_timeout(ioaddr + GMAC_VLAN_TAG, val, + !(val & GMAC_VLAN_TAG_CTRL_OB), + 1000, timeout); + if (!ret) + return 0; netdev_err(dev, "Timeout accessing MAC_VLAN_Tag_Filter\n");