ramips: Don't trigger BUG_ON due to skb allocation failure

Instead just drop the rx'ed frame silently and reuse the already
available buffer.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>

SVN-Revision: 24122
This commit is contained in:
Gabor Juhos 2010-11-24 10:01:12 +00:00
parent c6e4124855
commit f833e399f2

View file

@ -272,6 +272,9 @@ ramips_eth_rx_hw(unsigned long ptr)
break; break;
max_rx--; max_rx--;
new_skb = netdev_alloc_skb(dev, MAX_RX_LENGTH + 2);
/* Reuse the buffer on allocation failures */
if (new_skb) {
rx_skb = priv->rx_skb[rx]; rx_skb = priv->rx_skb[rx];
skb_put(rx_skb, RX_DMA_PLEN0(priv->rx[rx].rxd2)); skb_put(rx_skb, RX_DMA_PLEN0(priv->rx[rx].rxd2));
rx_skb->dev = dev; rx_skb->dev = dev;
@ -281,14 +284,14 @@ ramips_eth_rx_hw(unsigned long ptr)
dev->stats.rx_bytes += rx_skb->len; dev->stats.rx_bytes += rx_skb->len;
netif_rx(rx_skb); netif_rx(rx_skb);
new_skb = netdev_alloc_skb(dev, MAX_RX_LENGTH + 2);
priv->rx_skb[rx] = new_skb; priv->rx_skb[rx] = new_skb;
BUG_ON(!new_skb);
skb_reserve(new_skb, 2); skb_reserve(new_skb, 2);
priv->rx[rx].rxd1 = dma_map_single(NULL, priv->rx[rx].rxd1 = dma_map_single(NULL,
new_skb->data, new_skb->data,
MAX_RX_LENGTH + 2, MAX_RX_LENGTH + 2,
DMA_FROM_DEVICE); DMA_FROM_DEVICE);
}
priv->rx[rx].rxd2 &= ~RX_DMA_DONE; priv->rx[rx].rxd2 &= ~RX_DMA_DONE;
wmb(); wmb();
ramips_fe_wr(rx, RAMIPS_RX_CALC_IDX0); ramips_fe_wr(rx, RAMIPS_RX_CALC_IDX0);