[4/8] net/nfp: modify the txq struct

Message ID 20230519025950.1642943-5-chaoyong.he@corigine.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series make the logic conform the coding style of DPDK |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Chaoyong He May 19, 2023, 2:59 a.m. UTC
  Modify the struct nfp_net_txq, remove the unused fields,
change the type of some fields and make the comment message
more suitable.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
 drivers/net/nfp/flower/nfp_flower.c           |  7 +--
 .../net/nfp/flower/nfp_flower_representor.c   |  3 -
 drivers/net/nfp/nfd3/nfp_nfd3_dp.c            |  7 +--
 drivers/net/nfp/nfdk/nfp_nfdk_dp.c            |  7 +--
 drivers/net/nfp/nfp_rxtx.c                    |  4 +-
 drivers/net/nfp/nfp_rxtx.h                    | 63 ++++++++-----------
 6 files changed, 35 insertions(+), 56 deletions(-)
  

Patch

diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c
index 8847849adc..9a08ae3b75 100644
--- a/drivers/net/nfp/flower/nfp_flower.c
+++ b/drivers/net/nfp/flower/nfp_flower.c
@@ -508,7 +508,7 @@  nfp_flower_pf_xmit_pkts(void *tx_queue,
 	hw = txq->hw;
 	txds = &txq->txds[txq->wr_p];
 
-	PMD_TX_LOG(DEBUG, "working for queue %d at pos %u and %u packets",
+	PMD_TX_LOG(DEBUG, "working for queue %hu at pos %u and %hu packets",
 			txq->qidx, txq->wr_p, nb_pkts);
 
 	if ((nfp_net_nfd3_free_tx_desc(txq) < nb_pkts) || (nfp_net_nfd3_txq_full(txq)))
@@ -685,7 +685,7 @@  nfp_flower_init_vnic_common(struct nfp_net_hw *hw, const char *vnic_type)
 static int
 nfp_flower_init_ctrl_vnic(struct nfp_net_hw *hw)
 {
-	uint32_t i;
+	uint16_t i;
 	int ret = 0;
 	uint16_t n_txq;
 	uint16_t n_rxq;
@@ -869,9 +869,6 @@  nfp_flower_init_ctrl_vnic(struct nfp_net_hw *hw)
 
 		txq->tx_count = CTRL_VNIC_NB_DESC;
 		txq->tx_free_thresh = DEFAULT_RX_FREE_THRESH;
-		txq->tx_pthresh = DEFAULT_TX_PTHRESH;
-		txq->tx_hthresh = DEFAULT_TX_HTHRESH;
-		txq->tx_wthresh = DEFAULT_TX_WTHRESH;
 
 		/* Queue mapping based on firmware configuration */
 		txq->qidx = i;
diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c
index 94a04e6235..0479eb4792 100644
--- a/drivers/net/nfp/flower/nfp_flower_representor.c
+++ b/drivers/net/nfp/flower/nfp_flower_representor.c
@@ -151,9 +151,6 @@  nfp_pf_repr_tx_queue_setup(struct rte_eth_dev *dev,
 
 	txq->tx_count = nb_desc;
 	txq->tx_free_thresh = tx_free_thresh;
-	txq->tx_pthresh = tx_conf->tx_thresh.pthresh;
-	txq->tx_hthresh = tx_conf->tx_thresh.hthresh;
-	txq->tx_wthresh = tx_conf->tx_thresh.wthresh;
 
 	/* queue mapping based on firmware configuration */
 	txq->qidx = queue_idx;
diff --git a/drivers/net/nfp/nfd3/nfp_nfd3_dp.c b/drivers/net/nfp/nfd3/nfp_nfd3_dp.c
index 909156d69c..1a960fbe63 100644
--- a/drivers/net/nfp/nfd3/nfp_nfd3_dp.c
+++ b/drivers/net/nfp/nfd3/nfp_nfd3_dp.c
@@ -112,7 +112,7 @@  nfp_net_nfd3_xmit_pkts(void *tx_queue,
 	hw = txq->hw;
 	txds = &txq->txds[txq->wr_p];
 
-	PMD_TX_LOG(DEBUG, "working for queue %u at pos %d and %u packets",
+	PMD_TX_LOG(DEBUG, "working for queue %hu at pos %d and %hu packets",
 			txq->qidx, txq->wr_p, nb_pkts);
 
 	if (nfp_net_nfd3_free_tx_desc(txq) < NFD3_TX_DESC_PER_PKT * nb_pkts ||
@@ -126,7 +126,7 @@  nfp_net_nfd3_xmit_pkts(void *tx_queue,
 	pkt = *tx_pkts;
 
 	issued_descs = 0;
-	PMD_TX_LOG(DEBUG, "queue: %u. Sending %u packets", txq->qidx, nb_pkts);
+	PMD_TX_LOG(DEBUG, "queue: %hu. Sending %hu packets", txq->qidx, nb_pkts);
 
 	/* Sending packets */
 	for (i = 0; i < nb_pkts && free_descs > 0; i++) {
@@ -304,9 +304,6 @@  nfp_net_nfd3_tx_queue_setup(struct rte_eth_dev *dev,
 
 	txq->tx_count = nb_desc * NFD3_TX_DESC_PER_PKT;
 	txq->tx_free_thresh = tx_free_thresh;
-	txq->tx_pthresh = tx_conf->tx_thresh.pthresh;
-	txq->tx_hthresh = tx_conf->tx_thresh.hthresh;
-	txq->tx_wthresh = tx_conf->tx_thresh.wthresh;
 
 	/* queue mapping based on firmware configuration */
 	txq->qidx = queue_idx;
diff --git a/drivers/net/nfp/nfdk/nfp_nfdk_dp.c b/drivers/net/nfp/nfdk/nfp_nfdk_dp.c
index 12233393fc..b35aa9a610 100644
--- a/drivers/net/nfp/nfdk/nfp_nfdk_dp.c
+++ b/drivers/net/nfp/nfdk/nfp_nfdk_dp.c
@@ -164,7 +164,7 @@  nfp_net_nfdk_xmit_pkts(void *tx_queue,
 	txq = tx_queue;
 	hw = txq->hw;
 
-	PMD_TX_LOG(DEBUG, "working for queue %u at pos %d and %u packets",
+	PMD_TX_LOG(DEBUG, "working for queue %hu at pos %d and %hu packets",
 			txq->qidx, txq->wr_p, nb_pkts);
 
 	if (nfp_net_nfdk_free_tx_desc(txq) < NFDK_TX_DESC_PER_SIMPLE_PKT * nb_pkts ||
@@ -175,7 +175,7 @@  nfp_net_nfdk_xmit_pkts(void *tx_queue,
 	if (unlikely(free_descs == 0))
 		return 0;
 
-	PMD_TX_LOG(DEBUG, "queue: %u. Sending %u packets", txq->qidx, nb_pkts);
+	PMD_TX_LOG(DEBUG, "queue: %hu. Sending %hu packets", txq->qidx, nb_pkts);
 
 	/* Sending packets */
 	while (npkts < nb_pkts && free_descs > 0) {
@@ -398,9 +398,6 @@  nfp_net_nfdk_tx_queue_setup(struct rte_eth_dev *dev,
 
 	txq->tx_count = nb_desc * NFDK_TX_DESC_PER_SIMPLE_PKT;
 	txq->tx_free_thresh = tx_free_thresh;
-	txq->tx_pthresh = tx_conf->tx_thresh.pthresh;
-	txq->tx_hthresh = tx_conf->tx_thresh.hthresh;
-	txq->tx_wthresh = tx_conf->tx_thresh.wthresh;
 
 	/* queue mapping based on firmware configuration */
 	txq->qidx = queue_idx;
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index b34a9b9374..8283953702 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -679,14 +679,14 @@  nfp_net_tx_free_bufs(struct nfp_net_txq *txq)
 	uint32_t qcp_rd_p;
 	int todo;
 
-	PMD_TX_LOG(DEBUG, "queue %u. Check for descriptor with a complete"
+	PMD_TX_LOG(DEBUG, "queue %hu. Check for descriptor with a complete"
 		   " status", txq->qidx);
 
 	/* Work out how many packets have been sent */
 	qcp_rd_p = nfp_qcp_read(txq->qcp_q, NFP_QCP_READ_PTR);
 
 	if (qcp_rd_p == txq->rd_p) {
-		PMD_TX_LOG(DEBUG, "queue %u: It seems harrier is not sending "
+		PMD_TX_LOG(DEBUG, "queue %hu: It seems harrier is not sending "
 			   "packets (%u, %u)", txq->qidx,
 			   qcp_rd_p, txq->rd_p);
 		return 0;
diff --git a/drivers/net/nfp/nfp_rxtx.h b/drivers/net/nfp/nfp_rxtx.h
index 83dc9960e8..4a310c0083 100644
--- a/drivers/net/nfp/nfp_rxtx.h
+++ b/drivers/net/nfp/nfp_rxtx.h
@@ -14,7 +14,6 @@ 
 #ifndef _NFP_RXTX_H_
 #define _NFP_RXTX_H_
 
-#include <linux/types.h>
 #include <rte_io.h>
 
 #define NFP_DESC_META_LEN(d) ((d)->rxd.meta_len_dd & PCIE_DESC_RX_META_LEN_MASK)
@@ -103,63 +102,55 @@  struct nfp_net_dp_buf {
 };
 
 struct nfp_net_txq {
-	struct nfp_net_hw *hw; /* Backpointer to nfp_net structure */
-
-	/*
-	 * Queue information: @qidx is the queue index from Linux's
-	 * perspective.  @tx_qcidx is the index of the Queue
-	 * Controller Peripheral queue relative to the TX queue BAR.
-	 * @cnt is the size of the queue in number of
-	 * descriptors. @qcp_q is a pointer to the base of the queue
-	 * structure on the NFP
-	 */
+	/** 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;
 
-	/*
-	 * Read and Write pointers.  @wr_p and @rd_p are host side pointer,
-	 * they are free running and have little relation to the QCP pointers *
-	 * @qcp_rd_p is a local copy queue controller peripheral read pointer
+	/**
+	 * 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.
 	 */
 	struct nfp_net_dp_buf *txbufs;
 
-	/*
-	 * Information about the host side queue location. @txds is
-	 * the virtual address for the queue, @dma is the DMA address
-	 * of the queue and @size is the size in bytes for the queue
-	 * (needed for free)
+	/**
+	 * Information about the host side queue location.
+	 * It is the virtual address for the queue.
 	 */
 	union {
 		struct nfp_net_nfd3_tx_desc *txds;
 		struct nfp_net_nfdk_tx_desc *ktxds;
 	};
 
-	/*
-	 * At this point 48 bytes have been used for all the fields in the
-	 * TX critical path. We have room for 8 bytes and still all placed
-	 * in a cache line. We are not using the threshold values below but
-	 * if we need to, we can add the most used in the remaining bytes.
-	 */
-	uint32_t tx_rs_thresh; /* not used by now. Future? */
-	uint32_t tx_pthresh;   /* not used by now. Future? */
-	uint32_t tx_hthresh;   /* not used by now. Future? */
-	uint32_t tx_wthresh;   /* not used by now. Future? */
+	/** The index of the QCP queue relative to the TX queue BAR. */
+	uint32_t tx_qcidx;
+
+	/** The queue index from Linux's perspective. */
+	uint16_t qidx;
 	uint16_t port_id;
-	uint16_t data_pending; /* used by nfdk only */
-	int qidx;
-	int tx_qcidx;
-	__le64 dma;
+
+	/** Used by NFDk only */
+	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
+	 * in a cache line.
+	 */
+	uint64_t dma;
 } __rte_aligned(64);
 
 /* RX and freelist descriptor format */