DPDK patches and discussions
 help / color / mirror / Atom feed
From: Junfeng Guo <junfeng.guo@intel.com>
To: qi.z.zhang@intel.com, jingjing.wu@intel.com, beilei.xing@intel.com
Cc: dev@dpdk.org, junfeng.guo@intel.com
Subject: [dpdk-dev] [PATCH v3 1/2] net/iavf: replace function name with macro
Date: Tue, 15 Sep 2020 14:26:08 +0800
Message-ID: <20200915062609.3786061-2-junfeng.guo@intel.com> (raw)
In-Reply-To: <20200915062609.3786061-1-junfeng.guo@intel.com>

Replace some function name with macro to shrink coding charactors.
	VIRTCHNL_DEL_PROTO_HDR_FIELD, VIRTCHNL_ADD_PROTO_HDR_FIELD
	--> REFINE_PROTO_FLD.

Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
---
 drivers/net/iavf/iavf_hash.c | 42 ++++++++++++++----------------------
 1 file changed, 16 insertions(+), 26 deletions(-)

diff --git a/drivers/net/iavf/iavf_hash.c b/drivers/net/iavf/iavf_hash.c
index 3152218dc..d8a4dc8bf 100644
--- a/drivers/net/iavf/iavf_hash.c
+++ b/drivers/net/iavf/iavf_hash.c
@@ -539,6 +539,9 @@ iavf_hash_parse_pattern(struct iavf_pattern_match_item *pattern_match_item,
 	return 0;
 }
 
+#define REFINE_PROTO_FLD(op, fld) \
+	VIRTCHNL_##op##_PROTO_HDR_FIELD(hdr, VIRTCHNL_PROTO_HDR_##fld)
+
 /* refine proto hdrs base on l2, l3, l4 rss type */
 static void
 iavf_refine_proto_hdrs_l234(struct virtchnl_proto_hdrs *proto_hdrs,
@@ -554,11 +557,9 @@ iavf_refine_proto_hdrs_l234(struct virtchnl_proto_hdrs *proto_hdrs,
 			if (!(rss_type & ETH_RSS_ETH))
 				hdr->field_selector = 0;
 			else if (rss_type & ETH_RSS_L2_SRC_ONLY)
-				VIRTCHNL_DEL_PROTO_HDR_FIELD(hdr,
-					VIRTCHNL_PROTO_HDR_ETH_DST);
+				REFINE_PROTO_FLD(DEL, ETH_DST);
 			else if (rss_type & ETH_RSS_L2_DST_ONLY)
-				VIRTCHNL_DEL_PROTO_HDR_FIELD(hdr,
-					VIRTCHNL_PROTO_HDR_ETH_SRC);
+				REFINE_PROTO_FLD(DEL, ETH_SRC);
 			break;
 		case VIRTCHNL_PROTO_HDR_IPV4:
 			if (rss_type &
@@ -567,11 +568,9 @@ iavf_refine_proto_hdrs_l234(struct virtchnl_proto_hdrs *proto_hdrs,
 			     ETH_RSS_NONFRAG_IPV4_TCP |
 			     ETH_RSS_NONFRAG_IPV4_SCTP)) {
 				if (rss_type & ETH_RSS_L3_SRC_ONLY)
-					VIRTCHNL_DEL_PROTO_HDR_FIELD(hdr,
-						VIRTCHNL_PROTO_HDR_IPV4_DST);
+					REFINE_PROTO_FLD(DEL, IPV4_DST);
 				else if (rss_type & ETH_RSS_L3_DST_ONLY)
-					VIRTCHNL_DEL_PROTO_HDR_FIELD(hdr,
-						VIRTCHNL_PROTO_HDR_IPV4_SRC);
+					REFINE_PROTO_FLD(DEL, IPV4_SRC);
 				else if (rss_type &
 					 (ETH_RSS_L4_SRC_ONLY |
 					  ETH_RSS_L4_DST_ONLY))
@@ -587,11 +586,9 @@ iavf_refine_proto_hdrs_l234(struct virtchnl_proto_hdrs *proto_hdrs,
 			     ETH_RSS_NONFRAG_IPV6_TCP |
 			     ETH_RSS_NONFRAG_IPV6_SCTP)) {
 				if (rss_type & ETH_RSS_L3_SRC_ONLY)
-					VIRTCHNL_DEL_PROTO_HDR_FIELD(hdr,
-						VIRTCHNL_PROTO_HDR_IPV6_DST);
+					REFINE_PROTO_FLD(DEL, IPV6_DST);
 				else if (rss_type & ETH_RSS_L3_DST_ONLY)
-					VIRTCHNL_DEL_PROTO_HDR_FIELD(hdr,
-						VIRTCHNL_PROTO_HDR_IPV6_SRC);
+					REFINE_PROTO_FLD(DEL, IPV6_SRC);
 				else if (rss_type &
 					 (ETH_RSS_L4_SRC_ONLY |
 					  ETH_RSS_L4_DST_ONLY))
@@ -605,11 +602,9 @@ iavf_refine_proto_hdrs_l234(struct virtchnl_proto_hdrs *proto_hdrs,
 			    (ETH_RSS_NONFRAG_IPV4_UDP |
 			     ETH_RSS_NONFRAG_IPV6_UDP)) {
 				if (rss_type & ETH_RSS_L4_SRC_ONLY)
-					VIRTCHNL_DEL_PROTO_HDR_FIELD(hdr,
-					    VIRTCHNL_PROTO_HDR_UDP_DST_PORT);
+					REFINE_PROTO_FLD(DEL, UDP_DST_PORT);
 				else if (rss_type & ETH_RSS_L4_DST_ONLY)
-					VIRTCHNL_DEL_PROTO_HDR_FIELD(hdr,
-					    VIRTCHNL_PROTO_HDR_UDP_SRC_PORT);
+					REFINE_PROTO_FLD(DEL, UDP_SRC_PORT);
 				else if (rss_type &
 					 (ETH_RSS_L3_SRC_ONLY |
 					  ETH_RSS_L3_DST_ONLY))
@@ -623,11 +618,9 @@ iavf_refine_proto_hdrs_l234(struct virtchnl_proto_hdrs *proto_hdrs,
 			    (ETH_RSS_NONFRAG_IPV4_TCP |
 			     ETH_RSS_NONFRAG_IPV6_TCP)) {
 				if (rss_type & ETH_RSS_L4_SRC_ONLY)
-					VIRTCHNL_DEL_PROTO_HDR_FIELD(hdr,
-					    VIRTCHNL_PROTO_HDR_TCP_DST_PORT);
+					REFINE_PROTO_FLD(DEL, TCP_DST_PORT);
 				else if (rss_type & ETH_RSS_L4_DST_ONLY)
-					VIRTCHNL_DEL_PROTO_HDR_FIELD(hdr,
-					    VIRTCHNL_PROTO_HDR_TCP_SRC_PORT);
+					REFINE_PROTO_FLD(DEL, TCP_SRC_PORT);
 				else if (rss_type &
 					 (ETH_RSS_L3_SRC_ONLY |
 					  ETH_RSS_L3_DST_ONLY))
@@ -641,11 +634,9 @@ iavf_refine_proto_hdrs_l234(struct virtchnl_proto_hdrs *proto_hdrs,
 			    (ETH_RSS_NONFRAG_IPV4_SCTP |
 			     ETH_RSS_NONFRAG_IPV6_SCTP)) {
 				if (rss_type & ETH_RSS_L4_SRC_ONLY)
-					VIRTCHNL_DEL_PROTO_HDR_FIELD(hdr,
-					    VIRTCHNL_PROTO_HDR_SCTP_DST_PORT);
+					REFINE_PROTO_FLD(DEL, SCTP_DST_PORT);
 				else if (rss_type & ETH_RSS_L4_DST_ONLY)
-					VIRTCHNL_DEL_PROTO_HDR_FIELD(hdr,
-					    VIRTCHNL_PROTO_HDR_TCP_SRC_PORT);
+					REFINE_PROTO_FLD(DEL, SCTP_SRC_PORT);
 				else if (rss_type &
 					 (ETH_RSS_L3_SRC_ONLY |
 					  ETH_RSS_L3_DST_ONLY))
@@ -699,8 +690,7 @@ iavf_refine_proto_hdrs_gtpu(struct virtchnl_proto_hdrs *proto_hdrs,
 		hdr = &proto_hdrs->proto_hdr[i];
 		switch (hdr->type) {
 		case VIRTCHNL_PROTO_HDR_GTPU_IP:
-			VIRTCHNL_ADD_PROTO_HDR_FIELD(hdr,
-				VIRTCHNL_PROTO_HDR_GTPU_IP_TEID);
+			REFINE_PROTO_FLD(ADD, GTPU_IP_TEID);
 			break;
 		default:
 			break;
-- 
2.25.1


  reply	other threads:[~2020-09-15  6:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-03 10:28 [dpdk-dev] [PATCH 0/2] add AVF RSS support for IPv6 prefix Junfeng Guo
2020-08-03 10:28 ` [dpdk-dev] [PATCH 1/2] common/iavf: support virtual channel " Junfeng Guo
2020-08-03 10:28 ` [dpdk-dev] [PATCH 2/2] net/iavf: support RSS for IPv6 prefix 64bit Junfeng Guo
2020-08-04 12:39 ` [dpdk-dev] [PATCH v2 0/3] add AVF RSS support for IPv6 prefix Junfeng Guo
2020-08-04 12:39   ` [dpdk-dev] [PATCH v2 1/3] common/iavf: support virtual channel " Junfeng Guo
2020-08-04 12:39   ` [dpdk-dev] [PATCH v2 2/3] net/iavf: support RSS for IPv6 prefix 64bit Junfeng Guo
2020-08-04 12:39   ` [dpdk-dev] [PATCH v2 3/3] net/iavf: support RSS for GTPU " Junfeng Guo
2020-09-15  6:26   ` [dpdk-dev] [PATCH v3 0/2] add AVF RSS support for IPv6 prefix Junfeng Guo
2020-09-15  6:26     ` Junfeng Guo [this message]
2020-09-15  6:26     ` [dpdk-dev] [PATCH v3 2/2] net/iavf: support RSS for IPv6 prefix 64bit Junfeng Guo
2020-09-15  8:17     ` [dpdk-dev] [PATCH v4 0/2] add AVF RSS support for IPv6 prefix Junfeng Guo
2020-09-15  8:17       ` [dpdk-dev] [PATCH v4 1/2] net/iavf: replace function name with macro Junfeng Guo
2020-09-15  8:17       ` [dpdk-dev] [PATCH v4 2/2] net/iavf: support RSS for IPv6 prefix 64bit Junfeng Guo
2020-09-15  8:40       ` [dpdk-dev] [PATCH v4 0/2] add AVF RSS support for IPv6 prefix Zhang, Qi Z

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=20200915062609.3786061-2-junfeng.guo@intel.com \
    --to=junfeng.guo@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    --cc=qi.z.zhang@intel.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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git