DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrew Rybchenko <arybchenko@solarflare.com>
To: <dev@dpdk.org>
Cc: Ferruh Yigit <ferruh.yigit@intel.com>
Subject: [dpdk-dev] [PATCH v2 01/13] net/sfc: use different callbacks for event queues
Date: Mon, 20 Mar 2017 10:15:07 +0000	[thread overview]
Message-ID: <1490004919-2177-2-git-send-email-arybchenko@solarflare.com> (raw)
In-Reply-To: <1490004919-2177-1-git-send-email-arybchenko@solarflare.com>

Use different sets of libefx EvQ callbacks for management,
transmit and receive event queue. It makes event handling
more robust against unexpected events.

Also it is required for alternative datapath support.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/sfc/sfc_ev.c | 107 +++++++++++++++++++++++++++++++++++++++++++++--
 drivers/net/sfc/sfc_ev.h |  19 +++++----
 2 files changed, 114 insertions(+), 12 deletions(-)

diff --git a/drivers/net/sfc/sfc_ev.c b/drivers/net/sfc/sfc_ev.c
index 412645a..bb22001 100644
--- a/drivers/net/sfc/sfc_ev.c
+++ b/drivers/net/sfc/sfc_ev.c
@@ -71,6 +71,18 @@ sfc_ev_initialized(void *arg)
 }
 
 static boolean_t
