netdev.vger.kernel.org archive mirror
 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 09/19] sfc: Generate RX fill events based on RX queues, not channels
Date: Thu, 16 Feb 2012 00:47:42 +0000	[thread overview]
Message-ID: <1329353262.2565.35.camel@bwh-desktop> (raw)
In-Reply-To: <1329352938.2565.26.camel@bwh-desktop>

This makes it harder to accidentally send such events to TX-only
channels.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
 drivers/net/ethernet/sfc/nic.c |   17 +++++++++++------
 drivers/net/ethernet/sfc/nic.h |    2 +-
 drivers/net/ethernet/sfc/rx.c  |    3 +--
 3 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/sfc/nic.c b/drivers/net/ethernet/sfc/nic.c
index 0a46b1c..2b33afd 100644
--- a/drivers/net/ethernet/sfc/nic.c
+++ b/drivers/net/ethernet/sfc/nic.c
@@ -66,8 +66,9 @@
 
 #define EFX_CHANNEL_MAGIC_TEST(_channel)				\
 	_EFX_CHANNEL_MAGIC(_EFX_CHANNEL_MAGIC_TEST, (_channel)->channel)
-#define EFX_CHANNEL_MAGIC_FILL(_channel)				\
-	_EFX_CHANNEL_MAGIC(_EFX_CHANNEL_MAGIC_FILL, (_channel)->channel)
+#define EFX_CHANNEL_MAGIC_FILL(_rx_queue)				\
+	_EFX_CHANNEL_MAGIC(_EFX_CHANNEL_MAGIC_FILL,			\
+			   efx_rx_queue_index(_rx_queue))
 
 /**************************************************************************
  *
@@ -912,17 +913,20 @@ static void
 efx_handle_generated_event(struct efx_channel *channel, efx_qword_t *event)
 {
 	struct efx_nic *efx = channel->efx;
+	struct efx_rx_queue *rx_queue =
+		efx_channel_has_rx_queue(channel) ?
+		efx_channel_get_rx_queue(channel) : NULL;
 	unsigned magic;
 
 	magic = EFX_QWORD_FIELD(*event, FSF_AZ_DRV_GEN_EV_MAGIC);
 
 	if (magic == EFX_CHANNEL_MAGIC_TEST(channel))
 		; /* ignore */
-	else if (magic == EFX_CHANNEL_MAGIC_FILL(channel))
+	else if (rx_queue && magic == EFX_CHANNEL_MAGIC_FILL(rx_queue))
 		/* The queue must be empty, so we won't receive any rx
 		 * events, so efx_process_channel() won't refill the
 		 * queue. Refill it here */
-		efx_fast_push_rx_descriptors(efx_channel_get_rx_queue(channel));
+		efx_fast_push_rx_descriptors(rx_queue);
 	else
 		netif_dbg(efx, hw, efx->net_dev, "channel %d received "
 			  "generated event "EFX_QWORD_FMT"\n",
@@ -1150,9 +1154,10 @@ void efx_nic_generate_test_event(struct efx_channel *channel)
 	efx_magic_event(channel, EFX_CHANNEL_MAGIC_TEST(channel));
 }
 
-void efx_nic_generate_fill_event(struct efx_channel *channel)
+void efx_nic_generate_fill_event(struct efx_rx_queue *rx_queue)
 {
-	efx_magic_event(channel, EFX_CHANNEL_MAGIC_FILL(channel));
+	efx_magic_event(efx_rx_queue_channel(rx_queue),
+			EFX_CHANNEL_MAGIC_FILL(rx_queue));
 }
 
 /**************************************************************************
diff --git a/drivers/net/ethernet/sfc/nic.h b/drivers/net/ethernet/sfc/nic.h
index 4f9d18a..aeca4e8 100644
--- a/drivers/net/ethernet/sfc/nic.h
+++ b/drivers/net/ethernet/sfc/nic.h
@@ -195,6 +195,7 @@ extern void efx_nic_init_rx(struct efx_rx_queue *rx_queue);
 extern void efx_nic_fini_rx(struct efx_rx_queue *rx_queue);
 extern void efx_nic_remove_rx(struct efx_rx_queue *rx_queue);
 extern void efx_nic_notify_rx_desc(struct efx_rx_queue *rx_queue);
+extern void efx_nic_generate_fill_event(struct efx_rx_queue *rx_queue);
 
 /* Event data path */
 extern int efx_nic_probe_eventq(struct efx_channel *channel);
