DPDK patches and discussions
 help / color / mirror / Atom feed
From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com,
	Chaoyong He <chaoyong.he@corigine.com>
Subject: [PATCH 4/8] net/nfp: modify the txq struct
Date: Fri, 19 May 2023 10:59:46 +0800	[thread overview]
Message-ID: <20230519025950.1642943-5-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20230519025950.1642943-1-chaoyong.he@corigine.com>

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(-)

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 */
-- 
2.39.1


  parent reply	other threads:[~2023-05-19  3:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-19  2:59 [PATCH 0/8] make the logic conform the coding style of DPDK Chaoyong He
2023-05-19  2:59 ` [PATCH 1/8] net/nfp: reuse the ring buffer struct Chaoyong He
2023-05-19  2:59 ` [PATCH 2/8] net/nfp: modify the rxq struct Chaoyong He
2023-05-19  2:59 ` [PATCH 3/8] net/nfp: modify the Rx descriptor struct Chaoyong He
2023-05-19  2:59 ` Chaoyong He [this message]
2023-05-19  2:59 ` [PATCH 5/8] net/nfp: remove the custom round macro Chaoyong He
2023-05-19  2:59 ` [PATCH 6/8] net/nfp: remove the unneeded comment Chaoyong He
2023-05-19  2:59 ` [PATCH 7/8] net/nfp: revise cast from void pointer Chaoyong He
2023-05-19  2:59 ` [PATCH 8/8] net/nfp: revise the logic of MAC address Chaoyong He
2023-05-19 13:55 ` [PATCH 0/8] make the logic conform the coding style of DPDK Ferruh Yigit

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=20230519025950.1642943-5-chaoyong.he@corigine.com \
    --to=chaoyong.he@corigine.com \
    --cc=dev@dpdk.org \
    --cc=niklas.soderlund@corigine.com \
    --cc=oss-drivers@corigine.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).