summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorYuval Mintz <yuvalmin@broadcom.com>2012-07-01 03:18:50 +0000
committerDavid S. Miller <davem@davemloft.net>2012-07-05 03:06:44 -0700
commit16917b87a23b429226527f393270047069d665e9 (patch)
treed233f41b31e29688fab779e6885ede9b83f4867b /net
parentbf5e53e3717ed28be69d0663c65962d1731e7ee4 (diff)
net-next: Add netif_get_num_default_rss_queues
Most multi-queue networking driver consider the number of online cpus when configuring RSS queues. This patch adds a wrapper to the number of cpus, setting an upper limit on the number of cpus a driver should consider (by default) when allocating resources for his queues. Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com> Signed-off-by: Eilon Greenstein <eilong@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/core/dev.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index ed674e212b7..69f7a1a393d 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1793,6 +1793,17 @@ int netif_set_real_num_rx_queues(struct net_device *dev, unsigned int rxq)
EXPORT_SYMBOL(netif_set_real_num_rx_queues);
#endif
+/* netif_get_num_default_rss_queues - default number of RSS queues
+ *
+ * This routine should set an upper limit on the number of RSS queues
+ * used by default by multiqueue devices.
+ */
+int netif_get_num_default_rss_queues()
+{
+ return min_t(int, DEFAULT_MAX_NUM_RSS_QUEUES, num_online_cpus());
+}
+EXPORT_SYMBOL(netif_get_num_default_rss_queues);
+
static inline void __netif_reschedule(struct Qdisc *q)
{
struct softnet_data *sd;