@@ -216,7 +217,6 @@ extern void falcon_update_stats_xmac(struct efx_nic *efx);
 extern int efx_nic_init_interrupt(struct efx_nic *efx);
 extern void efx_nic_enable_interrupts(struct efx_nic *efx);
 extern void efx_nic_generate_test_event(struct efx_channel *channel);
-extern void efx_nic_generate_fill_event(struct efx_channel *channel);
 extern void efx_nic_generate_interrupt(struct efx_nic *efx);
 extern void efx_nic_disable_interrupts(struct efx_nic *efx);
 extern void efx_nic_fini_interrupt(struct efx_nic *efx);
diff --git a/drivers/net/ethernet/sfc/rx.c b/drivers/net/ethernet/sfc/rx.c
index 1dfda5e..76fb521 100644
--- a/drivers/net/ethernet/sfc/rx.c
+++ b/drivers/net/ethernet/sfc/rx.c
@@ -405,10 +405,9 @@ void efx_fast_push_rx_descriptors(struct efx_rx_queue *rx_queue)
 void efx_rx_slow_fill(unsigned long context)
 {
 	struct efx_rx_queue *rx_queue = (struct efx_rx_queue *)context;
-	struct efx_channel *channel = efx_rx_queue_channel(rx_queue);
 
 	/* Post an event to cause NAPI to run and refill the queue */
-	efx_nic_generate_fill_event(channel);
+	efx_nic_generate_fill_event(rx_queue);
 	++rx_queue->slow_fill_count;
 }
 
-- 
1.7.7.6



-- 
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:[~2012-02-16  0:47 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-16  0:42 pull request: sfc-next 2012-02-16 Ben Hutchings
2012-02-16  0:44 ` [PATCH net-next 01/19] sfc: Skip RX end-of-batch work on channels without an RX queue Ben Hutchings
2012-02-16  0:44 ` [PATCH net-next 02/19] sfc: Do not retry hardware probe if it schedules a reset Ben Hutchings
2012-02-16  0:45 ` [PATCH net-next 03/19] sfc: Replace some literal constants with EFX_PAGE_SIZE/EFX_BUF_SIZE Ben Hutchings
2012-02-16  0:45 ` [PATCH net-next 04/19] sfc: Warn if unable to create MTDs Ben Hutchings
2012-02-16  0:46 ` [PATCH net-next 05/19] sfc: Add support for configuring RX unicast/multicast default filters Ben Hutchings
2012-02-16  0:46 ` [PATCH net-next 06/19] sfc: Add support for TX MAC filters Ben Hutchings
2012-02-16  0:47 ` [PATCH net-next 07/19] sfc: Correct MAC filter bitfield definitions Ben Hutchings
2012-02-16  0:47 ` [PATCH net-next 08/19] sfc: Generalise driver event generation Ben Hutchings
2012-02-16  0:47 ` Ben Hutchings [this message]
2012-02-16  0:48 ` [PATCH net-next 10/19] sfc: Leave interrupts and event queues enabled whenever we can Ben Hutchings
2012-02-16  0:48 ` [PATCH net-next 11/19] sfc: Use proper function to test for RX channel in efx_poll() Ben Hutchings
2012-02-16  0:48 ` [PATCH net-next 12/19] sfc: Generalise event generation to cover VF-owned event queues Ben Hutchings
2012-02-16  0:49 ` [PATCH net-next 13/19] sfc: Disable flow control during flushes Ben Hutchings
2012-02-16  0:49 ` [PATCH net-next 14/19] sfc: Make buffer table indices and counts consistently unsigned Ben Hutchings
2012-02-16  0:50 ` [PATCH net-next 15/19] sfc: Make all CPU/IRQ/channel/queue counts unsigned Ben Hutchings
2012-02-16  0:50 ` [PATCH net-next 16/19] sfc: Add support for 'extra' channel types Ben Hutchings
2012-02-16  0:51 ` [PATCH net-next 17/19] sfc: Pass NIC structure into efx_wanted_parallelism() Ben Hutchings
2012-02-16  0:52 ` [PATCH net-next 18/19] sfc: Allocate SRAM between buffer table and descriptor caches at init time Ben Hutchings
2012-02-16  0:52 ` [PATCH net-next 19/19] sfc: Add SR-IOV back-end support for SFC9000 family Ben Hutchings
2012-02-16  1:18   ` John Fastabend
2012-02-16  1:57     ` Ben Hutchings
2012-02-21 19:52       ` John Fastabend
2012-02-21 20:24         ` Ben Hutchings
2012-02-16 22:08 ` pull request: sfc-next 2012-02-16 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=1329353262.2565.35.camel@bwh-desktop \
    --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).