net/macb: memory barriers cleanup
Remove a couple of unneeded barriers and document the remaining ones. Signed-off-by: Havard Skinnemoen <havard@skinnemoen.net> [nicolas.ferre@atmel.com: split patch in topics] Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Tested-by: Joachim Eastwood <manabian@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
140b7552fd
commit
03dbe05fe4
|
@ -373,7 +373,9 @@ static void macb_tx(struct macb *bp)
|
||||||
|
|
||||||
BUG_ON(skb == NULL);
|
BUG_ON(skb == NULL);
|
||||||
|
|
||||||
|
/* Make hw descriptor updates visible to CPU */
|
||||||
rmb();
|
rmb();
|
||||||
|
|
||||||
bufstat = bp->tx_ring[tail].ctrl;
|
bufstat = bp->tx_ring[tail].ctrl;
|
||||||
|
|
||||||
if (!(bufstat & MACB_BIT(TX_USED)))
|
if (!(bufstat & MACB_BIT(TX_USED)))
|
||||||
|
@ -416,7 +418,10 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag,
|
||||||
if (frag == last_frag)
|
if (frag == last_frag)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Make descriptor updates visible to hardware */
|
||||||
wmb();
|
wmb();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,12 +442,14 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag,
|
||||||
frag_len);
|
frag_len);
|
||||||
offset += RX_BUFFER_SIZE;
|
offset += RX_BUFFER_SIZE;
|
||||||
bp->rx_ring[frag].addr &= ~MACB_BIT(RX_USED);
|
bp->rx_ring[frag].addr &= ~MACB_BIT(RX_USED);
|
||||||
wmb();
|
|
||||||
|
|
||||||
if (frag == last_frag)
|
if (frag == last_frag)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Make descriptor updates visible to hardware */
|
||||||
|
wmb();
|
||||||
|
|
||||||
skb->protocol = eth_type_trans(skb, bp->dev);
|
skb->protocol = eth_type_trans(skb, bp->dev);
|
||||||
|
|
||||||
bp->stats.rx_packets++;
|
bp->stats.rx_packets++;
|
||||||
|
@ -462,6 +469,8 @@ static void discard_partial_frame(struct macb *bp, unsigned int begin,
|
||||||
|
|
||||||
for (frag = begin; frag != end; frag = NEXT_RX(frag))
|
for (frag = begin; frag != end; frag = NEXT_RX(frag))
|
||||||
bp->rx_ring[frag].addr &= ~MACB_BIT(RX_USED);
|
bp->rx_ring[frag].addr &= ~MACB_BIT(RX_USED);
|
||||||
|
|
||||||
|
/* Make descriptor updates visible to hardware */
|
||||||
wmb();
|
wmb();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -480,7 +489,9 @@ static int macb_rx(struct macb *bp, int budget)
|
||||||
for (; budget > 0; tail = NEXT_RX(tail)) {
|
for (; budget > 0; tail = NEXT_RX(tail)) {
|
||||||
u32 addr, ctrl;
|
u32 addr, ctrl;
|
||||||
|
|
||||||
|
/* Make hw descriptor updates visible to CPU */
|
||||||
rmb();
|
rmb();
|
||||||
|
|
||||||
addr = bp->rx_ring[tail].addr;
|
addr = bp->rx_ring[tail].addr;
|
||||||
ctrl = bp->rx_ring[tail].ctrl;
|
ctrl = bp->rx_ring[tail].ctrl;
|
||||||
|
|
||||||
|
@ -675,6 +686,8 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||||
|
|
||||||
bp->tx_ring[entry].addr = mapping;
|
bp->tx_ring[entry].addr = mapping;
|
||||||
bp->tx_ring[entry].ctrl = ctrl;
|
bp->tx_ring[entry].ctrl = ctrl;
|
||||||
|
|
||||||
|
/* Make newly initialized descriptor visible to hardware */
|
||||||
wmb();
|
wmb();
|
||||||
|
|
||||||
entry = NEXT_TX(entry);
|
entry = NEXT_TX(entry);
|
||||||
|
@ -783,9 +796,6 @@ static void macb_init_rings(struct macb *bp)
|
||||||
|
|
||||||
static void macb_reset_hw(struct macb *bp)
|
static void macb_reset_hw(struct macb *bp)
|
||||||
{
|
{
|
||||||
/* Make sure we have the write buffer for ourselves */
|
|
||||||
wmb();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Disable RX and TX (XXX: Should we halt the transmission
|
* Disable RX and TX (XXX: Should we halt the transmission
|
||||||
* more gracefully?)
|
* more gracefully?)
|
||||||
|
|
Loading…
Reference in New Issue