From: Ben Hutchings <bhutchings@solarflare.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, linux-net-drivers@solarflare.com
Subject: [PATCH 06/33] sfc: Make reset_workqueue driver-global rather than per-NIC
Date: Fri, 12 Dec 2008 12:50:38 +0000 [thread overview]
Message-ID: <20081212125037.GF10372@solarflare.com> (raw)
In-Reply-To: <20081212124622.GK32518@solarflare.com>
From: Steve Hodgson <shodgson@solarflare.com>
Each reset is serialised by the rtnl_lock anyway, so there's no win
per-NIC.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
drivers/net/sfc/efx.c | 45 ++++++++++++++++++-----------------------
drivers/net/sfc/net_driver.h | 2 -
2 files changed, 20 insertions(+), 27 deletions(-)
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c
index bbc8402..127b4da 100644
--- a/drivers/net/sfc/efx.c
+++ b/drivers/net/sfc/efx.c
@@ -39,6 +39,12 @@
*/
static struct workqueue_struct *refill_workqueue;
+/* Reset workqueue. If any NIC has a hardware failure then a reset will be
+ * queued onto this work queue. This is not a per-nic work queue, because
+ * efx_reset_work() acquires the rtnl lock, so resets are naturally serialised.
+ */
+static struct workqueue_struct *reset_workqueue;
+
/**************************************************************************
*
* Configurable values
@@ -1697,7 +1703,7 @@ void efx_schedule_reset(struct efx_nic *efx, enum reset_type type)
efx->reset_pending = method;
- queue_work(efx->reset_workqueue, &efx->reset_work);
+ queue_work(reset_workqueue, &efx->reset_work);
}
/**************************************************************************
@@ -1763,7 +1769,7 @@ static int efx_init_struct(struct efx_nic *efx, struct efx_nic_type *type,
struct efx_channel *channel;
struct efx_tx_queue *tx_queue;
struct efx_rx_queue *rx_queue;
- int i, rc;
+ int i;
/* Initialise common structures */
memset(efx, 0, sizeof(*efx));
@@ -1832,33 +1838,14 @@ static int efx_init_struct(struct efx_nic *efx, struct efx_nic_type *type,
interrupt_mode);
efx->workqueue = create_singlethread_workqueue("sfc_work");
- if (!efx->workqueue) {
- rc = -ENOMEM;
- goto fail1;
- }
-
- efx->reset_workqueue = create_singlethread_workqueue("sfc_reset");
- if (!efx->reset_workqueue) {
- rc = -ENOMEM;
- goto fail2;
- }
+ if (!efx->workqueue)
+ return -ENOMEM;
return 0;
-
- fail2:
- destroy_workqueue(efx->workqueue);
- efx->workqueue = NULL;
-
- fail1:
- return rc;
}
static void efx_fini_struct(struct efx_nic *efx)
{
- if (efx->reset_workqueue) {
- destroy_workqueue(efx->reset_workqueue);
- efx->reset_workqueue = NULL;
- }
if (efx->workqueue) {
destroy_workqueue(efx->workqueue);
efx->workqueue = NULL;
@@ -1923,7 +1910,7 @@ static void efx_pci_remove(struct pci_dev *pci_dev)
* scheduled from this point because efx_stop_all() has been
* called, we are no longer registered with driverlink, and
* the net_device's have been removed. */
- flush_workqueue(efx->reset_workqueue);
+ cancel_work_sync(&efx->reset_work);
efx_pci_remove_main(efx);
@@ -2045,7 +2032,7 @@ static int __devinit efx_pci_probe(struct pci_dev *pci_dev,
* scheduled since efx_stop_all() has been called, and we
* have not and never have been registered with either
* the rtnetlink or driverlink layers. */
- flush_workqueue(efx->reset_workqueue);
+ cancel_work_sync(&efx->reset_work);
/* Retry if a recoverably reset event has been scheduled */
if ((efx->reset_pending != RESET_TYPE_INVISIBLE) &&
@@ -2121,6 +2108,11 @@ static int __init efx_init_module(void)
rc = -ENOMEM;
goto err_refill;
}
+ reset_workqueue = create_singlethread_workqueue("sfc_reset");
+ if (!reset_workqueue) {
+ rc = -ENOMEM;
+ goto err_reset;
+ }
rc = pci_register_driver(&efx_pci_driver);
if (rc < 0)
@@ -2129,6 +2121,8 @@ static int __init efx_init_module(void)
return 0;
err_pci:
+ destroy_workqueue(reset_workqueue);
+ err_reset:
destroy_workqueue(refill_workqueue);
err_refill:
unregister_netdevice_notifier(&efx_netdev_notifier);
@@ -2141,6 +2135,7 @@ static void __exit efx_exit_module(void)
printk(KERN_INFO "Solarflare NET driver unloading\n");
pci_unregister_driver(&efx_pci_driver);
+ destroy_workqueue(reset_workqueue);
destroy_workqueue(refill_workqueue);
unregister_netdevice_notifier(&efx_netdev_notifier);
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h
index e596c9a..f910609 100644
--- a/drivers/net/sfc/net_driver.h
+++ b/drivers/net/sfc/net_driver.h
@@ -635,7 +635,6 @@ union efx_multicast_hash {
* @legacy_irq: IRQ number
* @workqueue: Workqueue for port reconfigures and the HW monitor.
* Work items do not hold and must not acquire RTNL.
- * @reset_workqueue: Workqueue for resets. Work item will acquire RTNL.
* @reset_work: Scheduled reset workitem
* @monitor_work: Hardware monitor workitem
* @membase_phys: Memory BAR value as physical address
@@ -711,7 +710,6 @@ struct efx_nic {
const struct efx_nic_type *type;
int legacy_irq;
struct workqueue_struct *workqueue;
- struct workqueue_struct *reset_workqueue;
struct work_struct reset_work;
struct delayed_work monitor_work;
resource_size_t membase_phys;
--
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:50 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 ` Ben Hutchings [this message]
2008-12-13 5:33 ` [PATCH 06/33] sfc: Make reset_workqueue driver-global rather than per-NIC 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 ` [PATCH 10/33] sfc: Add option to use a separate channel for TX completions Ben Hutchings
2008-12-13 5:36 ` 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=20081212125037.GF10372@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).