Skip to content

Commit 80acbed

Browse files
aakoskindavem330
authored andcommitted
net: stmmac: don't set own bit too early for jumbo frames
Commit 0e80bdc ("stmmac: first frame prep at the end of xmit routine") overlooked jumbo frames when re-ordering the code, and as a result the own bit was not getting set anymore for the first jumbo frame descriptor. Commit 487e2e2 ("net: stmmac: Set OWN bit for jumbo frames") tried to fix this, but now the bit is getting set too early and the DMA may start while we are still setting up the remaining descriptors. And with the chain mode the own bit remains still unset. Fix by setting the own bit at the end of xmit also with jumbo frames. Fixes: 0e80bdc ("stmmac: first frame prep at the end of xmit routine") Fixes: 487e2e2 ("net: stmmac: Set OWN bit for jumbo frames") Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com> Acked-by: Jose Abreu <joabreu@synopsys.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 9804501 commit 80acbed

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

‎drivers/net/ethernet/stmicro/stmmac/ring_mode.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static int jumbo_frm(void *p, struct sk_buff *skb, int csum)
5959

6060
desc->des3 = cpu_to_le32(des2 + BUF_SIZE_4KiB);
6161
stmmac_prepare_tx_desc(priv, desc, 1, bmax, csum,
62-
STMMAC_RING_MODE, 1, false, skb->len);
62+
STMMAC_RING_MODE, 0, false, skb->len);
6363
tx_q->tx_skbuff[entry] = NULL;
6464
entry = STMMAC_GET_ENTRY(entry, DMA_TX_SIZE);
6565

@@ -91,7 +91,7 @@ static int jumbo_frm(void *p, struct sk_buff *skb, int csum)
9191
tx_q->tx_skbuff_dma[entry].is_jumbo = true;
9292
desc->des3 = cpu_to_le32(des2 + BUF_SIZE_4KiB);
9393
stmmac_prepare_tx_desc(priv, desc, 1, nopaged_len, csum,
94-
STMMAC_RING_MODE, 1, true, skb->len);
94+
STMMAC_RING_MODE, 0, true, skb->len);
9595
}
9696

9797
tx_q->cur_tx = entry;

‎drivers/net/ethernet/stmicro/stmmac/stmmac_main.c‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3216,14 +3216,16 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
32163216
stmmac_prepare_tx_desc(priv, first, 1, nopaged_len,
32173217
csum_insertion, priv->mode, 1, last_segment,
32183218
skb->len);
3219-
3220-
/* The own bit must be the latest setting done when prepare the
3221-
* descriptor and then barrier is needed to make sure that
3222-
* all is coherent before granting the DMA engine.
3223-
*/
3224-
wmb();
3219+
} else {
3220+
stmmac_set_tx_owner(priv, first);
32253221
}
32263222

3223+
/* The own bit must be the latest setting done when prepare the
3224+
* descriptor and then barrier is needed to make sure that
3225+
* all is coherent before granting the DMA engine.
3226+
*/
3227+
wmb();
3228+
32273229
netdev_tx_sent_queue(netdev_get_tx_queue(dev, queue), skb->len);
32283230

32293231
stmmac_enable_dma_transmission(priv, priv->ioaddr);

0 commit comments

Comments
 (0)