net: xilinx: axienet: Fix Tx skb circular buffer occupancy check in dmaengine xmit
PATCH 1/1 net: xilinx: axienet: Fix Tx skb circular buffer occupancy check in dmaengine xmit
In Dmaengine flow, driver maintains struct skbuf_dma_descriptor rings each element of which corresponds to a skb. In Tx datapath, compare available space in skb ring with number of skbs instead of skb fragments. Replace x * (MAX_SKB_FRAGS) in netif_txq_completed_wake() and netif_txq_maybe_stop() with x * (1 skb) to fix the comparison.
--- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +3 -3
@@ -880,7 +880,7 @@ static void axienet_dma_tx_cb(void *data, const struct dmaengine_result *result)dev_consume_skb_any (skbuf_dma->skb);netif_txq_completed_wake (txq,1 , len,CIRC_SPACE (lp->tx_ring_head, lp->tx_ring_tail,TX_BD_NUM_MAX ), -2 *MAX_SKB_FRAGS ); +2 ); }/**
@@ -914,7 +914,7 @@ axienet_start_xmit_dmaengine(struct sk_buff *skb, struct net_device *ndev) dma_dev = lp->tx_chan->device; sg_len =skb_shinfo (skb)->nr_frags +1 ; -if (CIRC_SPACE (lp->tx_ring_head, lp->tx_ring_tail,TX_BD_NUM_MAX ) <= sg_len) { +if (CIRC_SPACE (lp->tx_ring_head, lp->tx_ring_tail,TX_BD_NUM_MAX ) <=1 ) {netif_stop_queue (ndev);if (net_ratelimit ())netdev_warn (ndev,"TX ring unexpectedly full\n" );
@@ -964,7 +964,7 @@ axienet_start_xmit_dmaengine(struct sk_buff *skb, struct net_device *ndev) txq =skb_get_tx_queue (lp->ndev, skb);netdev_tx_sent_queue (txq, skb->len);netif_txq_maybe_stop (txq,CIRC_SPACE (lp->tx_ring_head, lp->tx_ring_tail,TX_BD_NUM_MAX ), -MAX_SKB_FRAGS +1 ,2 *MAX_SKB_FRAGS ); +1 ,2 );dmaengine_submit (dma_tx_desc);dma_async_issue_pending (lp->tx_chan);
Signature · 1 line
2.25.1
Quoted 35 lines · Suraj Gupta
In Dmaengine flow, driver maintains struct
skbuf_dma_descriptorrings each element of which corresponds to a skb. In Tx datapath, compare available space in skb ring with number of skbs instead of skb fragments. Replace x * (MAX_SKB_FRAGS) innetif_txq_completed_wake()andnetif_txq_maybe_stop()with x * (1 skb) to fix the comparison.Fixes 6a91b846af85 ("net: axienet: Introduce dmaengine support")Signed-off-by Suraj Gupta <[email protected]>--- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/net/ethernet/xilinx/xilinx_axienet_main.c +2
-2@@ -880,7 +880,7 @@ static void axienet_dma_tx_cb(void *data, const struct dmaengine_result *result)dev_consume_skb_any (skbuf_dma->skb);netif_txq_completed_wake (txq,1 , len,CIRC_SPACE (lp->tx_ring_head, lp->tx_ring_tail,TX_BD_NUM_MAX ), -2 *MAX_SKB_FRAGS ); +2 ); }/** @@ -914,7 +914,7 @@ axienet_start_xmit_dmaengine(struct sk_buff *skb, struct net_device *ndev) dma_dev = lp->tx_chan->device; sg_len =skb_shinfo (skb)->nr_frags +1 ; -if (CIRC_SPACE (lp->tx_ring_head, lp->tx_ring_tail,TX_BD_NUM_MAX ) <= sg_len) { +if (CIRC_SPACE (lp->tx_ring_head, lp->tx_ring_tail,TX_BD_NUM_MAX ) <=1 ) {netif_stop_queue (ndev);if (net_ratelimit ())netdev_warn (ndev,"TX ring unexpectedly full\n" );
drivers/net/ethernet/xilinx/xilinx_axienet_main.c axienet_start_xmit_dmaengine(struct sk_buff *skb, struct net_device *ndev) · line 970
Quoted 8 lines
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +1
-1@@ -964,7 +964,7 @@ axienet_start_xmit_dmaengine(struct sk_buff *skb, struct net_device *ndev) txq =skb_get_tx_queue (lp->ndev, skb);netdev_tx_sent_queue (txq, skb->len);netif_txq_maybe_stop (txq,CIRC_SPACE (lp->tx_ring_head, lp->tx_ring_tail,TX_BD_NUM_MAX ), -MAX_SKB_FRAGS +1 ,2 *MAX_SKB_FRAGS ); +1 ,2 );dmaengine_submit (dma_tx_desc);dma_async_issue_pending (lp->tx_chan);
Sean Anderson
Reviewed-byQuoted 42 lines · Sean Anderson
Quoted 41 lines · Suraj Gupta
In Dmaengine flow, driver maintains struct
skbuf_dma_descriptorrings each element of which corresponds to a skb. In Tx datapath, compare available space in skb ring with number of skbs instead of skb fragments. Replace x * (MAX_SKB_FRAGS) innetif_txq_completed_wake()andnetif_txq_maybe_stop()with x * (1 skb) to fix the comparison.Fixes 6a91b846af85 ("net: axienet: Introduce dmaengine support")Signed-off-by Suraj Gupta <[email protected]>--- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/net/ethernet/xilinx/xilinx_axienet_main.c +3
-3@@ -880,7 +880,7 @@ static void axienet_dma_tx_cb(void *data, const struct dmaengine_result *result)dev_consume_skb_any (skbuf_dma->skb);netif_txq_completed_wake (txq,1 , len,CIRC_SPACE (lp->tx_ring_head, lp->tx_ring_tail,TX_BD_NUM_MAX ), -2 *MAX_SKB_FRAGS ); +2 ); }/** @@ -914,7 +914,7 @@ axienet_start_xmit_dmaengine(struct sk_buff *skb, struct net_device *ndev) dma_dev = lp->tx_chan->device; sg_len =skb_shinfo (skb)->nr_frags +1 ; -if (CIRC_SPACE (lp->tx_ring_head, lp->tx_ring_tail,TX_BD_NUM_MAX ) <= sg_len) { +if (CIRC_SPACE (lp->tx_ring_head, lp->tx_ring_tail,TX_BD_NUM_MAX ) <=1 ) {netif_stop_queue (ndev);if (net_ratelimit ())netdev_warn (ndev,"TX ring unexpectedly full\n" );@@ -964,7 +964,7 @@ axienet_start_xmit_dmaengine(struct sk_buff *skb, struct net_device *ndev) txq =skb_get_tx_queue (lp->ndev, skb);netdev_tx_sent_queue (txq, skb->len);netif_txq_maybe_stop (txq,CIRC_SPACE (lp->tx_ring_head, lp->tx_ring_tail,TX_BD_NUM_MAX ), -MAX_SKB_FRAGS +1 ,2 *MAX_SKB_FRAGS ); +1 ,2 );
Quoted 4 lines
drivers/net/ethernet/xilinx/xilinx_axienet_main.c axienet_start_xmit_dmaengine(struct sk_buff *skb, struct net_device *ndev) · line 970
Quoted 2 lines
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +0
-0dmaengine_submit (dma_tx_desc);dma_async_issue_pending (lp->tx_chan);Reviwed-by Sean Anderson <[email protected]>
*spelling
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 10 lines · On Wed, 21 May 2025 23:46:08 +0530 you wrote:
In Dmaengine flow, driver maintains struct
skbuf_dma_descriptorrings each element of which corresponds to a skb. In Tx datapath, compare available space in skb ring with number of skbs instead of skb fragments. Replace x * (MAX_SKB_FRAGS) innetif_txq_completed_wake()andnetif_txq_maybe_stop()with x * (1 skb) to fix the comparison.Fixes 6a91b846af85 ("net: axienet: Introduce dmaengine support")Signed-off-by Suraj Gupta <[email protected]>[...]
Here is the summary with links:
- [net] net: xilinx: axienet: Fix Tx skb circular buffer occupancy check in dmaengine xmit
https://git.kernel.org/netdev/net/c/32374234ab01
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html