Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 340581
b: refs/heads/master
c: 03dbe05
h: refs/heads/master
i:
  340579: 8b58777
v: v3
  • Loading branch information
Havard Skinnemoen authored and David S. Miller committed Nov 1, 2012
1 parent 20704c4 commit e57e6d4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 140b7552fdff04bbceeb842f0e04f0b4015fe97b
refs/heads/master: 03dbe05fe4f24fdca4aa6db59ee8341880ec8090
18 changes: 14 additions & 4 deletions trunk/drivers/net/ethernet/cadence/macb.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,9 @@ static void macb_tx(struct macb *bp)

BUG_ON(skb == NULL);

/* Make hw descriptor updates visible to CPU */
rmb();

bufstat = bp->tx_ring[tail].ctrl;

if (!(bufstat & MACB_BIT(TX_USED)))
Expand Down Expand Up @@ -416,7 +418,10 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag,
if (frag == last_frag)
break;
}

/* Make descriptor updates visible to hardware */
wmb();

return 1;
}

Expand All @@ -437,12 +442,14 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag,
frag_len);
offset += RX_BUFFER_SIZE;
bp->rx_ring[frag].addr &= ~MACB_BIT(RX_USED);
wmb();

if (frag == last_frag)
break;
}

/* Make descriptor updates visible to hardware */
wmb();

skb->protocol = eth_type_trans(skb, bp->dev);

bp->stats.rx_packets++;
Expand All @@ -462,6 +469,8 @@ static void discard_partial_frame(struct macb *bp, unsigned int begin,

for (frag = begin; frag != end; frag = NEXT_RX(frag))
bp->rx_ring[frag].addr &= ~MACB_BIT(RX_USED);

/* Make descriptor updates visible to hardware */
wmb();

/*
Expand All @@ -480,7 +489,9 @@ static int macb_rx(struct macb *bp, int budget)
for (; budget > 0; tail = NEXT_RX(tail)) {
u32 addr, ctrl;

/* Make hw descriptor updates visible to CPU */
rmb();

addr = bp->rx_ring[tail].addr;
ctrl = bp->rx_ring[tail].ctrl;

Expand Down Expand Up @@ -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].ctrl = ctrl;

/* Make newly initialized descriptor visible to hardware */
wmb();

entry = NEXT_TX(entry);
Expand Down Expand Up @@ -783,9 +796,6 @@ static void macb_init_rings(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
* more gracefully?)
Expand Down

0 comments on commit e57e6d4

Please sign in to comment.