DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrew Rybchenko <arybchenko@solarflare.com>
To: <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH 13/30] net/sfc: move TxQ state to multi-process shared location
Date: Thu, 7 Feb 2019 12:17:36 +0000	[thread overview]
Message-ID: <1549541873-17403-14-git-send-email-arybchenko@solarflare.com> (raw)
In-Reply-To: <1549541873-17403-1-git-send-email-arybchenko@solarflare.com>

Secondary process needs to know TxQ state.
TxQ control structure will become primary process private.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/sfc/sfc_ev.c |  4 +++-
 drivers/net/sfc/sfc_tx.c | 51 +++++++++++++++++++++++-----------------
 drivers/net/sfc/sfc_tx.h |  6 +++--
 3 files changed, 36 insertions(+), 25 deletions(-)

diff --git a/drivers/net/sfc/sfc_ev.c b/drivers/net/sfc/sfc_ev.c
index 5965e2350..0ca502ea2 100644
--- a/drivers/net/sfc/sfc_ev.c
+++ b/drivers/net/sfc/sfc_ev.c
@@ -355,7 +355,9 @@ sfc_ev_txq_flush_done(void *arg, __rte_unused uint32_t txq_hw_index)
 	SFC_ASSERT(txq != NULL);
 	SFC_ASSERT(txq->hw_index == txq_hw_index);
 	SFC_ASSERT(txq->evq == evq);
-	sfc_tx_qflush_done(txq);
+	RTE_SET_USED(txq);
+
+	sfc_tx_qflush_done(sfc_txq_info_by_dp_txq(dp_txq));
 
 	return B_FALSE;
 }
diff --git a/drivers/net/sfc/sfc_tx.c b/drivers/net/sfc/sfc_tx.c
index 5d31fedbb..f4fbffe0a 100644
--- a/drivers/net/sfc/sfc_tx.c
+++ b/drivers/net/sfc/sfc_tx.c
@@ -110,10 +110,10 @@ sfc_tx_qcheck_conf(struct sfc_adapter *sa, unsigned int txq_max_fill_level,
 }
 
 void
-sfc_tx_qflush_done(struct sfc_txq *txq)
+sfc_tx_qflush_done(struct sfc_txq_info *txq_info)
 {
-	txq->state |= SFC_TXQ_FLUSHED;
-	txq->state &= ~SFC_TXQ_FLUSHING;
+	txq_info->state |= SFC_TXQ_FLUSHED;
+	txq_info->state &= ~SFC_TXQ_FLUSHING;
 }
 
 int
