Subject: Re: [PATCH v2] net: Introduce realloc_netdev_mq()

From: Jarek Poplawski <[email-masked]>
Date: Thu, 3 Dec 2009 17:36:40 +0100

On Thu, Dec 03, 2009 at 04:17:43PM +0100, Eric Dumazet wrote:
> Jarek Poplawski a écrit :
> > Take 2 (with forgotten headers, sorry).
> 
> Very nice, thanks !
> 
> > Here is a proposal of netdev api change. I hope Michael finds time
> > to try if this can be really useful for drivers.
> > 
> > Thanks,
> > Jarek P.
> > ---------------> (take 2)
> > 
> > This patch separates allocation of TX subqueues from alloc_netdev_mq()
> > to realloc_netdev_mq() to allow for resizing like in this example:
> > 
> > some_nic_probe()
> > {
> > 	...
> > 	dev = alloc_etherdev_mq(sizeof(*bp), 1)
> > 	...
> > 	if (MSI-X_available && device_supports_MSI-X_and_multiqueue)
> > 		realloc_netdev_mq(dev, TX_MAX_RINGS)
> > 	register_netdev(dev)
> > 	...
> > }
> > 
> 
> Or the reverse :
> 
> ie, the device first allocate its max possible tx rings
> 
> dev = alloc_etherdev_mq(sizeof(*bp), 128)
> 
> then, later, try to reduce it, when knowing exact tx count.

Right, especially when we know it's a common config/capability for
a NIC.

> 
> if (realloc_netdev_mq(dev, real_queues))
> 	dev->real_num_tx_queues = real_queues;
> 
> In this case the memory error is not fatal.

Good point! We can consider doing this inside the function too?

Thanks,
Jarek P.