diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2010-09-27 04:24:33 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-09-28 01:09:49 -0400 |
commit | 62fe0b40abb3484413800edaef9b087a20059acf (patch) | |
tree | 1fbd745de235b3a1d97931412fa9ff3e7228fd88 /include/linux/netdevice.h | |
parent | f91ff5b9ff529be8aac2039af63b2c8ea6cd6ebe (diff) |
net: Allow changing number of RX queues after device allocation
For RPS, we create a kobject for each RX queue based on the number of
queues passed to alloc_netdev_mq(). However, drivers generally do not
determine the numbers of hardware queues to use until much later, so
this usually represents the maximum number the driver may use and not
the actual number in use.
For TX queues, drivers can update the actual number using
netif_set_real_num_tx_queues(). Add a corresponding function for RX
queues, netif_set_real_num_rx_queues().
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/netdevice.h')
-rw-r--r-- | include/linux/netdevice.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 83de0eb7a071..b15732e22eee 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -976,8 +976,11 @@ struct net_device { | |||
976 | 976 | ||
977 | struct netdev_rx_queue *_rx; | 977 | struct netdev_rx_queue *_rx; |
978 | 978 | ||
979 | /* Number of RX queues allocated at alloc_netdev_mq() time */ | 979 | /* Number of RX queues allocated at register_netdev() time */ |
980 | unsigned int num_rx_queues; | 980 | unsigned int num_rx_queues; |
981 | |||
982 | /* Number of RX queues currently active in device */ | ||
983 | unsigned int real_num_rx_queues; | ||
981 | #endif | 984 | #endif |
982 | 985 | ||
983 | rx_handler_func_t *rx_handler; | 986 | rx_handler_func_t *rx_handler; |
@@ -1685,6 +1688,17 @@ static inline int netif_is_multiqueue(const struct net_device *dev) | |||
1685 | extern void netif_set_real_num_tx_queues(struct net_device *dev, | 1688 | extern void netif_set_real_num_tx_queues(struct net_device *dev, |
1686 | unsigned int txq); | 1689 | unsigned int txq); |
1687 | 1690 | ||
1691 | #ifdef CONFIG_RPS | ||
1692 | extern int netif_set_real_num_rx_queues(struct net_device *dev, | ||
1693 | unsigned int rxq); | ||
1694 | #else | ||
1695 | static inline int netif_set_real_num_rx_queues(struct net_device *dev, | ||
1696 | unsigned int rxq) | ||
1697 | { | ||
1698 | return 0; | ||
1699 | } | ||
1700 | #endif | ||
1701 | |||
1688 | /* Use this variant when it is known for sure that it | 1702 | /* Use this variant when it is known for sure that it |
1689 | * is executing from hardware interrupt context or with hardware interrupts | 1703 | * is executing from hardware interrupt context or with hardware interrupts |
1690 | * disabled. | 1704 | * disabled. |