From patchwork Tue Sep 24 20:54:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Shenwei Wang X-Patchwork-Id: 13811192 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 7EDDECF9C6B for ; Tue, 24 Sep 2024 20:56:29 +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=Tra+UPZqQsNzz/9oVTpxv2ung86t+AcusOp7s59Aq5M=; b=UCk51YyPUNX+2c2GNay2675hpk 7oztbpWsn0aMYA3g2dYRK2qoKZZLRzLbOFhOleDZhwYlZ2EfiP8zfkHBEEAAj09BYdfdnCPzc44Ye MeR5itWEXjxw3nliKUBz0efjdSjNHBga2FveHxo83kWjfHXLLFJPcisokHNnKvI6vhOW7zWAHBGyg xNHO7+g3NGxmog+bH399j581UtNS0ut2i7aSG6mcqkyAJb97k0jmf3n6j0fYcUvrVV4ob9FAFoptJ N5ASxgg5ndUvOPrVWuYJ6t8gFsywI8BD4+FEfaoXzUfn2LunmLp1qCSNJVZo/HnIWVENVrrXdFrad Z2FtzVlw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1stCa0-00000003IP6-0EIM; Tue, 24 Sep 2024 20:56:16 +0000 Received: from mail-northeuropeazlp170110001.outbound.protection.outlook.com ([2a01:111:f403:c200::1] helo=DB3PR0202CU003.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1stCYr-00000003II7-0cgU for linux-arm-kernel@lists.infradead.org; Tue, 24 Sep 2024 20:55:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fiVrCYVoru4Hft3M7vCgExIRuQ7IjtwzZZZfT//wpTTHFstnDa7JJ15BCd+RI5iwyZmWihkfTCNT6MKt5TUM46gqy/aFnSmLopE2PMwnLwDl0K78wuoIKVaHoqX+OpynSqTtEQ3fgpdrUf3hRoWzHGqGKm+/lNnld0OrKsigX5UXBWmV1KByvaAHjYcSbkXf/zEkFi6dcZ4GX+3CeUI1L5MeH3Itd+cZDTCy9RQSDddjF1kwntuZmj4egIfOMNhVnJt1QLrURaleaqxxugl+c7vLI+YKaRiOmZSaa9W/4Ewra2ubZqPQOf5BRonl8+2F+CwtVKbq97vZGu46+1OnOw== 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=Tra+UPZqQsNzz/9oVTpxv2ung86t+AcusOp7s59Aq5M=; b=aSBJFGJt1C33h426UQd85EcGK/02lh6n4OyTswXoJ1l5ww7HgNKYIdj2nqyNp9saIjoR2f3gG/a47VHiO8Q4BNJ3HaztGAyLNV+D9PzTyMfMAdYvaGcCZzHJftAV6EM+BgbWJFBAjaLLX22NhAtWsIrY8B6gyTwwJpJxHn18L34f3HB36cgipd6F8fiyIsVl2TwsjrB+i6eV5t0I5Ciejx9qYnEdesosYwu9JsL9QbkznsxRPcWEjh/ssXpOXh2LDkvRzjA4emgJ8M5diLPKNQXQlCcDU2Hl6sOPBC/CJIRtVedDVpx/ejHAtnYA/j1LArDPoUK1DJX+h7HMhxivFg== 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=Tra+UPZqQsNzz/9oVTpxv2ung86t+AcusOp7s59Aq5M=; b=Yuv55yjEFzPDkKNcS+sQ4SKK5SIpMkaEZRf+LdBwRLAVu0pqnFNGlL44xKaOIAqOpE6JmWRdqBBjLuxaMASX/HuxE+c4viWvA7ycZE/qjj1rJlr2hf61ZsZnRJjTO601g9ZXf/ATrlT0VmCDygUOYESSfpiB8DtRu6VUC3ktwKkSVYtOz3jvj0t+neeNZslgEbgPZBgwTb2ZVCQDmlB+X/JBRGfZgkLRdtboVleWJJvclGj1gMU1i/ouWdm6mLBDrKzNI22f28pFzncoyIZTF4xndm20IgWu4fitEo7GxxnX0X1KXcHv/0xYI0ddBtHtpjyn4zhmb+qbQpoo/QJnpQ== 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 AS1PR04MB9384.eurprd04.prod.outlook.com (2603:10a6:20b:4d8::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.25; Tue, 24 Sep 2024 20:54:50 +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; Tue, 24 Sep 2024 20:54:50 +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, Serge Semin , Shenwei Wang , Andrew Lunn Subject: [PATCH v4 net] net: stmmac: dwmac4: extend timeout for VLAN Tag register busy bit check Date: Tue, 24 Sep 2024 15:54:24 -0500 Message-Id: <20240924205424.573913-1-shenwei.wang@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SN6PR08CA0022.namprd08.prod.outlook.com (2603:10b6:805:66::35) To PAXPR04MB9185.eurprd04.prod.outlook.com (2603:10a6:102:231::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9185:EE_|AS1PR04MB9384:EE_ X-MS-Office365-Filtering-Correlation-Id: eeeb987b-58d9-4f17-a0b9-08dcdcdb21f5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|52116014|7416014|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?+nOXEnTxF8L6tKoMAA77PzBaqFD5s6y?= =?utf-8?q?Y0Sg8BaR1Q4rWj+JbtSu9SIO98Z3Hj4ehJknGPEsmC4wApvi+dtdM6NL362PPGB1m?= =?utf-8?q?4zvSmg6uxt8OGaQhT3XioG6oIc9mVII7hOR+GCm9vXVIl/9aWnXCJlesxoDzh8g2P?= =?utf-8?q?EfxGUYwxkfr6o79yOW1X0wYvLCxivhb8K2x/xUaZ1F0ht4rbXT4qvdAaFd6eQm0aM?= =?utf-8?q?o+oDAcGrlJcHLqTiXgazjywxKBYGZd2twwjBqx4slfct1wUpWbKnlIsBYsNIi5jP8?= =?utf-8?q?VIXlTPMufsigbI6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jXs3BUIWBZ9VSFX3GT30b3eCrX0r57VTHatUMvZworn7TWLfX?= =?utf-8?q?5GsR279EiHXQ9+mWF9ZjXDdiYGjnKAotfEpzjMiWeejsScDK5/McP7DtoHuMUW3Dy?= =?utf-8?q?c1Ub33Pz3XLxf3fMRgqeitpNb0jYKQ1H3cg=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)(366016)(1800799024)(52116014)(7416014)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?tQa3Q/JIedi4JED+Wf1ds8dMP8UZ?= =?utf-8?q?6QVmm0UO6cQFFij+wtT4rZqI3fJuCotDRonnlzk26GqtDr38imZ+SpYFVK1Nkb+Xl?= =?utf-8?q?AmCl4rkCzQRzhq8QoPolk5D+xsGcTLV7Q8xkrLEBqkHMRAifd3VheCN4KQM25Ycd5?= =?utf-8?q?XK5V2RocQ4PK5GENyagyqNA5wgC0R4LMxd6eYu91LodvhRpa4cdptSMJ89lRmdoON?= =?utf-8?q?90thS3bLxMFrX1kNTOjMRbcRL4bzY7ihjNoQ6FQJOYiyKotWra3TJCsyv9/AbYPKn?= =?utf-8?q?kwxIPlrRoQ2Fn64V7lqTju0Rp+aiPG/FWCTC/4K3XqOtjCR0vE27R4mjs3grU5z/1?= =?utf-8?q?BmucT2k0bjOFtKkqGS7oiwMtTf/M/vqy/r2xAD/eEzNIHt/LVdbw7/LPQf6WKsvJz?= =?utf-8?q?RXcrv/+2brt8uY/Kz16ij/lOpIGKiHK62m23sHAs2/2otf/CtKZfZKxbeyIJ23Zhh?= =?utf-8?q?LyYYD9raP9tJKW0adFZP1GFWX7CYNhHoYmj+5p5HJ6yiPuKmLRlm3J2zQP94aS7oO?= =?utf-8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hdHQNqNH8IqFaQtsy0GuGZf5nK+gtNjXyHjruMng7FWzRTpsSvAw86?= =?utf-8?q?yj6CMW9sTSTLGQ1hRQpOvWgBUg/bo+bEaWWVxiXvx3Wx9kQOxEIsfH2gB7yzr4sLi?= =?utf-8?q?4C72dcVoY8tp?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: eeeb987b-58d9-4f17-a0b9-08dcdcdb21f5 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9185.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Sep 2024 20:54:50.6956 (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: H+TJFphoI8TZDJQ9IIEeR7ewjweVYzGHUGL7sQis0W9g8DcnyR0R+DsJqXUARoWO4PvpYQElFu3+c1GDHimU0w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9384 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240924_135505_586509_294800A1 X-CRM114-Status: GOOD ( 16.22 ) 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") Reviewed-by: Andrew Lunn Signed-off-by: Shenwei Wang Reviewed-by: Serge Semin --- Changes in V4: - fixed the comments and R-b. Changes in V3: - re-org the error-check flow per Serge's review. Changes in v2: - replace the udelay with readl_poll_timeout per Simon's review. --- .../net/ethernet/stmicro/stmmac/dwmac4_core.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 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..e65a65666cc1 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; u32 val; if (index >= hw->num_vlan) @@ -487,16 +488,15 @@ 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, 500000); + if (ret) { + netdev_err(dev, "Timeout accessing MAC_VLAN_Tag_Filter\n"); + return -EBUSY; } - netdev_err(dev, "Timeout accessing MAC_VLAN_Tag_Filter\n"); - - return -EBUSY; + return 0; } static int dwmac4_add_hw_vlan_rx_fltr(struct net_device *dev,