DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>,
	Ian Stokes <ian.stokes@intel.com>,
	Anatoly Burakov <anatoly.burakov@intel.com>
Subject: [RFC PATCH 10/21] common/intel_eth: pack Tx queue structure
Date: Fri, 22 Nov 2024 12:54:03 +0000	[thread overview]
Message-ID: <20241122125418.2857301-11-bruce.richardson@intel.com> (raw)
In-Reply-To: <20241122125418.2857301-1-bruce.richardson@intel.com>

Move some fields about to better pack the Tx queue structure and make
sure all data used by the vector codepaths is on the first cacheline of
the structure. Checking with "pahole" on 64-bit build, only one 6-byte
hole is left in the structure - on second cacheline - after this patch.

As part of the reordering, move the p/h/wthresh values to the
ixgbe-specific part of the union. That is the only driver which actually
uses those values. i40e and ice drivers just record the values for later
return, so we can drop them from the Tx queue structure for those
drivers and just report the defaults in all cases.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/common/intel_eth/ieth_rxtx.h | 12 +++++-------
 drivers/net/i40e/i40e_rxtx.c         |  9 +++------
 drivers/net/ice/ice_rxtx.c           |  9 +++------
 3 files changed, 11 insertions(+), 19 deletions(-)

diff --git a/drivers/common/intel_eth/ieth_rxtx.h b/drivers/common/intel_eth/ieth_rxtx.h
index 9f8a1d7141..c336ec81b3 100644
--- a/drivers/common/intel_eth/ieth_rxtx.h
+++ b/drivers/common/intel_eth/ieth_rxtx.h
@@ -42,7 +42,6 @@ struct ieth_tx_queue {
 		struct ieth_tx_entry *sw_ring; /* virtual address of SW ring */
 		struct ieth_vec_tx_entry *sw_ring_v;
 	};
-	rte_iova_t tx_ring_dma;        /* TX ring DMA address */
 	uint16_t nb_tx_desc;           /* number of TX descriptors */
 	uint16_t tx_tail; /* current value of tail register */
 	uint16_t nb_tx_used; /* number of TX desc used since RS bit set */
@@ -56,16 +55,14 @@ struct ieth_tx_queue {
 	uint16_t tx_free_thresh;
 	/* Number of TX descriptors to use before RS bit is set. */
 	uint16_t tx_rs_thresh;
-	uint8_t pthresh;   /**< Prefetch threshold register. */
-	uint8_t hthresh;   /**< Host threshold register. */
-	uint8_t wthresh;   /**< Write-back threshold reg. */
 	uint16_t port_id;  /* Device port identifier. */
 	uint16_t queue_id; /* TX queue index. */
 	uint16_t reg_idx;
-	uint64_t offloads;
 	uint16_t tx_next_dd;
 	uint16_t tx_next_rs;
+	uint64_t offloads;
 	uint64_t mbuf_errors;
+	rte_iova_t tx_ring_dma;        /* TX ring DMA address */
 	_Bool tx_deferred_start; /* don't start this queue in dev start */
 	_Bool q_set;             /* indicate if tx queue has been configured */
 	union {                  /* the VSI this queue belongs to */
@@ -97,9 +94,10 @@ struct ieth_tx_queue {
 			const struct ixgbe_txq_ops *ops;
 			struct ixgbe_advctx_info *ctx_cache;
 			uint32_t ctx_curr;
-#ifdef RTE_LIB_SECURITY
+			uint8_t pthresh;   /**< Prefetch threshold register. */
+			uint8_t hthresh;   /**< Host threshold register. */
+			uint8_t wthresh;   /**< Write-back threshold reg. */
 			uint8_t using_ipsec;  /**< indicates that IPsec TX feature is in use */
-#endif
 		};
 	};
 };
diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index fce3f5ec2a..29df978019 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -2539,9 +2539,6 @@ i40e_dev_tx_queue_setup(struct rte_eth_dev *dev,
 	txq->nb_tx_desc = nb_desc;
 	txq->tx_rs_thresh = tx_rs_thresh;
 	txq->tx_free_thresh = tx_free_thresh;
-	txq->pthresh = tx_conf->tx_thresh.pthresh;
-	txq->hthresh = tx_conf->tx_thresh.hthresh;
-	txq->wthresh = tx_conf->tx_thresh.wthresh;
 	txq->queue_id = queue_idx;
 	txq->reg_idx = reg_idx;
 	txq->port_id = dev->data->port_id;
@@ -3310,9 +3307,9 @@ i40e_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 
 	qinfo->nb_desc = txq->nb_tx_desc;
 
-	qinfo->conf.tx_thresh.pthresh = txq->pthresh;
-	qinfo->conf.tx_thresh.hthresh = txq->hthresh;
-	qinfo->conf.tx_thresh.wthresh = txq->wthresh;
+	qinfo->conf.tx_thresh.pthresh = I40E_DEFAULT_TX_PTHRESH;
+	qinfo->conf.tx_thresh.hthresh = I40E_DEFAULT_TX_HTHRESH;
+	qinfo->conf.tx_thresh.wthresh = I40E_DEFAULT_TX_WTHRESH;
 
 	qinfo->conf.tx_free_thresh = txq->tx_free_thresh;
 	qinfo->conf.tx_rs_thresh = txq->tx_rs_thresh;
diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c
index 20ebda68c7..9606ac7862 100644
--- a/drivers/net/ice/ice_rxtx.c
+++ b/drivers/net/ice/ice_rxtx.c
@@ -1492,9 +1492,6 @@ ice_tx_queue_setup(struct rte_eth_dev *dev,
 	txq->nb_tx_desc = nb_desc;
 	txq->tx_rs_thresh = tx_rs_thresh;
 	txq->tx_free_thresh = tx_free_thresh;
-	txq->pthresh = tx_conf->tx_thresh.pthresh;
-	txq->hthresh = tx_conf->tx_thresh.hthresh;
-	txq->wthresh = tx_conf->tx_thresh.wthresh;
 	txq->queue_id = queue_idx;
 
 	txq->reg_idx = vsi->base_queue + queue_idx;
@@ -1583,9 +1580,9 @@ ice_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 
 	qinfo->nb_desc = txq->nb_tx_desc;
 
-	qinfo->conf.tx_thresh.pthresh = txq->pthresh;
-	qinfo->conf.tx_thresh.hthresh = txq->hthresh;
-	qinfo->conf.tx_thresh.wthresh = txq->wthresh;
+	qinfo->conf.tx_thresh.pthresh = ICE_DEFAULT_TX_PTHRESH;
+	qinfo->conf.tx_thresh.hthresh = ICE_DEFAULT_TX_HTHRESH;
+	qinfo->conf.tx_thresh.wthresh = ICE_DEFAULT_TX_WTHRESH;
 
 	qinfo->conf.tx_free_thresh = txq->tx_free_thresh;
 	qinfo->conf.tx_rs_thresh = txq->tx_rs_thresh;
-- 
2.43.0


  parent reply	other threads:[~2024-11-22 12:56 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-22 12:53 [RFC PATCH 00/21] Reduce code duplication across Intel NIC drivers Bruce Richardson
2024-11-22 12:53 ` [RFC PATCH 01/21] common/intel_eth: add pkt reassembly fn for intel drivers Bruce Richardson
2024-11-22 12:53 ` [RFC PATCH 02/21] common/intel_eth: provide common Tx entry structures Bruce Richardson
2024-11-22 12:53 ` [RFC PATCH 03/21] common/intel_eth: add Tx mbuf ring replenish fn Bruce Richardson
2024-11-22 12:53 ` [RFC PATCH 04/21] drivers/net: align Tx queue struct field names Bruce Richardson
2024-11-22 12:53 ` [RFC PATCH 05/21] drivers/net: add prefix for driver-specific structs Bruce Richardson
2024-11-22 12:53 ` [RFC PATCH 06/21] common/intel_eth: merge ice and i40e Tx queue struct Bruce Richardson
2024-11-22 12:54 ` [RFC PATCH 07/21] net/iavf: use common Tx queue structure Bruce Richardson
2024-11-22 12:54 ` [RFC PATCH 08/21] net/ixgbe: convert Tx queue context cache field to ptr Bruce Richardson
2024-11-22 12:54 ` [RFC PATCH 09/21] net/ixgbe: use common Tx queue structure Bruce Richardson
2024-11-22 12:54 ` Bruce Richardson [this message]
2024-11-22 12:54 ` [RFC PATCH 11/21] common/intel_eth: add post-Tx buffer free function Bruce Richardson
2024-11-22 12:54 ` [RFC PATCH 12/21] common/intel_eth: add Tx buffer free fn for AVX-512 Bruce Richardson
2024-11-22 12:54 ` [RFC PATCH 13/21] net/iavf: use common Tx " Bruce Richardson
2024-11-22 12:54 ` [RFC PATCH 14/21] net/ice: move Tx queue mbuf cleanup fn to common Bruce Richardson
2024-11-22 12:54 ` [RFC PATCH 15/21] net/i40e: use common Tx queue mbuf cleanup fn Bruce Richardson
2024-11-22 12:54 ` [RFC PATCH 16/21] net/ixgbe: " Bruce Richardson
2024-11-22 12:54 ` [RFC PATCH 17/21] net/iavf: " Bruce Richardson
2024-11-22 12:54 ` [RFC PATCH 18/21] net/ice: use vector SW ring for all vector paths Bruce Richardson
2024-11-22 12:54 ` [RFC PATCH 19/21] net/i40e: " Bruce Richardson
2024-11-22 12:54 ` [RFC PATCH 20/21] net/iavf: " Bruce Richardson
2024-11-22 12:54 ` [RFC PATCH 21/21] net/ixgbe: use common Tx backlog entry fn Bruce Richardson

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=20241122125418.2857301-11-bruce.richardson@intel.com \
    --to=bruce.richardson@intel.com \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=ian.stokes@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).