Re: [PATCH/RESEND net 5/5][NON-TRIVIAL] drivers/net/ethernet: dev_alloc_skb to netdev_alloc_skb

Eric Dumazet
2012-01-23T21:04:33Z

Le mardi 24 janvier 2012 à 02:24 +0530, Pradeep A. Dalvi a écrit :
> Replaced deprecating dev_alloc_skb with netdev_alloc_skb in drivers/net/ethernet
> - Removed extra skb->dev = dev after netdev_alloc_skb
>

>
> /* Initialize the LANCE Rx and Tx rings. */
> static void
> -lance_init_ring(struct net_device *dev, gfp_t gfp)
> +lance_init_ring(struct net_device *dev)
> {
> struct lance_private *lp = dev->ml_priv;
> int i;
> @@ -871,13 +871,12 @@ lance_init_ring(struct net_device *dev, gfp_t gfp)
> struct sk_buff *skb;
> void *rx_buff;
>
> - skb = alloc_skb(PKT_BUF_SZ, GFP_DMA | gfp);
> + skb = netdev_alloc_skb(dev, PKT_BUF_SZ);
> lp->rx_skbuff[i] = skb;
> - if (skb) {
> - skb->dev = dev;
> + if (skb)
> rx_buff = skb->data;
> - } else
> - rx_buff = kmalloc(PKT_BUF_SZ, GFP_DMA | gfp);
> + else
> + rx_buff = kmalloc(PKT_BUF_SZ, GFP_DMA | GFP_AUTOMIC);
> if (rx_buff == NULL)
> lp->rx_ring[i].base = 0;
> else

Thats really crap, please dont send us such patches, not even compiled.

alloc_skb() has nothing to do with dev_alloc_skb(), and there is a
reason GFP_DMA is used in this driver.