Commit ceb8f6be authored by Lendacky, Thomas's avatar Lendacky, Thomas Committed by David S. Miller

amd-xgbe: Use the new DMA memory barriers where appropriate

Use the new lighter weight memory barriers when working with the device
descriptors.
Signed-off-by: default avatarTom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 600c8811
...@@ -1068,7 +1068,7 @@ static void xgbe_tx_desc_reset(struct xgbe_ring_data *rdata) ...@@ -1068,7 +1068,7 @@ static void xgbe_tx_desc_reset(struct xgbe_ring_data *rdata)
rdesc->desc3 = 0; rdesc->desc3 = 0;
/* Make sure ownership is written to the descriptor */ /* Make sure ownership is written to the descriptor */
wmb(); dma_wmb();
} }
static void xgbe_tx_desc_init(struct xgbe_channel *channel) static void xgbe_tx_desc_init(struct xgbe_channel *channel)
...@@ -1124,12 +1124,12 @@ static void xgbe_rx_desc_reset(struct xgbe_ring_data *rdata) ...@@ -1124,12 +1124,12 @@ static void xgbe_rx_desc_reset(struct xgbe_ring_data *rdata)
* is written to the descriptor(s) before setting the OWN bit * is written to the descriptor(s) before setting the OWN bit
* for the descriptor * for the descriptor
*/ */
wmb(); dma_wmb();
XGMAC_SET_BITS_LE(rdesc->desc3, RX_NORMAL_DESC3, OWN, 1); XGMAC_SET_BITS_LE(rdesc->desc3, RX_NORMAL_DESC3, OWN, 1);
/* Make sure ownership is written to the descriptor */ /* Make sure ownership is written to the descriptor */
wmb(); dma_wmb();
} }
static void xgbe_rx_desc_init(struct xgbe_channel *channel) static void xgbe_rx_desc_init(struct xgbe_channel *channel)
...@@ -1358,6 +1358,9 @@ static void xgbe_tx_start_xmit(struct xgbe_channel *channel, ...@@ -1358,6 +1358,9 @@ static void xgbe_tx_start_xmit(struct xgbe_channel *channel,
struct xgbe_prv_data *pdata = channel->pdata; struct xgbe_prv_data *pdata = channel->pdata;
struct xgbe_ring_data *rdata; struct xgbe_ring_data *rdata;
/* Make sure everything is written before the register write */
wmb();
/* Issue a poll command to Tx DMA by writing address /* Issue a poll command to Tx DMA by writing address
* of next immediate free descriptor */ * of next immediate free descriptor */
rdata = XGBE_GET_DESC_DATA(ring, ring->cur); rdata = XGBE_GET_DESC_DATA(ring, ring->cur);
...@@ -1565,7 +1568,7 @@ static void xgbe_dev_xmit(struct xgbe_channel *channel) ...@@ -1565,7 +1568,7 @@ static void xgbe_dev_xmit(struct xgbe_channel *channel)
* is written to the descriptor(s) before setting the OWN bit * is written to the descriptor(s) before setting the OWN bit
* for the first descriptor * for the first descriptor
*/ */
wmb(); dma_wmb();
/* Set OWN bit for the first descriptor */ /* Set OWN bit for the first descriptor */
rdata = XGBE_GET_DESC_DATA(ring, start_index); rdata = XGBE_GET_DESC_DATA(ring, start_index);
...@@ -1577,7 +1580,7 @@ static void xgbe_dev_xmit(struct xgbe_channel *channel) ...@@ -1577,7 +1580,7 @@ static void xgbe_dev_xmit(struct xgbe_channel *channel)
#endif #endif
/* Make sure ownership is written to the descriptor */ /* Make sure ownership is written to the descriptor */
wmb(); dma_wmb();
ring->cur = cur_index + 1; ring->cur = cur_index + 1;
if (!packet->skb->xmit_more || if (!packet->skb->xmit_more ||
...@@ -1613,7 +1616,7 @@ static int xgbe_dev_read(struct xgbe_channel *channel) ...@@ -1613,7 +1616,7 @@ static int xgbe_dev_read(struct xgbe_channel *channel)
return 1; return 1;
/* Make sure descriptor fields are read after reading the OWN bit */ /* Make sure descriptor fields are read after reading the OWN bit */
rmb(); dma_rmb();
#ifdef XGMAC_ENABLE_RX_DESC_DUMP #ifdef XGMAC_ENABLE_RX_DESC_DUMP
xgbe_dump_rx_desc(ring, rdesc, ring->cur); xgbe_dump_rx_desc(ring, rdesc, ring->cur);
......
...@@ -1800,6 +1800,9 @@ static void xgbe_rx_refresh(struct xgbe_channel *channel) ...@@ -1800,6 +1800,9 @@ static void xgbe_rx_refresh(struct xgbe_channel *channel)
ring->dirty++; ring->dirty++;
} }
/* Make sure everything is written before the register write */
wmb();
/* Update the Rx Tail Pointer Register with address of /* Update the Rx Tail Pointer Register with address of
* the last cleaned entry */ * the last cleaned entry */
rdata = XGBE_GET_DESC_DATA(ring, ring->dirty - 1); rdata = XGBE_GET_DESC_DATA(ring, ring->dirty - 1);
...@@ -1863,7 +1866,7 @@ static int xgbe_tx_poll(struct xgbe_channel *channel) ...@@ -1863,7 +1866,7 @@ static int xgbe_tx_poll(struct xgbe_channel *channel)
/* Make sure descriptor fields are read after reading the OWN /* Make sure descriptor fields are read after reading the OWN
* bit */ * bit */
rmb(); dma_rmb();
#ifdef XGMAC_ENABLE_TX_DESC_DUMP #ifdef XGMAC_ENABLE_TX_DESC_DUMP
xgbe_dump_tx_desc(ring, ring->dirty, 1, 0); xgbe_dump_tx_desc(ring, ring->dirty, 1, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment