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, Long Wu <long.wu@corigine.com>,
	Chaoyong He <chaoyong.he@corigine.com>
Subject: [PATCH 2/5] net/nfp: uniform variable name format
Date: Tue,  5 Mar 2024 10:29:20 +0800	[thread overview]
Message-ID: <20240305022923.891544-3-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20240305022923.891544-1-chaoyong.he@corigine.com>

From: Long Wu <long.wu@corigine.com>

Uniform variable name format by add the same prefix.

Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
---
 drivers/net/nfp/flower/nfp_flower_cmsg.c |  2 +-
 drivers/net/nfp/flower/nfp_flower_ctrl.c |  2 +-
 drivers/net/nfp/nfp_net_meta.c           | 32 ++++++++++----------
 drivers/net/nfp/nfp_net_meta.h           | 38 ++++++++++++------------
 drivers/net/nfp/nfp_rxtx.c               |  2 +-
 5 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.c b/drivers/net/nfp/flower/nfp_flower_cmsg.c
index f78bfba332..eefeb0d887 100644
--- a/drivers/net/nfp/flower/nfp_flower_cmsg.c
+++ b/drivers/net/nfp/flower/nfp_flower_cmsg.c
@@ -31,7 +31,7 @@ nfp_flower_cmsg_init(struct nfp_app_fw_flower *app_fw_flower,
 	pkt = rte_pktmbuf_mtod(m, char *);
 	PMD_DRV_LOG(DEBUG, "flower_cmsg_init using pkt at %p", pkt);
 
-	new_size += nfp_flower_pkt_add_metadata(app_fw_flower, m, NFP_META_PORT_ID_CTRL);
+	new_size += nfp_flower_pkt_add_metadata(app_fw_flower, m, NFP_NET_META_PORT_ID_CTRL);
 
 	/* Now the ctrl header */
 	hdr = (struct nfp_flower_cmsg_hdr *)pkt;
diff --git a/drivers/net/nfp/flower/nfp_flower_ctrl.c b/drivers/net/nfp/flower/nfp_flower_ctrl.c
index 720a0d9495..4c2aeb9849 100644
--- a/drivers/net/nfp/flower/nfp_flower_ctrl.c
+++ b/drivers/net/nfp/flower/nfp_flower_ctrl.c
@@ -475,7 +475,7 @@ nfp_flower_cmsg_rx(struct nfp_app_fw_flower *app_fw_flower,
 		meta_type = rte_be_to_cpu_32(*(uint32_t *)(meta - 8));
 		meta_info = rte_be_to_cpu_32(*(uint32_t *)(meta - 4));
 		if (meta_type != NFP_NET_META_PORTID ||
-				meta_info != NFP_META_PORT_ID_CTRL) {
+				meta_info != NFP_NET_META_PORT_ID_CTRL) {
 			PMD_DRV_LOG(ERR, "Incorrect metadata for ctrl packet!");
 			rte_pktmbuf_free(pkts_burst[i]);
 			continue;
diff --git a/drivers/net/nfp/nfp_net_meta.c b/drivers/net/nfp/nfp_net_meta.c
index 0bc22b2f88..0fd5ba17a0 100644
--- a/drivers/net/nfp/nfp_net_meta.c
+++ b/drivers/net/nfp/nfp_net_meta.c
@@ -9,17 +9,17 @@
 #include "nfp_ipsec.h"
 #include "nfp_logs.h"
 
-enum nfp_ipsec_meta_layer {
-	NFP_IPSEC_META_SAIDX,       /**< Order of SA index in metadata */
-	NFP_IPSEC_META_SEQLOW,      /**< Order of Sequence Number (low 32bits) in metadata */
-	NFP_IPSEC_META_SEQHI,       /**< Order of Sequence Number (high 32bits) in metadata */
+enum nfp_net_meta_ipsec_layer {
+	NFP_NET_META_IPSEC_SAIDX,       /**< Order of SA index in metadata */
+	NFP_NET_META_IPSEC_SEQLOW,      /**< Order of Sequence Number (low 32bits) in metadata */
+	NFP_NET_META_IPSEC_SEQHI,       /**< Order of Sequence Number (high 32bits) in metadata */
 };
 
 /* Parse the chained metadata from packet */
 static bool
 nfp_net_parse_chained_meta(uint8_t *meta_base,
 		rte_be32_t meta_header,
-		struct nfp_meta_parsed *meta)
+		struct nfp_net_meta_parsed *meta)
 {
 	uint32_t meta_info;
 	uint32_t vlan_info;
@@ -75,7 +75,7 @@ nfp_net_parse_chained_meta(uint8_t *meta_base,
 static inline void
 nfp_net_parse_single_meta(uint8_t *meta_base,
 		rte_be32_t meta_header,
-		struct nfp_meta_parsed *meta)
+		struct nfp_net_meta_parsed *meta)
 {
 	meta->hash_type = rte_be_to_cpu_32(meta_header);
 	meta->hash = rte_be_to_cpu_32(*(rte_be32_t *)(meta_base + 4));
@@ -83,7 +83,7 @@ nfp_net_parse_single_meta(uint8_t *meta_base,
 
 /* Set mbuf hash data based on the metadata info */
 static void
-nfp_net_parse_meta_hash(const struct nfp_meta_parsed *meta,
+nfp_net_parse_meta_hash(const struct nfp_net_meta_parsed *meta,
 		struct nfp_net_rxq *rxq,
 		struct rte_mbuf *mbuf)
 {
@@ -98,7 +98,7 @@ nfp_net_parse_meta_hash(const struct nfp_meta_parsed *meta,
 
 /* Set mbuf vlan_strip data based on metadata info */
 static void
-nfp_net_parse_meta_vlan(const struct nfp_meta_parsed *meta,
+nfp_net_parse_meta_vlan(const struct nfp_net_meta_parsed *meta,
 		struct nfp_net_rx_desc *rxd,
 		struct nfp_net_rxq *rxq,
 		struct rte_mbuf *mb)
@@ -146,7 +146,7 @@ nfp_net_parse_meta_vlan(const struct nfp_meta_parsed *meta,
  * qinq not set & vlan not set: meta->vlan_layer=0
  */
 static void
-nfp_net_parse_meta_qinq(const struct nfp_meta_parsed *meta,
+nfp_net_parse_meta_qinq(const struct nfp_net_meta_parsed *meta,
 		struct nfp_net_rxq *rxq,
 		struct rte_mbuf *mb)
 {
@@ -156,7 +156,7 @@ nfp_net_parse_meta_qinq(const struct nfp_meta_parsed *meta,
 			(hw->cap & NFP_NET_CFG_CTRL_RXQINQ) == 0)
 		return;
 
-	if (meta->vlan_layer < NFP_META_MAX_VLANS)
+	if (meta->vlan_layer < NFP_NET_META_MAX_VLANS)
 		return;
 
 	if (meta->vlan[0].offload == 0)
@@ -175,7 +175,7 @@ nfp_net_parse_meta_qinq(const struct nfp_meta_parsed *meta,
  * Extract and decode metadata info and set the mbuf ol_flags.
  */
 static void
-nfp_net_parse_meta_ipsec(struct nfp_meta_parsed *meta,
+nfp_net_parse_meta_ipsec(struct nfp_net_meta_parsed *meta,
 		struct nfp_net_rxq *rxq,
 		struct rte_mbuf *mbuf)
 {
@@ -202,7 +202,7 @@ nfp_net_parse_meta_ipsec(struct nfp_meta_parsed *meta,
 }
 
 static void
-nfp_net_parse_meta_mark(const struct nfp_meta_parsed *meta,
+nfp_net_parse_meta_mark(const struct nfp_net_meta_parsed *meta,
 		struct rte_mbuf *mbuf)
 {
 	if (((meta->flags >> NFP_NET_META_MARK) & 0x1) == 0)
@@ -218,7 +218,7 @@ nfp_net_parse_meta(struct nfp_net_rx_desc *rxds,
 		struct nfp_net_rxq *rxq,
 		struct nfp_net_hw *hw,
 		struct rte_mbuf *mb,
-		struct nfp_meta_parsed *meta)
+		struct nfp_net_meta_parsed *meta)
 {
 	uint8_t *meta_base;
 	rte_be32_t meta_header;
@@ -305,13 +305,13 @@ nfp_net_set_meta_ipsec(struct nfp_net_meta_raw *meta_data,
 	desc_md = RTE_MBUF_DYNFIELD(pkt, offset, struct nfp_tx_ipsec_desc_msg *);
 
 	switch (ipsec_layer) {
-	case NFP_IPSEC_META_SAIDX:
+	case NFP_NET_META_IPSEC_SAIDX:
 		meta_data->data[layer] = desc_md->sa_idx;
 		break;
-	case NFP_IPSEC_META_SEQLOW:
+	case NFP_NET_META_IPSEC_SEQLOW:
 		meta_data->data[layer] = desc_md->esn.low;
 		break;
-	case NFP_IPSEC_META_SEQHI:
+	case NFP_NET_META_IPSEC_SEQHI:
 		meta_data->data[layer] = desc_md->esn.hi;
 		break;
 	default:
diff --git a/drivers/net/nfp/nfp_net_meta.h b/drivers/net/nfp/nfp_net_meta.h
index da2091ce9f..46caa777da 100644
--- a/drivers/net/nfp/nfp_net_meta.h
+++ b/drivers/net/nfp/nfp_net_meta.h
@@ -9,18 +9,18 @@
 #include "nfp_rxtx.h"
 
 /* Hash type prepended when a RSS hash was computed */
-#define NFP_NET_RSS_NONE                0
-#define NFP_NET_RSS_IPV4                1
-#define NFP_NET_RSS_IPV6                2
-#define NFP_NET_RSS_IPV6_EX             3
-#define NFP_NET_RSS_IPV4_TCP            4
-#define NFP_NET_RSS_IPV6_TCP            5
-#define NFP_NET_RSS_IPV6_EX_TCP         6
-#define NFP_NET_RSS_IPV4_UDP            7
-#define NFP_NET_RSS_IPV6_UDP            8
-#define NFP_NET_RSS_IPV6_EX_UDP         9
-#define NFP_NET_RSS_IPV4_SCTP           10
-#define NFP_NET_RSS_IPV6_SCTP           11
+#define NFP_NET_META_RSS_NONE           0
+#define NFP_NET_META_RSS_IPV4           1
+#define NFP_NET_META_RSS_IPV6           2
+#define NFP_NET_META_RSS_IPV6_EX        3
+#define NFP_NET_META_RSS_IPV4_TCP       4
+#define NFP_NET_META_RSS_IPV6_TCP       5
+#define NFP_NET_META_RSS_IPV6_EX_TCP    6
+#define NFP_NET_META_RSS_IPV4_UDP       7
+#define NFP_NET_META_RSS_IPV6_UDP       8
+#define NFP_NET_META_RSS_IPV6_EX_UDP    9
+#define NFP_NET_META_RSS_IPV4_SCTP      10
+#define NFP_NET_META_RSS_IPV6_SCTP      11
 
 /* Offset in Freelist buffer where packet starts on RX */
 #define NFP_NET_RX_OFFSET               32
@@ -47,15 +47,15 @@
 #define NFP_NET_META_PORTID             5
 #define NFP_NET_META_IPSEC              9
 
-#define NFP_META_PORT_ID_CTRL           ~0U
+#define NFP_NET_META_PORT_ID_CTRL       ~0U
 
 #define NFP_DESC_META_LEN(d) ((d)->rxd.meta_len_dd & PCIE_DESC_RX_META_LEN_MASK)
 
 /* Maximum number of NFP packet metadata fields. */
-#define NFP_META_MAX_FIELDS      8
+#define NFP_NET_META_MAX_FIELDS      8
 
 /* Maximum number of supported VLANs in parsed form packet metadata. */
-#define NFP_META_MAX_VLANS       2
+#define NFP_NET_META_MAX_VLANS       2
 
 enum nfp_net_meta_format {
 	NFP_NET_METAFORMAT_SINGLE,
@@ -65,12 +65,12 @@ enum nfp_net_meta_format {
 /* Describe the raw metadata format. */
 struct nfp_net_meta_raw {
 	uint32_t header; /**< Field type header (see format in nfp.rst) */
-	uint32_t data[NFP_META_MAX_FIELDS]; /**< Array of each fields data member */
+	uint32_t data[NFP_NET_META_MAX_FIELDS]; /**< Array of each fields data member */
 	uint8_t length; /**< Number of valid fields in @header */
 };
 
 /* Record metadata parsed from packet */
-struct nfp_meta_parsed {
+struct nfp_net_meta_parsed {
 	uint32_t port_id;         /**< Port id value */
 	uint32_t sa_idx;          /**< IPsec SA index */
 	uint32_t hash;            /**< RSS hash value */
@@ -87,7 +87,7 @@ struct nfp_meta_parsed {
 		uint8_t offload;  /**< Flag indicates whether VLAN is offloaded */
 		uint8_t tpid;     /**< Vlan TPID */
 		uint16_t tci;     /**< Vlan TCI (PCP + Priority + VID) */
-	} vlan[NFP_META_MAX_VLANS];
+	} vlan[NFP_NET_META_MAX_VLANS];
 };
 
 void nfp_net_init_metadata_format(struct nfp_net_hw *hw);
@@ -95,7 +95,7 @@ void nfp_net_parse_meta(struct nfp_net_rx_desc *rxds,
 		struct nfp_net_rxq *rxq,
 		struct nfp_net_hw *hw,
 		struct rte_mbuf *mb,
-		struct nfp_meta_parsed *meta);
+		struct nfp_net_meta_parsed *meta);
 void nfp_net_set_meta_vlan(struct nfp_net_meta_raw *meta_data,
 		struct rte_mbuf *pkt,
 		uint8_t layer);
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index 0256eba456..e863c42039 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -497,7 +497,7 @@ nfp_net_recv_pkts(void *rx_queue,
 		mb->next = NULL;
 		mb->port = rxq->port_id;
 
-		struct nfp_meta_parsed meta = {};
+		struct nfp_net_meta_parsed meta = {};
 		nfp_net_parse_meta(rxds, rxq, hw, mb, &meta);
 
 		nfp_net_parse_ptype(rxq, rxds, mb);
-- 
2.39.1


  parent reply	other threads:[~2024-03-05  2:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-05  2:29 [PATCH 0/5] add new meta data module Chaoyong He
2024-03-05  2:29 ` [PATCH 1/5] net/nfp: create " Chaoyong He
2024-03-05  2:29 ` Chaoyong He [this message]
2024-03-05  2:29 ` [PATCH 3/5] net/nfp: uniform function name format Chaoyong He
2024-03-05  2:29 ` [PATCH 4/5] net/nfp: use flag bits to control parsing meta data Chaoyong He
2024-03-05  2:29 ` [PATCH 5/5] net/nfp: use big-endian meta data for packet Chaoyong He
2024-03-12 12:05 ` [PATCH 0/5] add new meta data module 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=20240305022923.891544-3-chaoyong.he@corigine.com \
    --to=chaoyong.he@corigine.com \
    --cc=dev@dpdk.org \
    --cc=long.wu@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).