[dpdk-dev] [PATCH 14/30] net/sfc: move datapath TxQ handle to shared TxQ info

Andrew Rybchenko arybchenko at solarflare.com
Thu Feb 7 13:17:37 CET 2019


If datapath supports multi-process, it should be possible to get
its TxQ structure by the queue index.

Signed-off-by: Andrew Rybchenko <arybchenko at solarflare.com>
---
 drivers/net/sfc/sfc_ethdev.c |  2 +-
 drivers/net/sfc/sfc_tx.c     | 14 +++++++-------
 drivers/net/sfc/sfc_tx.h     |  2 +-
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 5bc73d512..80a1d7a3d 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -468,7 +468,7 @@ sfc_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,
 	if (rc != 0)
 		goto fail_tx_qinit;
 
-	dev->data->tx_queues[tx_queue_id] = sa->txq_info[tx_queue_id].txq->dp;
+	dev->data->tx_queues[tx_queue_id] = sa->txq_info[tx_queue_id].dp;
 
 	sfc_adapter_unlock(sa);
 	return 0;
diff --git a/drivers/net/sfc/sfc_tx.c b/drivers/net/sfc/sfc_tx.c
index f4fbffe0a..1ee4e78a1 100644
--- a/drivers/net/sfc/sfc_tx.c
+++ b/drivers/net/sfc/sfc_tx.c
@@ -195,11 +195,11 @@ sfc_tx_qinit(struct sfc_adapter *sa, unsigned int sw_index,
 
 	rc = sa->priv.dp_tx->qcreate(sa->eth_dev->data->port_id, sw_index,
 				     &RTE_ETH_DEV_TO_PCI(sa->eth_dev)->addr,
-				     socket_id, &info, &txq->dp);
+				     socket_id, &info, &txq_info->dp);
 	if (rc != 0)
 		goto fail_dp_tx_qinit;
 
-	evq->dp_txq = txq->dp;
+	evq->dp_txq = txq_info->dp;
 
 	txq_info->state = SFC_TXQ_INITIALIZED;
 
@@ -243,8 +243,8 @@ sfc_tx_qfini(struct sfc_adapter *sa, unsigned int sw_index)
 	SFC_ASSERT(txq != NULL);
 	SFC_ASSERT(txq_info->state == SFC_TXQ_INITIALIZED);
 
-	sa->priv.dp_tx->qdestroy(txq->dp);
-	txq->dp = NULL;
+	sa->priv.dp_tx->qdestroy(txq_info->dp);
+	txq_info->dp = NULL;
 
 	txq_info->txq = NULL;
 	txq_info->entries = 0;
@@ -466,7 +466,7 @@ sfc_tx_qstart(struct sfc_adapter *sa, unsigned int sw_index)
 
 	txq_info->state |= SFC_TXQ_STARTED;
 
-	rc = sa->priv.dp_tx->qstart(txq->dp, evq->read_ptr, desc_index);
+	rc = sa->priv.dp_tx->qstart(txq_info->dp, evq->read_ptr, desc_index);
 	if (rc != 0)
 		goto fail_dp_qstart;
 
@@ -511,7 +511,7 @@ sfc_tx_qstop(struct sfc_adapter *sa, unsigned int sw_index)
 
 	SFC_ASSERT(txq_info->state & SFC_TXQ_STARTED);
 
-	sa->priv.dp_tx->qstop(txq->dp, &txq->evq->read_ptr);
+	sa->priv.dp_tx->qstop(txq_info->dp, &txq->evq->read_ptr);
 
 	/*
 	 * Retry TX queue flushing in case of flush failed or
@@ -548,7 +548,7 @@ sfc_tx_qstop(struct sfc_adapter *sa, unsigned int sw_index)
 			sfc_notice(sa, "TxQ %u flushed", sw_index);
 	}
 
-	sa->priv.dp_tx->qreap(txq->dp);
+	sa->priv.dp_tx->qreap(txq_info->dp);
 
 	txq_info->state = SFC_TXQ_INITIALIZED;
 
diff --git a/drivers/net/sfc/sfc_tx.h b/drivers/net/sfc/sfc_tx.h
index c3edd3a58..e5ea6df75 100644
--- a/drivers/net/sfc/sfc_tx.h
+++ b/drivers/net/sfc/sfc_tx.h
@@ -54,7 +54,6 @@ struct sfc_txq {
 	unsigned int			hw_index;
 	struct sfc_evq			*evq;
 	efsys_mem_t			mem;
-	struct sfc_dp_txq		*dp;
 	efx_txq_t			*common;
 };
 
@@ -109,6 +108,7 @@ struct sfc_txq_info {
 	unsigned int		state;
 	unsigned int		entries;
 	struct sfc_txq		*txq;
+	struct sfc_dp_txq	*dp;
 	boolean_t		deferred_start;
 	boolean_t		deferred_started;
 	unsigned int		free_thresh;
-- 
2.17.1



More information about the dev mailing list