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, Chaoyong He <chaoyong.he@corigine.com>,
	Peng Zhang <peng.zhang@corigine.com>
Subject: [PATCH v2 01/11] net/nfp: use the suitable helper macro
Date: Sat, 28 Oct 2023 14:53:05 +0800	[thread overview]
Message-ID: <20231028065315.1937188-2-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20231028065315.1937188-1-chaoyong.he@corigine.com>

Replace the `rte_pktmbuf_mtod()` macro to with the more suitable
`rte_pktmbuf_mtod_offset()`.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
 drivers/net/nfp/flower/nfp_flower_cmsg.c | 2 +-
 drivers/net/nfp/flower/nfp_flower_ctrl.c | 4 ++--
 drivers/net/nfp/nfp_rxtx.c               | 3 +--
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.c b/drivers/net/nfp/flower/nfp_flower_cmsg.c
index 2ec9498d22..4013b32fd0 100644
--- a/drivers/net/nfp/flower/nfp_flower_cmsg.c
+++ b/drivers/net/nfp/flower/nfp_flower_cmsg.c
@@ -13,7 +13,7 @@
 static char*
 nfp_flower_cmsg_get_data(struct rte_mbuf *m)
 {
-	return rte_pktmbuf_mtod(m, char *) + 4 + 4 + NFP_FLOWER_CMSG_HLEN;
+	return rte_pktmbuf_mtod_offset(m, char *, 4 + 4 + NFP_FLOWER_CMSG_HLEN);
 }
 
 static void *
diff --git a/drivers/net/nfp/flower/nfp_flower_ctrl.c b/drivers/net/nfp/flower/nfp_flower_ctrl.c
index b4be28ccdf..d19b60bc69 100644
--- a/drivers/net/nfp/flower/nfp_flower_ctrl.c
+++ b/drivers/net/nfp/flower/nfp_flower_ctrl.c
@@ -375,7 +375,7 @@ nfp_flower_cmsg_rx_stats(struct nfp_flow_priv *flow_priv,
 	uint32_t ctx_id;
 	struct nfp_flower_stats_frame *stats;
 
-	msg = rte_pktmbuf_mtod(mbuf, char *) + NFP_FLOWER_CMSG_HLEN;
+	msg = rte_pktmbuf_mtod_offset(mbuf, char *, NFP_FLOWER_CMSG_HLEN);
 	msg_len = mbuf->data_len - NFP_FLOWER_CMSG_HLEN;
 	count = msg_len / sizeof(struct nfp_flower_stats_frame);
 
@@ -398,7 +398,7 @@ nfp_flower_cmsg_rx_qos_stats(struct nfp_mtr_priv *mtr_priv,
 	struct nfp_mtr *mtr;
 	struct nfp_mtr_stats_reply *mtr_stats;
 
-	msg = rte_pktmbuf_mtod(mbuf, char *) + NFP_FLOWER_CMSG_HLEN;
+	msg = rte_pktmbuf_mtod_offset(mbuf, char *, NFP_FLOWER_CMSG_HLEN);
 
 	mtr_stats = (struct nfp_mtr_stats_reply *)msg;
 	profile_id = rte_be_to_cpu_32(mtr_stats->head.profile_id);
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index fc94e5f0b9..644be2700e 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -448,8 +448,7 @@ nfp_net_parse_meta(struct nfp_net_rx_desc *rxds,
 	if (unlikely(NFP_DESC_META_LEN(rxds) == 0))
 		return;
 
-	meta_base = rte_pktmbuf_mtod(mb, uint8_t *);
-	meta_base -= NFP_DESC_META_LEN(rxds);
+	meta_base = rte_pktmbuf_mtod_offset(mb, uint8_t *, -NFP_DESC_META_LEN(rxds));
 	meta_header = *(rte_be32_t *)meta_base;
 
 	switch (hw->meta_format) {
-- 
2.39.1


  reply	other threads:[~2023-10-28  6:53 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-28  6:15 [PATCH 00/11] Clean up NFP PMD Chaoyong He
2023-10-28  6:15 ` [PATCH 01/11] net/nfp: use the suitable helper macro Chaoyong He
2023-10-28  6:15 ` [PATCH 02/11] net/nfp: remove the unneeded call of underlying API Chaoyong He
2023-10-28  6:15 ` [PATCH 03/11] net/nfp: remove the unneeded check of process type Chaoyong He
2023-10-28  6:15 ` [PATCH 04/11] net/nfp: remove the unneeded data abstraction Chaoyong He
2023-10-28  6:15 ` [PATCH 05/11] net/nfp: remove the redundancy macro Chaoyong He
2023-10-28  6:15 ` [PATCH 06/11] net/nfp: remove redundancy logic of init control BAR Chaoyong He
2023-10-28  6:15 ` [PATCH 07/11] net/nfp: use the DPDK defined function Chaoyong He
2023-10-28  6:15 ` [PATCH 08/11] net/nfp: replace hard coded value Chaoyong He
2023-10-28  6:15 ` [PATCH 09/11] net/nfp: unify the PMD name with macro Chaoyong He
2023-10-28  6:15 ` [PATCH 10/11] net/nfp: extract a helper function Chaoyong He
2023-10-28  6:15 ` [PATCH 11/11] net/nfp: remove the redundancy logic of representor port Chaoyong He
2023-10-28  6:53 ` [PATCH v2 00/11] Clean up NFP PMD Chaoyong He
2023-10-28  6:53   ` Chaoyong He [this message]
2023-10-28  6:53   ` [PATCH v2 02/11] net/nfp: remove the unneeded call of underlying API Chaoyong He
2023-10-28  6:53   ` [PATCH v2 03/11] net/nfp: remove the unneeded check of process type Chaoyong He
2023-10-28  6:53   ` [PATCH v2 04/11] net/nfp: remove the unneeded data abstraction Chaoyong He
2023-11-01 17:57     ` Ferruh Yigit
2023-11-02  1:25       ` Chaoyong He
2023-10-28  6:53   ` [PATCH v2 05/11] net/nfp: remove the redundancy macro Chaoyong He
2023-10-28  6:53   ` [PATCH v2 06/11] net/nfp: remove redundancy logic of init control BAR Chaoyong He
2023-10-28  6:53   ` [PATCH v2 07/11] net/nfp: use the DPDK defined function Chaoyong He
2023-10-28  6:53   ` [PATCH v2 08/11] net/nfp: replace hard coded value Chaoyong He
2023-10-28  6:53   ` [PATCH v2 09/11] net/nfp: unify the PMD name with macro Chaoyong He
2023-10-28  6:53   ` [PATCH v2 10/11] net/nfp: extract a helper function Chaoyong He
2023-10-28  6:53   ` [PATCH v2 11/11] net/nfp: remove the redundancy logic of representor port Chaoyong He
2023-11-01 18:33   ` [PATCH v2 00/11] Clean up NFP PMD 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=20231028065315.1937188-2-chaoyong.he@corigine.com \
    --to=chaoyong.he@corigine.com \
    --cc=dev@dpdk.org \
    --cc=oss-drivers@corigine.com \
    --cc=peng.zhang@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).