aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiklas Cassel <niklas.cassel@axis.com>2018-02-26 16:47:07 -0500
committerDavid S. Miller <davem@davemloft.net>2018-02-27 14:28:10 -0500
commit95eb930a40a0973f9b984d87a4986bb81f897ede (patch)
tree03bf3eaddc93e4baf247ad4938e932d1eff2c888
parent15d2ee42a3087089e73ad52fd8c1b37ab496b87c (diff)
net: stmmac: use correct barrier between coherent memory and MMIO
The last memory barrier in stmmac_xmit()/stmmac_tso_xmit() is placed between a coherent memory write and a MMIO write: The own bit is written in First Desc (TSO: MSS desc or First Desc). <barrier> The DMA engine is started by a write to the tx desc tail pointer/ enable dma transmission register, i.e. a MMIO write. This barrier cannot be a simple dma_wmb(), since a dma_wmb() is only used to guarantee the ordering, with respect to other writes, to cache coherent DMA memory. To guarantee that the cache coherent memory writes have completed before we attempt to write to the cache incoherent MMIO region, we need to use the more heavyweight barrier wmb(). Signed-off-by: Niklas Cassel <niklas.cassel@axis.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 3b5e7b06e796..6dd04f237b2a 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -2997,7 +2997,7 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev)
2997 * descriptor and then barrier is needed to make sure that 2997 * descriptor and then barrier is needed to make sure that
2998 * all is coherent before granting the DMA engine. 2998 * all is coherent before granting the DMA engine.
2999 */ 2999 */
3000 dma_wmb(); 3000 wmb();
3001 3001
3002 if (netif_msg_pktdata(priv)) { 3002 if (netif_msg_pktdata(priv)) {
3003 pr_info("%s: curr=%d dirty=%d f=%d, e=%d, f_p=%p, nfrags %d\n", 3003 pr_info("%s: curr=%d dirty=%d f=%d, e=%d, f_p=%p, nfrags %d\n",
@@ -3221,7 +3221,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
3221 * descriptor and then barrier is needed to make sure that 3221 * descriptor and then barrier is needed to make sure that
3222 * all is coherent before granting the DMA engine. 3222 * all is coherent before granting the DMA engine.
3223 */ 3223 */
3224 dma_wmb(); 3224 wmb();
3225 } 3225 }
3226 3226
3227 netdev_tx_sent_queue(netdev_get_tx_queue(dev, queue), skb->len); 3227 netdev_tx_sent_queue(netdev_get_tx_queue(dev, queue), skb->len);