Patchwork [dpdk-dev,05/30] net/sfc: avoid usage of TxQ control structure in info get

login
register
mail settings
Submitter Andrew Rybchenko
Date Feb. 7, 2019, 12:17 p.m.
Message ID <1549541873-17403-6-git-send-email-arybchenko@solarflare.com>
Download mbox | patch
Permalink /patch/720401/
State New
Headers show

Comments

Andrew Rybchenko - Feb. 7, 2019, 12:17 p.m.
TxQ control structure contains primary process only data and will become
primary process only. TxQ info get is supported in secondary process.

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

Patch

diff --git a/drivers/net/sfc/sfc.c b/drivers/net/sfc/sfc.c
index 0d7311d68..bead373ea 100644
--- a/drivers/net/sfc/sfc.c
+++ b/drivers/net/sfc/sfc.c
@@ -281,7 +281,7 @@  sfc_set_fw_subvariant(struct sfc_adapter *sa)
 		struct sfc_txq_info *txq_info = &sa->txq_info[txq_index];
 
 		if (txq_info->txq != NULL)
-			tx_offloads |= txq_info->txq->offloads;
+			tx_offloads |= txq_info->offloads;
 	}
 
 	if (tx_offloads & (DEV_TX_OFFLOAD_IPV4_CKSUM |
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index da697c134..87a2c9431 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -1104,12 +1104,11 @@  sfc_tx_queue_info_get(struct rte_eth_dev *dev, uint16_t tx_queue_id,
 	SFC_ASSERT(tx_queue_id < sa->txq_count);
 
 	txq_info = &sa->txq_info[tx_queue_id];
-	SFC_ASSERT(txq_info->txq != NULL);
 
 	memset(qinfo, 0, sizeof(*qinfo));
 
-	qinfo->conf.offloads = txq_info->txq->offloads;
-	qinfo->conf.tx_free_thresh = txq_info->txq->free_thresh;
+	qinfo->conf.offloads = txq_info->offloads;
+	qinfo->conf.tx_free_thresh = txq_info->free_thresh;
 	qinfo->conf.tx_deferred_start = txq_info->deferred_start;
 	qinfo->nb_desc = txq_info->entries;
 
diff --git a/drivers/net/sfc/sfc_tx.c b/drivers/net/sfc/sfc_tx.c
index aa73d2642..c3b089fd8 100644
--- a/drivers/net/sfc/sfc_tx.c
+++ b/drivers/net/sfc/sfc_tx.c
@@ -168,10 +168,10 @@  sfc_tx_qinit(struct sfc_adapter *sa, unsigned int sw_index,
 
 	txq->hw_index = sw_index;
 	txq->evq = evq;
-	txq->free_thresh =
+	txq_info->free_thresh =
 		(tx_conf->tx_free_thresh) ? tx_conf->tx_free_thresh :
 		SFC_TX_DEFAULT_FREE_THRESH;
-	txq->offloads = offloads;
+	txq_info->offloads = offloads;
 
 	rc = sfc_dma_alloc(sa, "txq", sw_index, EFX_TXQ_SIZE(txq_info->entries),
 			   socket_id, &txq->mem);
@@ -180,7 +180,7 @@  sfc_tx_qinit(struct sfc_adapter *sa, unsigned int sw_index,
 
 	memset(&info, 0, sizeof(info));
 	info.max_fill_level = txq_max_fill_level;
-	info.free_thresh = txq->free_thresh;
+	info.free_thresh = txq_info->free_thresh;
 	info.offloads = offloads;
 	info.txq_entries = txq_info->entries;
 	info.dma_desc_size_max = encp->enc_tx_dma_desc_size_max;
@@ -434,21 +434,21 @@  sfc_tx_qstart(struct sfc_adapter *sa, unsigned int sw_index)
 	if (rc != 0)
 		goto fail_ev_qstart;
 
-	if (txq->offloads & DEV_TX_OFFLOAD_IPV4_CKSUM)
+	if (txq_info->offloads & DEV_TX_OFFLOAD_IPV4_CKSUM)
 		flags |= EFX_TXQ_CKSUM_IPV4;
 
-	if (txq->offloads & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM)
+	if (txq_info->offloads & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM)
 		flags |= EFX_TXQ_CKSUM_INNER_IPV4;
 
-	if ((txq->offloads & DEV_TX_OFFLOAD_TCP_CKSUM) ||
-	    (txq->offloads & DEV_TX_OFFLOAD_UDP_CKSUM)) {
+	if ((txq_info->offloads & DEV_TX_OFFLOAD_TCP_CKSUM) ||
+	    (txq_info->offloads & DEV_TX_OFFLOAD_UDP_CKSUM)) {
 		flags |= EFX_TXQ_CKSUM_TCPUDP;
 
 		if (offloads_supported & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM)
 			flags |= EFX_TXQ_CKSUM_INNER_TCPUDP;
 	}
 
-	if (txq->offloads & DEV_TX_OFFLOAD_TCP_TSO)
+	if (txq_info->offloads & DEV_TX_OFFLOAD_TCP_TSO)
 		flags |= EFX_TXQ_FATSOV2;
 
 	rc = efx_tx_qcreate(sa->nic, txq->hw_index, 0, &txq->mem,
diff --git a/drivers/net/sfc/sfc_tx.h b/drivers/net/sfc/sfc_tx.h
index 146b805ca..efb486d32 100644
--- a/drivers/net/sfc/sfc_tx.h
+++ b/drivers/net/sfc/sfc_tx.h
@@ -57,8 +57,6 @@  struct sfc_txq {
 	efsys_mem_t			mem;
 	struct sfc_dp_txq		*dp;
 	efx_txq_t			*common;
-	unsigned int			free_thresh;
-	uint64_t			offloads;
 };
 
 static inline unsigned int
@@ -113,6 +111,8 @@  struct sfc_txq_info {
 	struct sfc_txq		*txq;
 	boolean_t		deferred_start;
 	boolean_t		deferred_started;
+	unsigned int		free_thresh;
+	uint64_t		offloads;
 };
 
 int sfc_tx_configure(struct sfc_adapter *sa);