net: xilinx: axienet: Fix Tx skb circular buffer occupancy check in dmaengine xmit
[ Upstream commit 32374234ab0101881e7d0c6a8ef7ebce566c46c9 ]
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: 6a91b846af ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
f066d85170
commit
3a92988a76
@@ -843,7 +843,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);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -877,7 +877,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");
|
||||
@@ -927,7 +927,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);
|
||||
|
||||
Reference in New Issue
Block a user