summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/calxeda
diff options
context:
space:
mode:
authorRob Herring <rob.herring@calxeda.com>2013-03-28 15:32:44 +0400
committerDavid S. Miller <davem@davemloft.net>2013-03-29 23:29:35 +0400
commitdc574f1d52d893f516f3786ff7635450bac00eef (patch)
treea2080c00ac85c6d76a5573e6d5b9385bebb3888c /drivers/net/ethernet/calxeda
parenta561cf7edf9863198bfccecfc5cfe26d951ebd20 (diff)
downloadlinux-dc574f1d52d893f516f3786ff7635450bac00eef.tar.xz
net: calxedaxgmac: fix rx ring handling when OOM
If skb allocation for the rx ring fails repeatedly, we can reach a point were the ring is empty. In this condition, the driver is out of sync with the h/w. While this has always been possible, the removal of the skb recycling seems to have made triggering this problem easier. Signed-off-by: Rob Herring <rob.herring@calxeda.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/calxeda')
-rw-r--r--drivers/net/ethernet/calxeda/xgmac.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/ethernet/calxeda/xgmac.c b/drivers/net/ethernet/calxeda/xgmac.c
index a170065b5973..bb1e80bfa78a 100644
--- a/drivers/net/ethernet/calxeda/xgmac.c
+++ b/drivers/net/ethernet/calxeda/xgmac.c
@@ -1141,6 +1141,9 @@ static int xgmac_rx(struct xgmac_priv *priv, int limit)
struct sk_buff *skb;
int frame_len;
+ if (!dma_ring_cnt(priv->rx_head, priv->rx_tail, DMA_RX_RING_SZ))
+ break;
+
entry = priv->rx_tail;
p = priv->dma_rx + entry;
if (desc_get_owner(p))