]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: xilinx: axienet: Fix Tx skb circular buffer occupancy check in dmaengine xmit
authorSuraj Gupta <suraj.gupta2@amd.com>
Wed, 21 May 2025 18:16:08 +0000 (23:46 +0530)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 27 May 2025 06:18:51 +0000 (08:18 +0200)
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.

Fixes: 6a91b846af85 ("net: axienet: Introduce dmaengine support")
Signed-off-by: Suraj Gupta <suraj.gupta2@amd.com>
Reviewed-by: Sean Anderson <sean.anderson@linux.dev>
Link: https://patch.msgid.link/20250521181608.669554-1-suraj.gupta2@amd.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/xilinx/xilinx_axienet_main.c

index 054abf283ab33e91d64673c05cb552b57d3360d7..5f912b27bfd7fc506f2a41c3740af428935a2325 100644 (file)
@@ -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);