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 1/8] net/nfp: reuse the ring buffer struct
Date: Fri, 19 May 2023 10:59:43 +0800	[thread overview]
Message-ID: <20230519025950.1642943-2-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20230519025950.1642943-1-chaoyong.he@corigine.com>

Reuse the ring buffer struct, make the code more readable.

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      |  2 +-
 drivers/net/nfp/flower/nfp_flower_ctrl.c |  2 +-
 drivers/net/nfp/nfp_rxtx.c               |  4 ++--
 drivers/net/nfp/nfp_rxtx.h               | 14 ++++++--------
 4 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c
index 159f88f5ae..4d60660a77 100644
--- a/drivers/net/nfp/flower/nfp_flower.c
+++ b/drivers/net/nfp/flower/nfp_flower.c
@@ -320,7 +320,7 @@ nfp_flower_pf_recv_pkts(void *rx_queue,
 	struct nfp_net_hw *hw;
 	struct rte_mbuf *new_mb;
 	struct nfp_net_rxq *rxq;
-	struct nfp_net_rx_buff *rxb;
+	struct nfp_net_dp_buf *rxb;
 	struct nfp_net_rx_desc *rxds;
 	struct nfp_flower_representor *repr;
 
diff --git a/drivers/net/nfp/flower/nfp_flower_ctrl.c b/drivers/net/nfp/flower/nfp_flower_ctrl.c
index 937829c23c..1855e73c14 100644
--- a/drivers/net/nfp/flower/nfp_flower_ctrl.c
+++ b/drivers/net/nfp/flower/nfp_flower_ctrl.c
@@ -30,7 +30,7 @@ nfp_flower_ctrl_vnic_recv(void *rx_queue,
 	struct nfp_net_hw *hw;
 	struct nfp_net_rxq *rxq;
 	struct rte_mbuf *new_mb;
-	struct nfp_net_rx_buff *rxb;
+	struct nfp_net_dp_buf *rxb;
 	struct nfp_net_rx_desc *rxds;
 
 	rxq = rx_queue;
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index 9eaa0b89c1..190498abc7 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -28,7 +28,7 @@
 static int
 nfp_net_rx_fill_freelist(struct nfp_net_rxq *rxq)
 {
-	struct nfp_net_rx_buff *rxe = rxq->rxbufs;
+	struct nfp_net_dp_buf *rxe = rxq->rxbufs;
 	uint64_t dma_addr;
 	unsigned int i;
 
@@ -371,7 +371,7 @@ nfp_net_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 {
 	struct nfp_net_rxq *rxq;
 	struct nfp_net_rx_desc *rxds;
-	struct nfp_net_rx_buff *rxb;
+	struct nfp_net_dp_buf *rxb;
 	struct nfp_net_hw *hw;
 	struct rte_mbuf *mb;
 	struct rte_mbuf *new_mb;
diff --git a/drivers/net/nfp/nfp_rxtx.h b/drivers/net/nfp/nfp_rxtx.h
index 4d0c88529b..235f083dcf 100644
--- a/drivers/net/nfp/nfp_rxtx.h
+++ b/drivers/net/nfp/nfp_rxtx.h
@@ -98,6 +98,10 @@ struct nfp_meta_parsed {
 
 #define DIV_ROUND_UP(n, d)             (((n) + (d) - 1) / (d))
 
+struct nfp_net_dp_buf {
+	struct rte_mbuf *mbuf;
+};
+
 struct nfp_net_txq {
 	struct nfp_net_hw *hw; /* Backpointer to nfp_net structure */
 
@@ -128,9 +132,7 @@ struct nfp_net_txq {
 	 * For each descriptor keep a reference to the mbuf and
 	 * DMA address used until completion is signalled.
 	 */
-	struct {
-		struct rte_mbuf *mbuf;
-	} *txbufs;
+	struct nfp_net_dp_buf *txbufs;
 
 	/*
 	 * Information about the host side queue location. @txds is
@@ -210,10 +212,6 @@ struct nfp_net_rx_desc {
 	};
 };
 
-struct nfp_net_rx_buff {
-	struct rte_mbuf *mbuf;
-};
-
 struct nfp_net_rxq {
 	struct nfp_net_hw *hw;	/* Backpointer to nfp_net structure */
 
@@ -238,7 +236,7 @@ struct nfp_net_rxq {
 	 * For each buffer placed on the freelist, record the
 	 * associated SKB
 	 */
-	struct nfp_net_rx_buff *rxbufs;
+	struct nfp_net_dp_buf *rxbufs;
 
 	/*
 	 * Information about the host side queue location.  @rxds is
-- 
2.39.1


  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 ` Chaoyong He [this message]
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 ` [PATCH 4/8] net/nfp: modify the txq struct Chaoyong He
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-2-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).