Skip to content

Commit 0431100

Browse files
joabreudavem330
authored andcommitted
net: stmmac: Fixup the tail addr setting in xmit path
Currently we are always setting the tail address of descriptor list to the end of the pre-allocated list. According to databook this is not correct. Tail address should point to the last available descriptor + 1, which means we have to update the tail address everytime we call the xmit function. This should make no impact in older versions of MAC but in newer versions there are some DMA features which allows the IP to fetch descriptors in advance and in a non sequential order so its critical that we set the tail address correctly. Signed-off-by: Jose Abreu <[email protected]> Fixes: f748be5 ("stmmac: support new GMAC4") Cc: David S. Miller <[email protected]> Cc: Joao Pinto <[email protected]> Cc: Giuseppe Cavallaro <[email protected]> Cc: Alexandre Torgue <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8fce333 commit 0431100

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2213,8 +2213,7 @@ static int stmmac_init_dma_engine(struct stmmac_priv *priv)
22132213
stmmac_init_tx_chan(priv, priv->ioaddr, priv->plat->dma_cfg,
22142214
tx_q->dma_tx_phy, chan);
22152215

2216-
tx_q->tx_tail_addr = tx_q->dma_tx_phy +
2217-
(DMA_TX_SIZE * sizeof(struct dma_desc));
2216+
tx_q->tx_tail_addr = tx_q->dma_tx_phy;
22182217
stmmac_set_tx_tail_ptr(priv, priv->ioaddr,
22192218
tx_q->tx_tail_addr, chan);
22202219
}
@@ -3003,6 +3002,7 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev)
30033002

30043003
netdev_tx_sent_queue(netdev_get_tx_queue(dev, queue), skb->len);
30053004

3005+
tx_q->tx_tail_addr = tx_q->dma_tx_phy + (tx_q->cur_tx * sizeof(*desc));
30063006
stmmac_set_tx_tail_ptr(priv, priv->ioaddr, tx_q->tx_tail_addr, queue);
30073007

30083008
return NETDEV_TX_OK;
@@ -3210,6 +3210,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
32103210

32113211
stmmac_enable_dma_transmission(priv, priv->ioaddr);
32123212

3213+
tx_q->tx_tail_addr = tx_q->dma_tx_phy + (tx_q->cur_tx * sizeof(*desc));
32133214
stmmac_set_tx_tail_ptr(priv, priv->ioaddr, tx_q->tx_tail_addr, queue);
32143215

32153216
return NETDEV_TX_OK;

0 commit comments

Comments
 (0)