+sfc_ev_nop_rx(void *arg, uint32_t label, uint32_t id,
+	      uint32_t size, uint16_t flags)
+{
+	struct sfc_evq *evq = arg;
+
+	sfc_err(evq->sa,
+		"EVQ %u unexpected Rx event label=%u id=%#x size=%u flags=%#x",
+		evq->evq_index, label, id, size, flags);
+	return B_TRUE;
+}
+
+static boolean_t
 sfc_ev_rx(void *arg, __rte_unused uint32_t label, uint32_t id,
 	  uint32_t size, uint16_t flags)
 {
@@ -144,6 +156,16 @@ sfc_ev_rx(void *arg, __rte_unused uint32_t label, uint32_t id,
 }
 
 static boolean_t
+sfc_ev_nop_tx(void *arg, uint32_t label, uint32_t id)
+{
+	struct sfc_evq *evq = arg;
+
+	sfc_err(evq->sa, "EVQ %u unexpected Tx event label=%u id=%#x",
+		evq->evq_index, label, id);
+	return B_TRUE;
+}
+
+static boolean_t
 sfc_ev_tx(void *arg, __rte_unused uint32_t label, uint32_t id)
 {
 	struct sfc_evq *evq = arg;
@@ -198,6 +220,16 @@ sfc_ev_exception(void *arg, __rte_unused uint32_t code,
 }
 
 static boolean_t
+sfc_ev_nop_rxq_flush_done(void *arg, uint32_t rxq_hw_index)
+{
+	struct sfc_evq *evq = arg;
+
+	sfc_err(evq->sa, "EVQ %u unexpected RxQ %u flush done",
+		evq->evq_index, rxq_hw_index);
+	return B_TRUE;
+}
+
+static boolean_t
 sfc_ev_rxq_flush_done(void *arg, __rte_unused uint32_t rxq_hw_index)
 {
 	struct sfc_evq *evq = arg;
@@ -213,6 +245,16 @@ sfc_ev_rxq_flush_done(void *arg, __rte_unused uint32_t rxq_hw_index)
 }
 
 static boolean_t
+sfc_ev_nop_rxq_flush_failed(void *arg, uint32_t rxq_hw_index)
+{
+	struct sfc_evq *evq = arg;
+
+	sfc_err(evq->sa, "EVQ %u unexpected RxQ %u flush failed",
+		evq->evq_index, rxq_hw_index);
+	return B_TRUE;
+}
+
+static boolean_t
 sfc_ev_rxq_flush_failed(void *arg, __rte_unused uint32_t rxq_hw_index)
 {
 	struct sfc_evq *evq = arg;
@@ -228,6 +270,16 @@ sfc_ev_rxq_flush_failed(void *arg, __rte_unused uint32_t rxq_hw_index)
 }
 
 static boolean_t
+sfc_ev_nop_txq_flush_done(void *arg, uint32_t txq_hw_index)
+{
+	struct sfc_evq *evq = arg;
+
+	sfc_err(evq->sa, "EVQ %u unexpected TxQ %u flush done",
+		evq->evq_index, txq_hw_index);
+	return B_TRUE;
+}
+
+static boolean_t
 sfc_ev_txq_flush_done(void *arg, __rte_unused uint32_t txq_hw_index)
 {
 	struct sfc_evq *evq = arg;
@@ -283,6 +335,16 @@ sfc_ev_timer(void *arg, uint32_t index)
 }
 
 static boolean_t
+sfc_ev_nop_link_change(void *arg, __rte_unused efx_link_mode_t link_mode)
+{
+	struct sfc_evq *evq = arg;
+
+	sfc_err(evq->sa, "EVQ %u unexpected link change event",
+		evq->evq_index);
+	return B_TRUE;
+}
+
+static boolean_t
 sfc_ev_link_change(void *arg, efx_link_mode_t link_mode)
 {
 	struct sfc_evq *evq = arg;
@@ -314,17 +376,47 @@ sfc_ev_link_change(void *arg, efx_link_mode_t link_mode)
 
 static const efx_ev_callbacks_t sfc_ev_callbacks = {
 	.eec_initialized	= sfc_ev_initialized,
+	.eec_rx			= sfc_ev_nop_rx,
+	.eec_tx			= sfc_ev_nop_tx,
+	.eec_exception		= sfc_ev_exception,
+	.eec_rxq_flush_done	= sfc_ev_nop_rxq_flush_done,
+	.eec_rxq_flush_failed	= sfc_ev_nop_rxq_flush_failed,
+	.eec_txq_flush_done	= sfc_ev_nop_txq_flush_done,
+	.eec_software		= sfc_ev_software,
+	.eec_sram		= sfc_ev_sram,
+	.eec_wake_up		= sfc_ev_wake_up,
+	.eec_timer		= sfc_ev_timer,
+	.eec_link_change	= sfc_ev_link_change,
+};
+
+static const efx_ev_callbacks_t sfc_ev_callbacks_rx = {
+	.eec_initialized	= sfc_ev_initialized,
 	.eec_rx			= sfc_ev_rx,
-	.eec_tx			= sfc_ev_tx,
+	.eec_tx			= sfc_ev_nop_tx,
 	.eec_exception		= sfc_ev_exception,
 	.eec_rxq_flush_done	= sfc_ev_rxq_flush_done,
 	.eec_rxq_flush_failed	= sfc_ev_rxq_flush_failed,
+	.eec_txq_flush_done	= sfc_ev_nop_txq_flush_done,
+	.eec_software		= sfc_ev_software,
+	.eec_sram		= sfc_ev_sram,
+	.eec_wake_up		= sfc_ev_wake_up,
+	.eec_timer		= sfc_ev_timer,
+	.eec_link_change	= sfc_ev_nop_link_change,
+};
+
+static const efx_ev_callbacks_t sfc_ev_callbacks_tx = {
+	.eec_initialized	= sfc_ev_initialized,
+	.eec_rx			= sfc_ev_nop_rx,
+	.eec_tx			= sfc_ev_tx,
+	.eec_exception		= sfc_ev_exception,
+	.eec_rxq_flush_done	= sfc_ev_nop_rxq_flush_done,
+	.eec_rxq_flush_failed	= sfc_ev_nop_rxq_flush_failed,
 	.eec_txq_flush_done	= sfc_ev_txq_flush_done,
 	.eec_software		= sfc_ev_software,
 	.eec_sram		= sfc_ev_sram,
 	.eec_wake_up		= sfc_ev_wake_up,
 	.eec_timer		= sfc_ev_timer,
-	.eec_link_change	= sfc_ev_link_change,
+	.eec_link_change	= sfc_ev_nop_link_change,
 };
 
 
@@ -336,7 +428,7 @@ sfc_ev_qpoll(struct sfc_evq *evq)
 
 	/* Synchronize the DMA memory for reading not required */
 
-	efx_ev_qpoll(evq->common, &evq->read_ptr, &sfc_ev_callbacks, evq);
+	efx_ev_qpoll(evq->common, &evq->read_ptr, evq->callbacks, evq);
 
 	if (unlikely(evq->exception) && sfc_adapter_trylock(evq->sa)) {
 		struct sfc_adapter *sa = evq->sa;
@@ -427,6 +519,14 @@ sfc_ev_qstart(struct sfc_adapter *sa, unsigned int sw_index)
 	if (rc != 0)
 		goto fail_ev_qcreate;
 
+	SFC_ASSERT(evq->rxq == NULL || evq->txq == NULL);
+	if (evq->rxq != 0)
+		evq->callbacks = &sfc_ev_callbacks_rx;
+	else if (evq->txq != 0)
+		evq->callbacks = &sfc_ev_callbacks_tx;
+	else
+		evq->callbacks = &sfc_ev_callbacks;
+
 	evq->init_state = SFC_EVQ_STARTING;
 
 	/* Wait for the initialization event */
@@ -485,6 +585,7 @@ sfc_ev_qstop(struct sfc_adapter *sa, unsigned int sw_index)
 		return;
 
 	evq->init_state = SFC_EVQ_INITIALIZED;
+	evq->callbacks = NULL;
 	evq->read_ptr = 0;
 	evq->exception = B_FALSE;
 
diff --git a/drivers/net/sfc/sfc_ev.h b/drivers/net/sfc/sfc_ev.h
index 5bb2be4..359958e 100644
--- a/drivers/net/sfc/sfc_ev.h
+++ b/drivers/net/sfc/sfc_ev.h
@@ -56,17 +56,18 @@ enum sfc_evq_state {
 
 struct sfc_evq {
 	/* Used on datapath */
-	efx_evq_t		*common;
-	unsigned int		read_ptr;
-	boolean_t		exception;
-	efsys_mem_t		mem;
-	struct sfc_rxq		*rxq;
-	struct sfc_txq		*txq;
+	efx_evq_t			*common;
+	const efx_ev_callbacks_t	*callbacks;
+	unsigned int			read_ptr;
+	boolean_t			exception;
+	efsys_mem_t			mem;
+	struct sfc_rxq			*rxq;
+	struct sfc_txq			*txq;
 
 	/* Not used on datapath */
-	struct sfc_adapter	*sa;
-	unsigned int		evq_index;
-	enum sfc_evq_state	init_state;
+	struct sfc_adapter		*sa;
+	unsigned int			evq_index;
+	enum sfc_evq_state		init_state;
 };
 
 struct sfc_evq_info {
-- 
2.9.3

  reply	other threads:[~2017-03-20 10:15 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-02  7:07 [dpdk-dev] [PATCH 00/13] Improve Solarflare PMD performance Andrew Rybchenko
2017-03-02  7:07 ` [dpdk-dev] [PATCH 01/13] net/sfc: callbacks should depend on EvQ usage Andrew Rybchenko
2017-03-04 21:04   ` Ferruh Yigit
2017-03-02  7:07 ` [dpdk-dev] [PATCH 02/13] net/sfc: emphasis that RSS hash flag is an Rx queue flag Andrew Rybchenko
2017-03-02  7:07 ` [dpdk-dev] [PATCH 03/13] net/sfc: do not use Rx queue control state on datapath Andrew Rybchenko
2017-03-02  7:07 ` [dpdk-dev] [PATCH 04/13] net/sfc: factor out libefx-based Rx datapath Andrew Rybchenko
2017-03-04 21:05   ` Ferruh Yigit
2017-03-13 13:12     ` Andrew Rybchenko
2017-03-02  7:07 ` [dpdk-dev] [PATCH 05/13] net/sfc: Rx scatter is a datapath-dependent feature Andrew Rybchenko
2017-03-02  7:07 ` [dpdk-dev] [PATCH 06/13] net/sfc: implement EF10 native Rx datapath Andrew Rybchenko
2017-03-02  7:07 ` [dpdk-dev] [PATCH 07/13] net/sfc: factory out libefx-based Tx datapath Andrew Rybchenko
2017-03-02  7:07 ` [dpdk-dev] [PATCH 08/13] net/sfc: VLAN insertion is a datapath dependent feature Andrew Rybchenko
2017-03-02  7:07 ` [dpdk-dev] [PATCH 09/13] net/sfc: TSO " Andrew Rybchenko
2017-03-02  7:07 ` [dpdk-dev] [PATCH 10/13] net/sfc: implement EF10 native Tx datapath Andrew Rybchenko
2017-03-02  7:07 ` [dpdk-dev] [PATCH 11/13] net/sfc: multi-segment support as is Tx datapath features Andrew Rybchenko
2017-03-02  7:07 ` [dpdk-dev] [PATCH 12/13] net/sfc: implement simple EF10 native Tx datapath Andrew Rybchenko
2017-03-02  7:07 ` [dpdk-dev] [PATCH 13/13] net/sfc: support Rx packed stream EF10-specific datapath Andrew Rybchenko
2017-03-04 21:07 ` [dpdk-dev] [PATCH 00/13] Improve Solarflare PMD performance Ferruh Yigit
2017-03-20 10:15 ` [dpdk-dev] [PATCH v2 " Andrew Rybchenko
2017-03-20 10:15   ` Andrew Rybchenko [this message]
2017-03-20 10:15   ` [dpdk-dev] [PATCH v2 02/13] net/sfc: emphasis that RSS hash flag is an Rx queue flag Andrew Rybchenko
2017-03-20 10:15   ` [dpdk-dev] [PATCH v2 03/13] net/sfc: do not use Rx queue control state on datapath Andrew Rybchenko
2017-03-20 10:15   ` [dpdk-dev] [PATCH v2 04/13] net/sfc: factor out libefx-based Rx datapath Andrew Rybchenko
2017-03-20 10:15   ` [dpdk-dev] [PATCH v2 05/13] net/sfc: make Rx scatter a datapath-dependent feature Andrew Rybchenko
2017-03-20 10:15   ` [dpdk-dev] [PATCH v2 06/13] net/sfc: remove few conditions in Rx queue refill Andrew Rybchenko
2017-03-20 10:15   ` [dpdk-dev] [PATCH v2 07/13] net/sfc: implement EF10 native Rx datapath Andrew Rybchenko
2017-03-20 10:15   ` [dpdk-dev] [PATCH v2 08/13] net/sfc: factor out libefx-based Tx datapath Andrew Rybchenko
2017-03-20 10:15   ` [dpdk-dev] [PATCH v2 09/13] net/sfc: make VLAN insertion a datapath-dependent feature Andrew Rybchenko
2017-03-20 10:15   ` [dpdk-dev] [PATCH v2 10/13] net/sfc: make TSO " Andrew Rybchenko
2017-03-20 10:15   ` [dpdk-dev] [PATCH v2 11/13] net/sfc: implement EF10 native Tx datapath Andrew Rybchenko
2017-03-20 10:15   ` [dpdk-dev] [PATCH v2 12/13] net/sfc: make multi-segment support a Tx datapath feature Andrew Rybchenko
2017-03-20 10:15   ` [dpdk-dev] [PATCH v2 13/13] net/sfc: implement simple EF10 native Tx datapath Andrew Rybchenko
2017-03-20 15:37   ` [dpdk-dev] [PATCH v2 00/13] Improve Solarflare PMD performance Ferruh Yigit

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=1490004919-2177-2-git-send-email-arybchenko@solarflare.com \
    --to=arybchenko@solarflare.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    /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).