@@ -201,7 +201,7 @@ sfc_tx_qinit(struct sfc_adapter *sa, unsigned int sw_index,
 
 	evq->dp_txq = txq->dp;
 
-	txq->state = SFC_TXQ_INITIALIZED;
+	txq_info->state = SFC_TXQ_INITIALIZED;
 
 	txq_info->deferred_start = (tx_conf->tx_deferred_start != 0);
 
@@ -241,7 +241,7 @@ sfc_tx_qfini(struct sfc_adapter *sa, unsigned int sw_index)
 
 	txq = txq_info->txq;
 	SFC_ASSERT(txq != NULL);
-	SFC_ASSERT(txq->state == SFC_TXQ_INITIALIZED);
+	SFC_ASSERT(txq_info->state == SFC_TXQ_INITIALIZED);
 
 	sa->priv.dp_tx->qdestroy(txq->dp);
 	txq->dp = NULL;
@@ -426,7 +426,7 @@ sfc_tx_qstart(struct sfc_adapter *sa, unsigned int sw_index)
 	txq = txq_info->txq;
 
 	SFC_ASSERT(txq != NULL);
-	SFC_ASSERT(txq->state == SFC_TXQ_INITIALIZED);
+	SFC_ASSERT(txq_info->state == SFC_TXQ_INITIALIZED);
 
 	evq = txq->evq;
 
@@ -464,7 +464,7 @@ sfc_tx_qstart(struct sfc_adapter *sa, unsigned int sw_index)
 
 	efx_tx_qenable(txq->common);
 
-	txq->state |= SFC_TXQ_STARTED;
+	txq_info->state |= SFC_TXQ_STARTED;
 
 	rc = sa->priv.dp_tx->qstart(txq->dp, evq->read_ptr, desc_index);
 	if (rc != 0)
@@ -479,7 +479,7 @@ sfc_tx_qstart(struct sfc_adapter *sa, unsigned int sw_index)
 	return 0;
 
 fail_dp_qstart:
-	txq->state = SFC_TXQ_INITIALIZED;
+	txq_info->state = SFC_TXQ_INITIALIZED;
 	efx_tx_qdestroy(txq->common);
 
 fail_tx_qcreate:
@@ -506,10 +506,10 @@ sfc_tx_qstop(struct sfc_adapter *sa, unsigned int sw_index)
 
 	txq = txq_info->txq;
 
-	if (txq == NULL || txq->state == SFC_TXQ_INITIALIZED)
+	if (txq == NULL || txq_info->state == SFC_TXQ_INITIALIZED)
 		return;
 
-	SFC_ASSERT(txq->state & SFC_TXQ_STARTED);
+	SFC_ASSERT(txq_info->state & SFC_TXQ_STARTED);
 
 	sa->priv.dp_tx->qstop(txq->dp, &txq->evq->read_ptr);
 
@@ -518,12 +518,12 @@ sfc_tx_qstop(struct sfc_adapter *sa, unsigned int sw_index)
 	 * timeout; in the worst case it can delay for 6 seconds
 	 */
 	for (retry_count = 0;
-	     ((txq->state & SFC_TXQ_FLUSHED) == 0) &&
+	     ((txq_info->state & SFC_TXQ_FLUSHED) == 0) &&
 	     (retry_count < SFC_TX_QFLUSH_ATTEMPTS);
 	     ++retry_count) {
 		rc = efx_tx_qflush(txq->common);
 		if (rc != 0) {
-			txq->state |= (rc == EALREADY) ?
+			txq_info->state |= (rc == EALREADY) ?
 				SFC_TXQ_FLUSHED : SFC_TXQ_FLUSH_FAILED;
 			break;
 		}
@@ -538,19 +538,19 @@ sfc_tx_qstop(struct sfc_adapter *sa, unsigned int sw_index)
 		do {
 			rte_delay_ms(SFC_TX_QFLUSH_POLL_WAIT_MS);
 			sfc_ev_qpoll(txq->evq);
-		} while ((txq->state & SFC_TXQ_FLUSHING) &&
+		} while ((txq_info->state & SFC_TXQ_FLUSHING) &&
 			 wait_count++ < SFC_TX_QFLUSH_POLL_ATTEMPTS);
 
-		if (txq->state & SFC_TXQ_FLUSHING)
+		if (txq_info->state & SFC_TXQ_FLUSHING)
 			sfc_err(sa, "TxQ %u flush timed out", sw_index);
 
-		if (txq->state & SFC_TXQ_FLUSHED)
+		if (txq_info->state & SFC_TXQ_FLUSHED)
 			sfc_notice(sa, "TxQ %u flushed", sw_index);
 	}
 
 	sa->priv.dp_tx->qreap(txq->dp);
 
-	txq->state = SFC_TXQ_INITIALIZED;
+	txq_info->state = SFC_TXQ_INITIALIZED;
 
 	efx_tx_qdestroy(txq->common);
 
@@ -854,13 +854,12 @@ sfc_efx_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 	return pkts_sent;
 }
 
-struct sfc_txq *
-sfc_txq_by_dp_txq(const struct sfc_dp_txq *dp_txq)
+struct sfc_txq_info *
+sfc_txq_info_by_dp_txq(const struct sfc_dp_txq *dp_txq)
 {
 	const struct sfc_dp_queue *dpq = &dp_txq->dpq;
 	struct rte_eth_dev *eth_dev;
 	struct sfc_adapter *sa;
-	struct sfc_txq *txq;
 
 	SFC_ASSERT(rte_eth_dev_is_valid_port(dpq->port_id));
 	eth_dev = &rte_eth_devices[dpq->port_id];
@@ -868,10 +867,18 @@ sfc_txq_by_dp_txq(const struct sfc_dp_txq *dp_txq)
 	sa = eth_dev->data->dev_private;
 
 	SFC_ASSERT(dpq->queue_id < sa->txq_count);
-	txq = sa->txq_info[dpq->queue_id].txq;
+	return &sa->txq_info[dpq->queue_id];
+}
 
-	SFC_ASSERT(txq != NULL);
-	return txq;
+struct sfc_txq *
+sfc_txq_by_dp_txq(const struct sfc_dp_txq *dp_txq)
+{
+	struct sfc_txq_info *txq_info;
+
+	txq_info = sfc_txq_info_by_dp_txq(dp_txq);
+
+	SFC_ASSERT(txq_info->txq != NULL);
+	return txq_info->txq;
 }
 
 static sfc_dp_tx_qsize_up_rings_t sfc_efx_tx_qsize_up_rings;
