Netdev List
 help / color / mirror / Atom feed
From: Ben Hutchings <bhutchings@solarflare.com>
To: David Miller <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, <linux-net-drivers@solarflare.com>
Subject: [PATCH net-next 21/32] sfc: Remove efx_process_channel_now()
Date: Thu, 22 Aug 2013 13:56:22 +0100	[thread overview]
Message-ID: <1377176182.1703.26.camel@bwh-desktop.uk.level5networks.com> (raw)
In-Reply-To: <1377175392.1703.5.camel@bwh-desktop.uk.level5networks.com>

efx_process_channel_now() is unneeded since self-tests can rely on
normal NAPI polling.  Remove it and all calls to it.

efx_channel::work_pending and efx_channel_processed() are also
unneeded (the latter being the same as efx_nic_eventq_read_ack()).

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
 drivers/net/ethernet/sfc/efx.c        | 69 ++---------------------------------
 drivers/net/ethernet/sfc/efx.h        |  2 -
 drivers/net/ethernet/sfc/net_driver.h |  2 -
 drivers/net/ethernet/sfc/selftest.c   | 11 ------
 4 files changed, 3 insertions(+), 81 deletions(-)

diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c
index c729688..2b2dba1 100644
--- a/drivers/net/ethernet/sfc/efx.c
+++ b/drivers/net/ethernet/sfc/efx.c
@@ -255,23 +255,6 @@ static int efx_process_channel(struct efx_channel *channel, int budget)
 	return spent;
 }
 
-/* Mark channel as finished processing
- *
- * Note that since we will not receive further interrupts for this
- * channel before we finish processing and call the eventq_read_ack()
- * method, there is no need to use the interrupt hold-off timers.
- */
-static inline void efx_channel_processed(struct efx_channel *channel)
-{
-	/* The interrupt handler for this channel may set work_pending
-	 * as soon as we acknowledge the events we've seen.  Make sure
-	 * it's cleared before then. */
-	channel->work_pending = false;
-	smp_wmb();
-
-	efx_nic_eventq_read_ack(channel);
-}
-
 /* NAPI poll handler
  *
  * NAPI guarantees serialisation of polls of the same device, which
@@ -316,58 +299,16 @@ static int efx_poll(struct napi_struct *napi, int budget)
 
 		/* There is no race here; although napi_disable() will
 		 * only wait for napi_complete(), this isn't a problem
-		 * since efx_channel_processed() will have no effect if
+		 * since efx_nic_eventq_read_ack() will have no effect if
 		 * interrupts have already been disabled.
 		 */
 		napi_complete(napi);
-		efx_channel_processed(channel);
+		efx_nic_eventq_read_ack(channel);
 	}
 
 	return spent;
 }
 
-/* Process the eventq of the specified channel immediately on this CPU
- *
- * Disable hardware generated interrupts, wait for any existing
- * processing to finish, then directly poll (and ack ) the eventq.
- * Finally reenable NAPI and interrupts.
- *
- * This is for use only during a loopback self-test.  It must not
- * deliver any packets up the stack as this can result in deadlock.
- */
-void efx_process_channel_now(struct efx_channel *channel)
-{
-	struct efx_nic *efx = channel->efx;
-
-	BUG_ON(channel->channel >= efx->n_channels);
-	BUG_ON(!channel->enabled);
-	BUG_ON(!efx->loopback_selftest);
-
-	/* Disable interrupts and wait for ISRs to complete */
-	efx_nic_disable_interrupts(efx);
-	if (efx->legacy_irq) {
-		synchronize_irq(efx->legacy_irq);
-		efx->legacy_irq_enabled = false;
-	}
-	if (channel->irq)
-		synchronize_irq(channel->irq);
-
-	/* Wait for any NAPI processing to complete */
-	napi_disable(&channel->napi_str);
-
-	/* Poll the channel */
-	efx_process_channel(channel, channel->eventq_mask + 1);
-
-	/* Ack the eventq. This may cause an interrupt to be generated
-	 * when they are reenabled */
-	efx_channel_processed(channel);
-
-	napi_enable(&channel->napi_str);
-	if (efx->legacy_irq)
-		efx->legacy_irq_enabled = true;
-	efx_nic_enable_interrupts(efx);
-}
-
 /* Create event queue
  * Event queue memory allocations are done only once.  If the channel
  * is reset, the memory buffer will be reused; this guards against
@@ -407,11 +348,7 @@ static void efx_start_eventq(struct efx_channel *channel)
 	netif_dbg(channel->efx, ifup, channel->efx->net_dev,
 		  "chan %d start event queue\n", channel->channel);
 
-	/* The interrupt handler for this channel may set work_pending
-	 * as soon as we enable it.  Make sure it's cleared before
-	 * then.  Similarly, make sure it sees the enabled flag set.
-	 */
-	channel->work_pending = false;
+	/* Make sure the NAPI handler sees the enabled flag set */
 	channel->enabled = true;
 	smp_wmb();
 
