netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Hutchings <bhutchings@solarflare.com>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: netdev@vger.kernel.org, linux-net-drivers@solarflare.com
Subject: [PATCH 4/4] sfc: Create one RX queue and interrupt per CPU package by default
Date: Fri, 18 Jul 2008 19:03:10 +0100	[thread overview]
Message-ID: <20080718180309.GI10471@solarflare.com> (raw)
In-Reply-To: <20080718175911.GF10471@solarflare.com>

Using multiple cores in the same package to handle received traffic
does not appear to provide a performance benefit.  Therefore use CPU
topology information to count CPU packages and use that as the default
number of RX queues and interrupts.  We rely on interrupt balancing to
spread the interrupts across packages.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
 drivers/net/sfc/efx.c |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c
index 7b2a818..45c72ee 100644
--- a/drivers/net/sfc/efx.c
+++ b/drivers/net/sfc/efx.c
@@ -19,6 +19,7 @@
 #include <linux/in.h>
 #include <linux/crc32.h>
 #include <linux/ethtool.h>
+#include <linux/topology.h>
 #include "net_driver.h"
 #include "gmii.h"
 #include "ethtool.h"
@@ -832,7 +833,23 @@ static void efx_probe_interrupts(struct efx_nic *efx)
 	if (efx->interrupt_mode == EFX_INT_MODE_MSIX) {
 		BUG_ON(!pci_find_capability(efx->pci_dev, PCI_CAP_ID_MSIX));
 
-		efx->rss_queues = rss_cpus ? rss_cpus : num_online_cpus();
+		if (rss_cpus == 0) {
+			cpumask_t core_mask;
+			int cpu;
+
+			cpus_clear(core_mask);
+			efx->rss_queues = 0;
+			for_each_online_cpu(cpu) {
+				if (!cpu_isset(cpu, core_mask)) {
+					++efx->rss_queues;
+					cpus_or(core_mask, core_mask,
+						topology_core_siblings(cpu));
+				}
+			}
+		} else {
+			efx->rss_queues = rss_cpus;
+		}
+
 		efx->rss_queues = min(efx->rss_queues, max_channel + 1);
 		efx->rss_queues = min(efx->rss_queues, EFX_MAX_CHANNELS);
 

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.

  parent reply	other threads:[~2008-07-18 18:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-18 17:59 [PATCH 1/4] sfc: I2C adapter initialisation fixes Ben Hutchings
2008-07-18 18:01 ` [PATCH 2/4] sfc: Use a separate workqueue for resets Ben Hutchings
2008-07-18 18:01 ` [PATCH 3/4] sfc: resolve tx multiqueue bug Ben Hutchings
2008-07-18 18:49   ` Ben Hutchings
2008-07-22 18:41     ` Ben Hutchings
2008-07-22 21:00       ` David Miller
2008-07-22 21:29         ` Jeff Garzik
2008-07-22 21:33           ` David Miller
2008-07-18 18:03 ` Ben Hutchings [this message]
2008-07-22 23:44 ` [PATCH 1/4] sfc: I2C adapter initialisation fixes Jeff Garzik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080718180309.GI10471@solarflare.com \
    --to=bhutchings@solarflare.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-net-drivers@solarflare.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).