Skip to contentSkip to conversation

gianfar: rx buffer management

DISCUSSION Stephen Hemminger 1 participant 1 message Apr 16, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

I was looking at all drivers to update them to use netdev_alloc_skb and noticed this turd in the gianfar.c driver:

struct sk_buff * gfar_new_skb(struct net_device *dev, struct rxbd8 *bdp)

{
	unsigned int alignamount;
	struct gfar_private *priv = netdev_priv(dev);
	struct sk_buff *skb = NULL;
	unsigned int timeout = SKB_ALLOC_TIMEOUT;

	/* We have to allocate the skb, so keep trying till we succeed */
	while ((!skb) && timeout--)
		skb = dev_alloc_skb(priv->rx_buffer_size + RXBUF_ALIGNMENT);

Trying a million times in softirq is not going to work. Please change to use a more sane strategy. Probably the simples would be to allocate a new skb before processing the current buffer and if that fails, just drop the current rx packet and reuse the skb.