From: Ben Hutchings <bhutchings@solarflare.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, linux-net-drivers@solarflare.com
Subject: [PATCH 10/33] sfc: Add option to use a separate channel for TX completions
Date: Fri, 12 Dec 2008 12:52:16 +0000 [thread overview]
Message-ID: <20081212125216.GJ10372@solarflare.com> (raw)
In-Reply-To: <cover.1229085672.git.bhutchings@solarflare.com>
From: Neil Turton <nturton@solarflare.com>
In a bidirectional forwarding test, we find that the best performance
is achieved by sending the TX completion interrupts from one NIC to a
CPU which shares an L2 cache with RX completion interrupts from the
other NIC. To facilitate this, add an option (through a module
parameter) to create separate channels for RX and TX completion with
separate IRQs when MSI-X is available.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
drivers/net/sfc/efx.c | 41 ++++++++++++++++++++++++++---------------
drivers/net/sfc/net_driver.h | 2 ++
2 files changed, 28 insertions(+), 15 deletions(-)
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c
index 15ae2fc..58cbbd5 100644
--- a/drivers/net/sfc/efx.c
+++ b/drivers/net/sfc/efx.c
@@ -64,13 +64,15 @@ MODULE_PARM_DESC(lro, "Large receive offload acceleration");
/*
* Use separate channels for TX and RX events
*
- * Set this to 1 to use separate channels for TX and RX. It allows us to
- * apply a higher level of interrupt moderation to TX events.
+ * Set this to 1 to use separate channels for TX and RX. It allows us
+ * to control interrupt affinity separately for TX and RX.
*
- * This is forced to 0 for MSI interrupt mode as the interrupt vector
- * is not written
+ * This is only used in MSI-X interrupt mode
*/
-static unsigned int separate_tx_and_rx_channels = true;
+static unsigned int separate_tx_channels;
+module_param(separate_tx_channels, uint, 0644);
+MODULE_PARM_DESC(separate_tx_channels,
+ "Use separate channels for TX and RX");
/* This is the weight assigned to each of the (per-channel) virtual
* NAPI devices.
@@ -846,26 +848,33 @@ static void efx_probe_interrupts(struct efx_nic *efx)
if (efx->interrupt_mode == EFX_INT_MODE_MSIX) {
struct msix_entry xentries[EFX_MAX_CHANNELS];
int wanted_ints;
+ int rx_queues;
/* We want one RX queue and interrupt per CPU package
* (or as specified by the rss_cpus module parameter).
* We will need one channel per interrupt.
*/
- wanted_ints = rss_cpus ? rss_cpus : efx_wanted_rx_queues();
- efx->n_rx_queues = min(wanted_ints, max_channels);
+ rx_queues = rss_cpus ? rss_cpus : efx_wanted_rx_queues();
+ wanted_ints = rx_queues + (separate_tx_channels ? 1 : 0);
+ wanted_ints = min(wanted_ints, max_channels);
- for (i = 0; i < efx->n_rx_queues; i++)
+ for (i = 0; i < wanted_ints; i++)
xentries[i].entry = i;
- rc = pci_enable_msix(efx->pci_dev, xentries, efx->n_rx_queues);
+ rc = pci_enable_msix(efx->pci_dev, xentries, wanted_ints);
if (rc > 0) {
- EFX_BUG_ON_PARANOID(rc >= efx->n_rx_queues);
- efx->n_rx_queues = rc;
+ EFX_ERR(efx, "WARNING: Insufficient MSI-X vectors"
+ " available (%d < %d).\n", wanted_ints, rc);
+ EFX_ERR(efx, "WARNING: Performance may be reduced.\n");
+ EFX_BUG_ON_PARANOID(rc >= wanted_ints);
+ wanted_ints = rc;
rc = pci_enable_msix(efx->pci_dev, xentries,
- efx->n_rx_queues);
+ wanted_ints);
}
if (rc == 0) {
- for (i = 0; i < efx->n_rx_queues; i++)
+ efx->n_rx_queues = min(rx_queues, wanted_ints);
+ efx->n_channels = wanted_ints;
+ for (i = 0; i < wanted_ints; i++)
efx->channel[i].irq = xentries[i].vector;
} else {
/* Fall back to single channel MSI */
@@ -877,6 +886,7 @@ static void efx_probe_interrupts(struct efx_nic *efx)
/* Try single interrupt MSI */
if (efx->interrupt_mode == EFX_INT_MODE_MSI) {
efx->n_rx_queues = 1;
+ efx->n_channels = 1;
rc = pci_enable_msi(efx->pci_dev);
if (rc == 0) {
efx->channel[0].irq = efx->pci_dev->irq;
@@ -889,6 +899,7 @@ static void efx_probe_interrupts(struct efx_nic *efx)
/* Assume legacy interrupts */
if (efx->interrupt_mode == EFX_INT_MODE_LEGACY) {
efx->n_rx_queues = 1;
+ efx->n_channels = 1 + (separate_tx_channels ? 1 : 0);
efx->legacy_irq = efx->pci_dev->irq;
}
}
@@ -913,8 +924,8 @@ static void efx_set_channels(struct efx_nic *efx)
struct efx_rx_queue *rx_queue;
efx_for_each_tx_queue(tx_queue, efx) {
- if (!EFX_INT_MODE_USE_MSI(efx) && separate_tx_and_rx_channels)
- tx_queue->channel = &efx->channel[1];
+ if (separate_tx_channels)
+ tx_queue->channel = &efx->channel[efx->n_channels-1];
else
tx_queue->channel = &efx->channel[0];
tx_queue->channel->used_flags |= EFX_USED_BY_TX;
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h
index f910609..2c5b5fa 100644
--- a/drivers/net/sfc/net_driver.h
+++ b/drivers/net/sfc/net_driver.h
@@ -649,6 +649,7 @@ union efx_multicast_hash {
* @rx_queue: RX DMA queues
* @channel: Channels
* @n_rx_queues: Number of RX queues
+ * @n_channels: Number of channels in use
* @rx_buffer_len: RX buffer length
* @rx_buffer_order: Order (log2) of number of pages for each RX buffer
* @irq_status: Interrupt status buffer
@@ -728,6 +729,7 @@ struct efx_nic {
struct efx_channel channel[EFX_MAX_CHANNELS];
int n_rx_queues;
+ int n_channels;
unsigned int rx_buffer_len;
unsigned int rx_buffer_order;
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
next prev parent reply other threads:[~2008-12-12 12:52 UTC|newest]
Thread overview: 74+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1229085672.git.bhutchings@solarflare.com>
2008-12-12 12:46 ` [PATCH 00/33] sfc version 2.3 Ben Hutchings
2008-12-12 12:48 ` [PATCH 01/33] sfc: Board support fixes Ben Hutchings
2008-12-13 5:29 ` David Miller
2008-12-12 12:48 ` [PATCH 02/33] sfc: Change SPI lengths to type size_t Ben Hutchings
2008-12-13 5:30 ` David Miller
2008-12-13 5:53 ` David Miller
2008-12-13 6:30 ` Ben Hutchings
2008-12-12 12:49 ` [PATCH 03/33] sfc: Do not use pci_disable_device() to disable bus mastering Ben Hutchings
2008-12-13 5:31 ` David Miller
2008-12-13 6:27 ` Ben Hutchings
2008-12-12 12:49 ` [PATCH 04/33] sfc: Remove unneeded register write Ben Hutchings
2008-12-13 5:31 ` David Miller
2008-12-12 12:49 ` [PATCH 05/33] sfc: Correct interpretation of second param to ethtool phys_id() Ben Hutchings
2008-12-13 5:32 ` David Miller
2008-12-12 12:50 ` [PATCH 06/33] sfc: Make reset_workqueue driver-global rather than per-NIC Ben Hutchings
2008-12-13 5:33 ` David Miller
2008-12-12 12:51 ` [PATCH 07/33] sfc: Clean up waits for flash/EEPROM operations Ben Hutchings
2008-12-13 5:33 ` David Miller
2008-12-12 12:51 ` [PATCH 08/33] sfc: Work around unreliable strap pins Ben Hutchings
2008-12-13 5:34 ` David Miller
2008-12-12 12:51 ` [PATCH 09/33] sfc: Restore phy_flash_cfg module parameter Ben Hutchings
2008-12-13 5:35 ` David Miller
2008-12-12 12:53 ` [PATCH 13/33] sfc: Don't count RX checksum errors during loopback self-test Ben Hutchings
2008-12-13 5:42 ` David Miller
2008-12-12 12:53 ` [PATCH 14/33] sfc: Remove MII extension cruft Ben Hutchings
2008-12-13 5:43 ` David Miller
2008-12-12 12:53 ` [PATCH 15/33] sfc: Add support for MMDs numbered >15 Ben Hutchings
2008-12-13 5:44 ` David Miller
2008-12-12 12:54 ` [PATCH 16/33] sfc: Add phy_type device attribute Ben Hutchings
2008-12-13 5:47 ` David Miller
2008-12-12 12:54 ` [PATCH 17/33] sfc: Clean up board identification Ben Hutchings
2008-12-13 5:48 ` David Miller
2008-12-12 12:54 ` [PATCH 18/33] sfc: Clean up MDIO flag setting Ben Hutchings
2008-12-13 5:49 ` David Miller
2008-12-12 12:54 ` [PATCH 19/33] sfc: Add support for sub-10G speeds Ben Hutchings
2008-12-13 5:50 ` David Miller
2008-12-12 12:55 ` [PATCH 20/33] sfc: Implement auto-negotiation Ben Hutchings
2008-12-13 5:50 ` David Miller
2008-12-12 12:55 ` [PATCH 21/33] sfc: Rework MAC, PHY and board event handling Ben Hutchings
2008-12-13 5:59 ` David Miller
2008-12-12 12:56 ` [PATCH 22/33] sfc: Add support for Solarflare 10Xpress SFT9001 Ben Hutchings
2008-12-13 6:00 ` David Miller
2008-12-12 12:56 ` [PATCH 23/33] sfc: Add support for SFN4111T Ben Hutchings
2008-12-13 6:01 ` David Miller
2008-12-12 12:56 ` [PATCH 25/33] sfc: Generate unique names for per-NIC workqueues Ben Hutchings
2008-12-13 6:04 ` David Miller
2008-12-13 6:23 ` Ben Hutchings
2008-12-13 6:29 ` David Miller
2008-12-13 14:01 ` Ben Hutchings
2008-12-12 12:57 ` [PATCH 26/33] sfc: Remove leading spaces Ben Hutchings
2008-12-13 6:05 ` David Miller
2008-12-12 12:57 ` [PATCH 27/33] sfc: Specify a meaningful component for loopback RX-side and PHY tests Ben Hutchings
2008-12-13 6:05 ` David Miller
2008-12-12 12:59 ` [PATCH 28/33] sfc: Use mutex_lock_interruptible() for ethtool EEPROM access Ben Hutchings
2008-12-13 6:06 ` David Miller
2008-12-12 12:59 ` [PATCH 29/33] sfc: Use model numbers for PHY type names Ben Hutchings
2008-12-13 6:07 ` David Miller
2008-12-12 13:00 ` [PATCH 30/33] sfc: Treat probe as unsuccessful if it scheduled a reset Ben Hutchings
2008-12-13 6:08 ` David Miller
2008-12-12 13:00 ` [PATCH 31/33] sfc: Use kzalloc() to ensure struct efx_spi_device is fully initialised Ben Hutchings
2008-12-13 6:09 ` David Miller
2008-12-12 12:52 ` Ben Hutchings [this message]
2008-12-13 5:36 ` [PATCH 10/33] sfc: Add option to use a separate channel for TX completions David Miller
2008-12-12 12:52 ` [PATCH 11/33] sfc: Provide hints to irqbalance daemon Ben Hutchings
2008-12-13 5:37 ` David Miller
2008-12-12 12:52 ` [PATCH 12/33] sfc: Abbreviate self-test names so they are not truncated Ben Hutchings
2008-12-13 5:42 ` David Miller
2008-12-12 12:56 ` [PATCH 24/33] sfc: Fix format arguments for warning about MSI-X allocation Ben Hutchings
2008-12-12 20:34 ` Ben Hutchings
2008-12-13 5:25 ` David Miller
2008-12-12 13:00 ` [PATCH 32/33] sfc: Fix synchronisation of efx_mtd_{probe,rename,remove} Ben Hutchings
2008-12-13 6:09 ` David Miller
2008-12-12 13:01 ` [PATCH 33/33] sfc: Version 2.3 Ben Hutchings
2008-12-13 6:10 ` David Miller
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=20081212125216.GJ10372@solarflare.com \
--to=bhutchings@solarflare.com \
--cc=davem@davemloft.net \
--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).