Subject: Re: [PATCH 3/3] NET: [CORE] Stack changes to add multiqueue hardware support API

From: Patrick McHardy <[email-masked]>
Date: Mon, 18 Jun 2007 21:10:09 +0200

PJ Waskiewicz wrote:
> Add the multiqueue hardware device support API to the core network
> stack.  Allow drivers to allocate multiple queues and manage them
> at the netdev level if they choose to do so.
>   

Should be 2/3 and qdisc changes should be 3/3. Well actually the qdisc 
sch_generic changes
belong in this patch as well and the qdisc changes should be split in 
one change per qdisc.

>  /* Functions used for multicast support */
> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> index e7367c7..8bcd870 100644
> --- a/include/linux/skbuff.h
> +++ b/include/linux/skbuff.h
> @@ -215,6 +215,7 @@ typedef unsigned char *sk_buff_data_t;
>   *	@pkt_type: Packet class
>   *	@fclone: skbuff clone status
>   *	@ip_summed: Driver fed us an IP checksum
> + *	@queue_mapping: Queue mapping for multiqueue devices
>   *	@priority: Packet queueing priority
>   *	@users: User count - see {datagram,tcp}.c
>   *	@protocol: Packet protocol from driver
> @@ -269,6 +270,7 @@ struct sk_buff {
>  			__u16	csum_offset;
>  		};
>  	};
> +	__u16			queue_mapping;
>   

We have a 4 byte hole on 64 bit after iif where this would fit in.

> @@ -3377,12 +3381,23 @@ struct net_device *alloc_netdev(int sizeof_priv, const char *name,
>  	if (sizeof_priv)
>  		dev->priv = netdev_priv(dev);
>  
> +  	alloc_size = (sizeof(struct net_device_subqueue) * queue_count);
> +  
> +  	p = kzalloc(alloc_size, GFP_KERNEL);
> +  	if (!p) {
> +  		printk(KERN_ERR "alloc_netdev: Unable to allocate queues.\n");
> +  		return NULL;
>   

Same leak here that you already fixed a couple of posts ago.

> +  	}
> +  
> +  	dev->egress_subqueue = p;
> +  	dev->egress_subqueue_count = queue_count;
> +
>  	dev->get_stats = internal_stats;
>  	setup(dev);
>  	strcpy(dev->name, name);
>  	return dev;
>  }
> -EXPORT_SYMBOL(alloc_netdev);
> +EXPORT_SYMBOL(alloc_netdev_mq);
>  
>  /**
>   *	free_netdev - free network device
> @@ -3396,6 +3411,7 @@ void free_netdev(struct net_device *dev)
>  {
>  #ifdef CONFIG_SYSFS
>  	/*  Compatibility with error handling in drivers */
> +	kfree((char *)dev->egress_subqueue);
>   
And the pointless cast as well.

>  	if (dev->reg_state == NETREG_UNINITIALIZED) {
>  		kfree((char *)dev - dev->padded);
>  		return;
> @@ -3407,6 +3423,7 @@ void free_netdev(struct net_device *dev)
>  	/* will free via device release */
>  	put_device(&dev->dev);
>  #else
> +	kfree((char *)dev->egress_subqueue);
>   

And here.