aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJose Abreu <Jose.Abreu@synopsys.com>2018-09-17 04:22:57 -0400
committerDavid S. Miller <davem@davemloft.net>2018-09-18 22:48:08 -0400
commit0431100b3d82c509729ece1ab22ada2484e209c1 (patch)
tree9c02d06532e3cae7644f61a93945ee03be085a68
parent8fce3331702316d4bcfeb0771c09ac75d2192bbc (diff)
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 <joabreu@synopsys.com> Fixes: f748be531d70 ("stmmac: support new GMAC4") Cc: David S. Miller <davem@davemloft.net> Cc: Joao Pinto <jpinto@synopsys.com> Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com> Cc: Alexandre Torgue <alexandre.torgue@st.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_main.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index ab9cc0143ff2..75896d6ba6e2 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -2213,8 +2213,7 @@ static int stmmac_init_dma_engine(struct stmmac_priv *priv)
2213 stmmac_init_tx_chan(priv, priv->ioaddr, priv->plat->dma_cfg, 2213 stmmac_init_tx_chan(priv, priv->ioaddr, priv->plat->dma_cfg,
2214 tx_q->dma_tx_phy, chan); 2214 tx_q->dma_tx_phy, chan);
2215 2215
2216 tx_q->tx_tail_addr = tx_q->dma_tx_phy + 2216 tx_q->tx_tail_addr = tx_q->dma_tx_phy;
2217 (DMA_TX_SIZE * sizeof(struct dma_desc));
2218 stmmac_set_tx_tail_ptr(priv, priv->ioaddr, 2217 stmmac_set_tx_tail_ptr(priv, priv->ioaddr,
2219 tx_q->tx_tail_addr, chan); 2218 tx_q->tx_tail_addr, chan);
2220 } 2219 }
@@ -3003,6 +3002,7 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev)
3003 3002
3004 netdev_tx_sent_queue(netdev_get_tx_queue(dev, queue), skb->len); 3003 netdev_tx_sent_queue(netdev_get_tx_queue(dev, queue), skb->len);
3005 3004
3005 tx_q->tx_tail_addr = tx_q->dma_tx_phy + (tx_q->cur_tx * sizeof(*desc));
3006 stmmac_set_tx_tail_ptr(priv, priv->ioaddr, tx_q->tx_tail_addr, queue); 3006 stmmac_set_tx_tail_ptr(priv, priv->ioaddr, tx_q->tx_tail_addr, queue);
3007 3007
3008 return NETDEV_TX_OK; 3008 return NETDEV_TX_OK;
@@ -3210,6 +3210,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
3210 3210
3211 stmmac_enable_dma_transmission(priv, priv->ioaddr); 3211 stmmac_enable_dma_transmission(priv, priv->ioaddr);
3212 3212
3213 tx_q->tx_tail_addr = tx_q->dma_tx_phy + (tx_q->cur_tx * sizeof(*desc));
3213 stmmac_set_tx_tail_ptr(priv, priv->ioaddr, tx_q->tx_tail_addr, queue); 3214 stmmac_set_tx_tail_ptr(priv, priv->ioaddr, tx_q->tx_tail_addr, queue);
3214 3215
3215 return NETDEV_TX_OK; 3216 return NETDEV_TX_OK;