Skip to content

Commit 59431eb

Browse files
Suraj Guptagregkh
authored andcommitted
net: xilinx: axienet: Fix RX skb ring management in DMAengine mode
[ Upstream commit fd980bf ] Submit multiple descriptors in axienet_rx_cb() to fill Rx skb ring. This ensures the ring "catches up" on previously missed allocations. Increment Rx skb ring head pointer after BD is successfully allocated. Previously, head pointer was incremented before verifying if descriptor is successfully allocated and has valid entries, which could lead to ring state inconsistency if descriptor setup failed. These changes improve reliability by maintaining adequate descriptor availability and ensuring proper ring buffer state management. Fixes: 6a91b84 ("net: axienet: Introduce dmaengine support") Signed-off-by: Suraj Gupta <suraj.gupta2@amd.com> Link: https://patch.msgid.link/20250813135559.1555652-1-suraj.gupta2@amd.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent fee3453 commit 59431eb

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/net/ethernet/xilinx/xilinx_axienet_main.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,6 +1160,7 @@ static void axienet_dma_rx_cb(void *data, const struct dmaengine_result *result)
11601160
struct axienet_local *lp = data;
11611161
struct sk_buff *skb;
11621162
u32 *app_metadata;
1163+
int i;
11631164

11641165
skbuf_dma = axienet_get_rx_desc(lp, lp->rx_ring_tail++);
11651166
skb = skbuf_dma->skb;
@@ -1178,7 +1179,10 @@ static void axienet_dma_rx_cb(void *data, const struct dmaengine_result *result)
11781179
u64_stats_add(&lp->rx_packets, 1);
11791180
u64_stats_add(&lp->rx_bytes, rx_len);
11801181
u64_stats_update_end(&lp->rx_stat_sync);
1181-
axienet_rx_submit_desc(lp->ndev);
1182+
1183+
for (i = 0; i < CIRC_SPACE(lp->rx_ring_head, lp->rx_ring_tail,
1184+
RX_BUF_NUM_DEFAULT); i++)
1185+
axienet_rx_submit_desc(lp->ndev);
11821186
dma_async_issue_pending(lp->rx_chan);
11831187
}
11841188

@@ -1457,7 +1461,6 @@ static void axienet_rx_submit_desc(struct net_device *ndev)
14571461
if (!skbuf_dma)
14581462
return;
14591463

1460-
lp->rx_ring_head++;
14611464
skb = netdev_alloc_skb(ndev, lp->max_frm_size);
14621465
if (!skb)
14631466
return;
@@ -1482,6 +1485,7 @@ static void axienet_rx_submit_desc(struct net_device *ndev)
14821485
skbuf_dma->desc = dma_rx_desc;
14831486
dma_rx_desc->callback_param = lp;
14841487
dma_rx_desc->callback_result = axienet_dma_rx_cb;
1488+
lp->rx_ring_head++;
14851489
dmaengine_submit(dma_rx_desc);
14861490

14871491
return;

0 commit comments

Comments
 (0)