diff --git a/drivers/net/sfc/sfc_tx.h b/drivers/net/sfc/sfc_tx.h
index efb486d32..c3edd3a58 100644
--- a/drivers/net/sfc/sfc_tx.h
+++ b/drivers/net/sfc/sfc_tx.h
@@ -51,7 +51,6 @@ enum sfc_txq_state_bit {
  * Allocated on the socket specified on the queue setup.
  */
 struct sfc_txq {
-	unsigned int			state;
 	unsigned int			hw_index;
 	struct sfc_evq			*evq;
 	efsys_mem_t			mem;
@@ -107,6 +106,7 @@ sfc_efx_txq_by_dp_txq(struct sfc_dp_txq *dp_txq)
 }
 
 struct sfc_txq_info {
+	unsigned int		state;
 	unsigned int		entries;
 	struct sfc_txq		*txq;
 	boolean_t		deferred_start;
@@ -115,6 +115,8 @@ struct sfc_txq_info {
 	uint64_t		offloads;
 };
 
+struct sfc_txq_info *sfc_txq_info_by_dp_txq(const struct sfc_dp_txq *dp_txq);
+
 int sfc_tx_configure(struct sfc_adapter *sa);
 void sfc_tx_close(struct sfc_adapter *sa);
 
@@ -123,7 +125,7 @@ int sfc_tx_qinit(struct sfc_adapter *sa, unsigned int sw_index,
 		 const struct rte_eth_txconf *tx_conf);
 void sfc_tx_qfini(struct sfc_adapter *sa, unsigned int sw_index);
 
-void sfc_tx_qflush_done(struct sfc_txq *txq);
+void sfc_tx_qflush_done(struct sfc_txq_info *txq_info);
 int sfc_tx_qstart(struct sfc_adapter *sa, unsigned int sw_index);
 void sfc_tx_qstop(struct sfc_adapter *sa, unsigned int sw_index);
 int sfc_tx_start(struct sfc_adapter *sa);
-- 
2.17.1

  parent reply	other threads:[~2019-02-07 12:18 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-07 12:17 [dpdk-dev] [PATCH 00/30] net/sfc: improve multi-process support Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 01/30] net/sfc: log port ID as 16-bit unsigned integer on panic Andrew Rybchenko
2019-02-08 10:13   ` Ferruh Yigit
2019-02-08 10:31     ` Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 02/30] net/sfc: remove control path logging from Rx queue count Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 03/30] net/sfc: fix logging from secondary process Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 04/30] net/sfc: avoid usage of RxQ control structure in info get Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 05/30] net/sfc: avoid usage of TxQ " Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 06/30] net/sfc: remove wrappers around Rx descriptor count and done Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 07/30] net/sfc: make it simpler to change datapath ops location Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 08/30] net/sfc: move datapath ops pointers to process private data Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 09/30] net/sfc: move main log type " Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 10/30] net/sfc: move RxQ state to multi-process shared location Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 11/30] net/sfc: move datapath RxQ handle to shared RxQ info Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 12/30] net/sfc: support Rx descriptor status in secondary process Andrew Rybchenko
2019-02-07 12:17 ` Andrew Rybchenko [this message]
2019-02-07 12:17 ` [dpdk-dev] [PATCH 14/30] net/sfc: move datapath TxQ handle to shared TxQ info Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 15/30] net/sfc: support Tx descriptor status in secondary process Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 16/30] net/sfc: support RSS RETA and hash config get in secondary Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 17/30] net/sfc: remove unnecessary functions to get RxQ index Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 18/30] net/sfc: remove unnecessary functions to get TxQ index Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 19/30] net/sfc: remove RxQ control from shared RxQ info Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 20/30] net/sfc: remove TxQ control from shared TxQ info Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 21/30] net/sfc: start to factor out multi-process shared data Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 22/30] net/sfc: move Rx/Tx datapath names to shared state Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 23/30] net/sfc: make main logging macro reusable in secondary Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 24/30] net/sfc: move RxQ shared information to adapter shared Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 25/30] net/sfc: move TxQ " Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 26/30] net/sfc: move RSS config " Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 27/30] net/sfc: move isolated flag in " Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 28/30] net/sfc: remove adapter locks from secondary process ops Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 29/30] net/sfc: separate adapter primary process and shared data Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 30/30] net/sfc: support Rx packet types get in secondary process Andrew Rybchenko
2019-02-07 15:08 ` [dpdk-dev] [PATCH 00/30] net/sfc: improve multi-process support 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=1549541873-17403-14-git-send-email-arybchenko@solarflare.com \
    --to=arybchenko@solarflare.com \
    --cc=dev@dpdk.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).