diff mbox series

[net] net: stmmac: dwmac4: extend timeout for VLAN Tag register busy bit check

Message ID 20240917164206.414714-1-shenwei.wang@nxp.com (mailing list archive)
State New, archived
Headers show
Series [net] net: stmmac: dwmac4: extend timeout for VLAN Tag register busy bit check | expand

Commit Message

Shenwei Wang Sept. 17, 2024, 4:42 p.m. UTC
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.

This modification does not impact normal success path, as the function
typically returns within 1µs in non-EEE scenarios. The extended timeout
only affects the failure path.

Fixes: ed64639bc1e0 ("net: stmmac: Add support for VLAN Rx filtering")
Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Simon Horman Sept. 18, 2024, 8:16 a.m. UTC | #1
On Tue, Sep 17, 2024 at 11:42:06AM -0500, Shenwei Wang wrote:
> 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.
> 
> This modification does not impact normal success path, as the function
> typically returns within 1µs in non-EEE scenarios. The extended timeout
> only affects the failure path.
> 
> Fixes: ed64639bc1e0 ("net: stmmac: Add support for VLAN Rx filtering")
> Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com>

Hi Shenwei Wang,

It looks like this function now uses udelay() to busy-wait for up to 500ms.
But 500ms, or indeed 300ms, seems like a long time to tie down a core.  I
wonder if some other sort of mechanism, f.e. involving msleep or delayed
work, should be considered.

...
diff mbox series

Patch

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
index a1858f083eef..cd5e5434ac52 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
@@ -471,7 +471,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 i, timeout = 500000;
 	u32 val;
 
 	if (index >= hw->num_vlan)