[v2,3/8] net/nfp: adjust the data field of Rx/Tx queue

Message ID 20240419052349.1294696-4-chaoyong.he@corigine.com (mailing list archive)
State Accepted
Delegated to: Ferruh Yigit
Headers
Series [v2,1/8] net/nfp: fix resource leak of secondary process |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Chaoyong He April 19, 2024, 5:23 a.m. UTC
  Adjust the data field of Rx/Tx queue structure, move the cold data back
and hold position for hot data.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
 drivers/net/nfp/nfp_rxtx.h | 71 +++++++++++++++++++-------------------
 1 file changed, 36 insertions(+), 35 deletions(-)
  

Patch

diff --git a/drivers/net/nfp/nfp_rxtx.h b/drivers/net/nfp/nfp_rxtx.h
index f463b9cf75..0aa73a6432 100644
--- a/drivers/net/nfp/nfp_rxtx.h
+++ b/drivers/net/nfp/nfp_rxtx.h
@@ -31,21 +31,6 @@  struct nfp_net_txq {
 	/** Backpointer to nfp_net structure */
 	struct nfp_net_hw *hw;
 
-	/** Point to the base of the queue structure on the NFP. */
-	uint8_t *qcp_q;
-
-	/**
-	 * Host side read and write pointer, they are free running and
-	 * have little relation to the QCP pointers.
-	 */
-	uint32_t wr_p;
-	uint32_t rd_p;
-
-	/** The size of the queue in number of descriptors. */
-	uint32_t tx_count;
-
-	uint32_t tx_free_thresh;
-
 	/**
 	 * For each descriptor keep a reference to the mbuf and
 	 * DMA address used until completion is signalled.
@@ -61,6 +46,18 @@  struct nfp_net_txq {
 		struct nfp_net_nfdk_tx_desc *ktxds;
 	};
 
+	/**
+	 * Host side read and write pointer, they are free running and
+	 * have little relation to the QCP pointers.
+	 */
+	uint32_t wr_p;
+	uint32_t rd_p;
+
+	/** The size of the queue in number of descriptors. */
+	uint32_t tx_count;
+
+	uint32_t tx_free_thresh;
+
 	/** The index of the QCP queue relative to the TX queue BAR. */
 	uint32_t tx_qcidx;
 
@@ -72,8 +69,8 @@  struct nfp_net_txq {
 	uint16_t data_pending;
 
 	/**
-	 * At this point 58 bytes have been used for all the fields in the
-	 * TX critical path. We have room for 6 bytes and still all placed
+	 * At this point 50 bytes have been used for all the fields in the
+	 * TX critical path. We have room for 14 bytes and still all placed
 	 * in a cache line.
 	 */
 	uint64_t dma;
@@ -83,6 +80,9 @@  struct nfp_net_txq {
 
 	/** TX pointer ring write back area DMA address */
 	uint64_t txrwb_dma;
+
+	/** Point to the base of the queue structure on the NFP. */
+	uint8_t *qcp_q;
 } __rte_aligned(64);
 
 /* RX and freelist descriptor format */
@@ -145,19 +145,6 @@  struct nfp_net_rxq {
 	 */
 	uint8_t *qcp_fl;
 
-	/**
-	 * Host side read pointer, free running and have little relation
-	 * to the QCP pointers. It is where the driver start reading
-	 * descriptors for newly arrive packets from.
-	 */
-	uint32_t rd_p;
-
-	/**
-	 * The index of the QCP queue relative to the RX queue BAR
-	 * used for the freelist.
-	 */
-	uint32_t fl_qcidx;
-
 	/**
 	 * For each buffer placed on the freelist, record the
 	 * associated mbuf.
@@ -177,6 +164,14 @@  struct nfp_net_rxq {
 	 * safely copied to the mbuf using the NFP_NET_RX_OFFSET.
 	 */
 	struct rte_mempool *mem_pool;
+
+	/**
+	 * Host side read pointer, free running and have little relation
+	 * to the QCP pointers. It is where the driver start reading
+	 * descriptors for newly arrive packets from.
+	 */
+	uint32_t rd_p;
+
 	uint16_t mbuf_size;
 
 	/**
@@ -186,9 +181,6 @@  struct nfp_net_rxq {
 	uint16_t rx_free_thresh;
 	uint16_t nb_rx_hold;
 
-	 /** The size of the queue in number of descriptors */
-	uint16_t rx_count;
-
 	/** Referencing dev->data->port_id */
 	uint16_t port_id;
 
@@ -196,11 +188,20 @@  struct nfp_net_rxq {
 	uint16_t qidx;
 
 	/**
-	 * At this point 60 bytes have been used for all the fields in the
-	 * RX critical path. We have room for 4 bytes and still all placed
+	 * At this point 54 bytes have been used for all the fields in the
+	 * RX critical path. We have room for 10 bytes and still all placed
 	 * in a cache line.
 	 */
 
+	/** The size of the queue in number of descriptors */
+	uint16_t rx_count;
+
+	/**
+	 * The index of the QCP queue relative to the RX queue BAR
+	 * used for the freelist.
+	 */
+	uint32_t fl_qcidx;
+
 	/** DMA address of the queue */
 	uint64_t dma;
 } __rte_aligned(64);