net: fec: ERR007885 Workaround for XDP TX path
Wei Fang
maintainerPATCH 1/1 net: fec: ERR007885 Workaround for XDP TX path
The ERR007885 will lead to a TDAR race condition for mutliQ when the driver sets TDAR and the UDMA clears TDAR simultaneously or in a small window (2-4 cycles). And it will cause the udma_tx and udma_tx_arbiter state machines to hang. Therefore, the commit 53bb20d1faba ("net: fec:
add variable reg_desc_active to speed things up") and the commit a179aad12bad ("net: fec: ERR007885 Workaround for conventional TX") have added the workaround to fix the potential issue for the conventional TX path. Similarly, the XDP TX path should also have the potential hang issue, so add the workaround for XDP TX path.
--- drivers/net/ethernet/freescale/fec_main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/ethernet/freescale/fec_main.c +6 -1
@@ -3948,7 +3948,12 @@ static int fec_enet_txq_xmit_frame(struct fec_enet_private *fep, txq->bd.cur = bdp;/* Trigger transmission start */ -writel (0 , txq->bd.reg_desc_active); +if (!(fep->quirks &FEC_QUIRK_ERR007885 ) || + !readl (txq->bd.reg_desc_active) || + !readl (txq->bd.reg_desc_active) || + !readl (txq->bd.reg_desc_active) || + !readl (txq->bd.reg_desc_active)) +writel (0 , txq->bd.reg_desc_active);return 0 ; }
Signature · 1 line
2.34.1
Paolo Abeni
maintainerQuoted 24 lines · Wei Fang
The ERR007885 will lead to a TDAR race condition for mutliQ when the driver sets TDAR and the UDMA clears TDAR simultaneously or in a small window (2-4 cycles). And it will cause the
udma_txandudma_tx_arbiterstate machines to hang. Therefore, the commit53bb20d1faba("net: fec:
add variablereg_desc_activeto speed things up") and the commita179aad12bad("net: fec: ERR007885 Workaround for conventional TX") have added the workaround to fix the potential issue for the conventional TX path. Similarly, the XDP TX path should also have the potential hang issue, so add the workaround for XDP TX path.Fixes 6d6b39f180b8 ("net: fec: add initial XDP support")Signed-off-by Wei Fang <[email protected]>--- drivers/net/ethernet/freescale/fec_main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/net/ethernet/freescale/fec_main.c +0
-0@@ -3948,7 +3948,12 @@ static int fec_enet_txq_xmit_frame(struct fec_enet_private *fep, txq->bd.cur = bdp;/* Trigger transmission start */
drivers/net/ethernet/freescale/fec_main.c static int fec_enet_txq_xmit_frame(struct fec_enet_private *fep, · line 3959
Quoted 10 lines
drivers/net/ethernet/freescale/fec_main.c +6
-1-writel (0 , txq->bd.reg_desc_active); +if (!(fep->quirks &FEC_QUIRK_ERR007885 ) || + !readl (txq->bd.reg_desc_active) || + !readl (txq->bd.reg_desc_active) || + !readl (txq->bd.reg_desc_active) || + !readl (txq->bd.reg_desc_active)) +writel (0 , txq->bd.reg_desc_active);return 0 ; }
LGTM!
Side note for a net-next follow-up: please consider moving this logic in a reusable helper, since you already have a few potentials call sites.
/P
Wei Fang
maintainerQuoted 35 lines · Wei Fang
Quoted 10 lines
The ERR007885 will lead to a TDAR race condition for mutliQ when the driver sets TDAR and the UDMA clears TDAR simultaneously or in a small window (2-4 cycles). And it will cause the
udma_txandudma_tx_arbiterstate machines to hang. Therefore, the commit53bb20d1faba("net: fec:
add variablereg_desc_activeto speed things up") and the commita179aad12bad("net: fec: ERR007885 Workaround for conventional TX") have added the workaround to fix the potential issue for the conventional TX path. Similarly, the XDP TX path should also have the potential hang issue, so add the workaround for XDP TX path.Review
Quoted 7 lines
Fixes 6d6b39f180b8 ("net: fec: add initial XDP support")Signed-off-by Wei Fang <[email protected]>--- drivers/net/ethernet/freescale/fec_main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/net/ethernet/freescale/fec_main.cdrivers/net/ethernet/freescale/fec_main.c static int fec_enet_txq_xmit_frame(struct
Quoted 4 lines
index
3222359ac15b..e2b75d1970ae100644drivers/net/ethernet/freescale/fec_main.c +0
-0@@ -3948,7 +3948,12 @@ static int fec_enet_txq_xmit_frame(struct
fec_enet_private*fep,Quoted 11 lines
drivers/net/ethernet/freescale/fec_main.c +6
-1txq->bd.cur = bdp;/* Trigger transmission start */ -writel (0 , txq->bd.reg_desc_active); +if (!(fep->quirks &FEC_QUIRK_ERR007885 ) || + !readl (txq->bd.reg_desc_active) || + !readl (txq->bd.reg_desc_active) || + !readl (txq->bd.reg_desc_active) || + !readl (txq->bd.reg_desc_active)) +writel (0 , txq->bd.reg_desc_active);
Quoted 8 lines
drivers/net/ethernet/freescale/fec_main.c static int fec_enet_txq_xmit_frame(struct fec_enet_private *fep, · line 3959
Quoted 2 lines
drivers/net/ethernet/freescale/fec_main.c +0
-0return 0 ; }LGTM!
Side note for a net-next follow-up: please consider moving this logic in a reusable helper, since you already have a few potentials call sites.
Yes, I have already planned to add a helper after this patch is merged into net-next tree. :)
Quoted 1 line
/P
This patch was applied to netdev/net.git (main) by Paolo Abeni <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Paolo Abeni <[email protected]>:
Quoted 11 lines · On Fri, 28 Nov 2025 10:59:15 +0800 you wrote:
The ERR007885 will lead to a TDAR race condition for mutliQ when the driver sets TDAR and the UDMA clears TDAR simultaneously or in a small window (2-4 cycles). And it will cause the
udma_txandudma_tx_arbiterstate machines to hang. Therefore, the commit53bb20d1faba("net: fec:
add variablereg_desc_activeto speed things up") and the commita179aad12bad("net: fec: ERR007885 Workaround for conventional TX") have added the workaround to fix the potential issue for the conventional TX path. Similarly, the XDP TX path should also have the potential hang issue, so add the workaround for XDP TX path.[...]
Here is the summary with links:
- [net] net: fec: ERR007885 Workaround for XDP TX path
https://git.kernel.org/netdev/net/c/e8e032cd24dd
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html