]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
net-next: Add netif_get_num_default_rss_queues
authorYuval Mintz <yuvalmin@broadcom.com>
Sun, 1 Jul 2012 03:18:50 +0000 (03:18 +0000)
committerJoe Jin <joe.jin@oracle.com>
Tue, 28 Aug 2012 07:23:13 +0000 (15:23 +0800)
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.

(cherry picked from commit 16917b87a23b429226527f393270047069d665e9)
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>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
include/linux/netdevice.h
net/core/dev.c

index cb3edc1501ede9c30e3a1be9371fe2b5f098dd02..9c1a2b7fcd924b9336094cc8614fd75bcc7a1979 100644 (file)
@@ -2042,6 +2042,9 @@ static inline int netif_copy_real_num_queues(struct net_device *to_dev,
 #endif
 }
 
+#define DEFAULT_MAX_NUM_RSS_QUEUES     (8)
+extern int netif_get_num_default_rss_queues(void);
+
 /* Use this variant when it is known for sure that it
  * is executing from hardware interrupt context or with hardware interrupts
  * disabled.
index 051c9bc22cf71a1926b1589d643cb1f230ed7d3f..bf2256874587fb009fe61faf05fa6212fddc00fb 100644 (file)
@@ -1717,6 +1717,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;