Skip to content

Commit 3dc6e99

Browse files
LorenzoBianconikuba-moo
authored andcommitted
net: airoha: Update tx cpu dma ring idx at the end of xmit loop
Move the tx cpu dma ring index update out of transmit loop of airoha_dev_xmit routine in order to not start transmitting the packet before it is fully DMA mapped (e.g. fragmented skbs). Fixes: 23020f0 ("net: airoha: Introduce ethernet support for EN7581 SoC") Reported-by: Felix Fietkau <[email protected]> Signed-off-by: Lorenzo Bianconi <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://patch.msgid.link/20241004-airoha-eth-7581-mapping-fix-v1-1-8e4279ab1812@kernel.org Signed-off-by: Jakub Kicinski <[email protected]>
1 parent f50b5d7 commit 3dc6e99

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/net/ethernet/mediatek/airoha_eth.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2471,10 +2471,6 @@ static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb,
24712471
e->dma_addr = addr;
24722472
e->dma_len = len;
24732473

2474-
airoha_qdma_rmw(qdma, REG_TX_CPU_IDX(qid),
2475-
TX_RING_CPU_IDX_MASK,
2476-
FIELD_PREP(TX_RING_CPU_IDX_MASK, index));
2477-
24782474
data = skb_frag_address(frag);
24792475
len = skb_frag_size(frag);
24802476
}
@@ -2483,6 +2479,11 @@ static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb,
24832479
q->queued += i;
24842480

24852481
skb_tx_timestamp(skb);
2482+
if (!netdev_xmit_more())
2483+
airoha_qdma_rmw(qdma, REG_TX_CPU_IDX(qid),
2484+
TX_RING_CPU_IDX_MASK,
2485+
FIELD_PREP(TX_RING_CPU_IDX_MASK, q->head));
2486+
24862487
if (q->ndesc - q->queued < q->free_thr)
24872488
netif_tx_stop_queue(txq);
24882489

0 commit comments

Comments
 (0)