diff --git a/drivers/net/ethernet/sfc/efx.h b/drivers/net/ethernet/sfc/efx.h
index bdb30bb..09e633a 100644
--- a/drivers/net/ethernet/sfc/efx.h
+++ b/drivers/net/ethernet/sfc/efx.h
@@ -109,7 +109,6 @@ static inline void efx_filter_rfs_expire(struct efx_channel *channel) {}
 /* Channels */
 extern int efx_channel_dummy_op_int(struct efx_channel *channel);
 extern void efx_channel_dummy_op_void(struct efx_channel *channel);
-extern void efx_process_channel_now(struct efx_channel *channel);
 extern int
 efx_realloc_channels(struct efx_nic *efx, u32 rxq_entries, u32 txq_entries);
 
@@ -155,7 +154,6 @@ static inline void efx_schedule_channel(struct efx_channel *channel)
 	netif_vdbg(channel->efx, intr, channel->efx->net_dev,
 		   "channel %d scheduling NAPI poll on CPU%d\n",
 		   channel->channel, raw_smp_processor_id());
-	channel->work_pending = true;
 
 	napi_schedule(&channel->napi_str);
 }
diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
index ea64cd8..ad89d7d 100644
--- a/drivers/net/ethernet/sfc/net_driver.h
+++ b/drivers/net/ethernet/sfc/net_driver.h
@@ -361,7 +361,6 @@ enum efx_rx_alloc_method {
  * @irq_moderation: IRQ moderation value (in hardware ticks)
  * @napi_dev: Net device used with NAPI
  * @napi_str: NAPI control structure
- * @work_pending: Is work pending via NAPI?
  * @eventq: Event queue buffer
  * @eventq_mask: Event queue pointer mask
  * @eventq_read_ptr: Event queue read pointer
@@ -393,7 +392,6 @@ struct efx_channel {
 	unsigned int irq_moderation;
 	struct net_device *napi_dev;
 	struct napi_struct napi_str;
-	bool work_pending;
 	struct efx_special_buffer eventq;
 	unsigned int eventq_mask;
 	unsigned int eventq_read_ptr;
diff --git a/drivers/net/ethernet/sfc/selftest.c b/drivers/net/ethernet/sfc/selftest.c
index 2069f51..716cff9 100644
--- a/drivers/net/ethernet/sfc/selftest.c
+++ b/drivers/net/ethernet/sfc/selftest.c
@@ -447,14 +447,7 @@ static int efx_begin_loopback(struct efx_tx_queue *tx_queue)
 static int efx_poll_loopback(struct efx_nic *efx)
 {
 	struct efx_loopback_state *state = efx->loopback_selftest;
-	struct efx_channel *channel;
 
-	/* NAPI polling is not enabled, so process channels
-	 * synchronously */
-	efx_for_each_channel(channel, efx) {
-		if (channel->work_pending)
-			efx_process_channel_now(channel);
-	}
 	return atomic_read(&state->rx_good) == state->packet_count;
 }
 
@@ -586,10 +579,6 @@ static int efx_wait_for_link(struct efx_nic *efx)
 			mutex_lock(&efx->mac_lock);
 			efx->type->monitor(efx);
 			mutex_unlock(&efx->mac_lock);
-		} else {
-			struct efx_channel *channel = efx_get_channel(efx, 0);
-			if (channel->work_pending)
-				efx_process_channel_now(channel);
 		}
 
 		mutex_lock(&efx->mac_lock);


-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

  parent reply	other threads:[~2013-08-22 12:56 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-22 12:43 Pull request: sfc-next 2013-08-22 Ben Hutchings
2013-08-22 12:44 ` [PATCH net-next 01/32] sfc: Fix lookup of default RX MAC filters when steered using ethtool Ben Hutchings
2013-08-22 12:44 ` [PATCH net-next 02/32] sfc: const-qualify source pointers for MMIO write functions Ben Hutchings
2013-08-22 12:45 ` [PATCH net-next 03/32] sfc: Use efx_mcdi_mon() to find efx_mcdi_mon structure from efx_nic Ben Hutchings
2013-08-22 12:45 ` [PATCH net-next 04/32] sfc: Move details of a Falcon bug workaround out of ethtool.c Ben Hutchings
2013-08-22 12:46 ` [PATCH net-next 05/32] sfc: Move more Falcon-specific code and definitions into falcon.c Ben Hutchings
2013-08-22 12:46 ` [PATCH net-next 06/32] sfc: Introduce and use MCDI_DECLARE_BUF macro Ben Hutchings
2013-08-22 12:47 ` [PATCH net-next 07/32] sfc: Rationalise MCDI buffer accessors Ben Hutchings
2013-08-22 12:48 ` [PATCH net-next 08/32] sfc: Fill out the set of MCDI accessors Ben Hutchings
2013-08-22 12:48 ` [PATCH net-next 09/32] sfc: Introduce and use MCDI_CTL_SDU_LEN_MAX_V1 macro for Siena-specific code Ben Hutchings
2013-08-22 12:49 ` [PATCH net-next 10/32] sfc: Use proper macros to declare and access MCDI arrays Ben Hutchings
2013-08-22 12:49 ` [PATCH net-next 11/32] sfc: Ensure MCDI buffers, but not lengths, are dword aligned Ben Hutchings
2013-08-22 12:50 ` [PATCH net-next 12/32] sfc: Add and use MCDI_SET_QWORD() and MCDI_SET_ARRAY_QWORD() Ben Hutchings
2013-08-22 12:50 ` [PATCH net-next 13/32] sfc: Move siena_reset_hw() and siena_map_reset_reason() into MCDI module Ben Hutchings
2013-08-22 12:50 ` [PATCH net-next 14/32] sfc: Move efx_mcdi_mac_reconfigure() to siena.c and rename Ben Hutchings
2013-08-22 12:52 ` [PATCH net-next 15/32] sfc: Collect all MCDI port functions into mcdi_port.c Ben Hutchings
2013-08-22 12:53 ` [PATCH net-next 16/32] sfc: Make efx_mcdi_init() call efx_mcdi_handle_assertion() Ben Hutchings
2013-08-22 12:54 ` [PATCH net-next 17/32] sfc: Make MCDI independent of Siena Ben Hutchings
2013-08-22 12:54 ` [PATCH net-next 18/32] sfc: Add GFP flags to efx_nic_alloc_buffer() and make most callers allow blocking Ben Hutchings
2013-08-22 12:55 ` [PATCH net-next 19/32] sfc: Make struct efx_special_buffer less special Ben Hutchings
2013-08-22 12:55 ` [PATCH net-next 20/32] sfc: Rename Falcon-architecture register definitions Ben Hutchings
2013-08-22 12:56 ` Ben Hutchings [this message]
2013-08-22 12:57 ` [PATCH net-next 22/32] sfc: Rework IRQ enable/disable Ben Hutchings
2013-08-22 12:59 ` [PATCH net-next 23/32] sfc: Limit scope of a Falcon A1 IRQ workaround Ben Hutchings
2013-08-22 13:00 ` [PATCH net-next 24/32] sfc: Stop RX refill before flushing RX queues Ben Hutchings
2013-08-22 13:00 ` [PATCH net-next 25/32] sfc: Remove bogus call to efx_release_tx_buffers() Ben Hutchings
2013-08-22 13:02 ` [PATCH net-next 26/32] sfc: Refactor queue teardown sequence to allow for EF10 flush behaviour Ben Hutchings
2013-08-22 13:05 ` [PATCH net-next 27/32] sfc: Move and rename Falcon/Siena common NIC operations Ben Hutchings
2013-08-22 13:05 ` [PATCH net-next 28/32] sfc: Translate MCDI error numbers received in events Ben Hutchings
2013-08-22 13:07 ` [PATCH net-next 29/32] sfc: Update MCDI protocol definitions for EF10 Ben Hutchings
2013-08-22 13:09 ` [PATCH net-next 30/32] sfc: Add support for MCDI v2 Ben Hutchings
2013-08-22 13:10 ` [PATCH net-next 31/32] sfc: Fix race in completion handling Ben Hutchings
2013-08-22 13:10 ` [PATCH net-next 32/32] sfc: Update and improve kernel-doc for efx_mcdi_state & efx_mcdi_iface Ben Hutchings
2013-08-22 19:09 ` Pull request: sfc-next 2013-08-22 David Miller
2013-08-22 19:16   ` Ben Hutchings

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=1377176182.1703.26.camel@bwh-desktop.uk.level5networks.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