Patchwork [5/5] net: calxedaxgmac: fix rx ring handling when OOM

mail settings
Submitter Paolo Pisati
Date March 27, 2013, 6:07 p.m.
Message ID <>
Download mbox | patch
Permalink /patch/231780/
State New
Headers show


Paolo Pisati - March 27, 2013, 6:07 p.m.
From: Rob Herring <>

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 <>
Signed-off-by: Paolo Pisati <>
 drivers/net/ethernet/calxeda/xgmac.c |    3 +++
 1 file changed, 3 insertions(+)


diff --git a/drivers/net/ethernet/calxeda/xgmac.c b/drivers/net/ethernet/calxeda/xgmac.c
index f7f0290..a112305 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))