net: Add netif_copy_real_num_queues() for use by virtual net drivers
authorBen Hutchings <bhutchings@solarflare.com>
Mon, 27 Sep 2010 08:24:49 +0000 (08:24 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 28 Sep 2010 05:09:50 +0000 (22:09 -0700)
This sets the active numbers of queues on a net device to match another.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/netdevice.h

index b15732e22eeeede81de1210f853f1a54d54cec15..c2bec990bd17b25c9ecb9fe9b872af4d25f882de 100644 (file)
@@ -1699,6 +1699,18 @@ static inline int netif_set_real_num_rx_queues(struct net_device *dev,
 }
 #endif
 
+static inline int netif_copy_real_num_queues(struct net_device *to_dev,
+                                            const struct net_device *from_dev)
+{
+       netif_set_real_num_tx_queues(to_dev, from_dev->real_num_tx_queues);
+#ifdef CONFIG_RPS
+       return netif_set_real_num_rx_queues(to_dev,
+                                           from_dev->real_num_rx_queues);
+#else
+       return 0;
+#endif
+}
+
 /* Use this variant when it is known for sure that it
  * is executing from hardware interrupt context or with hardware interrupts
  * disabled.