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>,
	stable@dpdk.org
Subject: [PATCH 1/4] net/nfp: fix the IPv6 flow item
Date: Thu,  8 Jun 2023 11:19:53 +0800	[thread overview]
Message-ID: <20230608031956.814684-2-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20230608031956.814684-1-chaoyong.he@corigine.com>

When process the IPv6 flow item, the former logic perform the
mask operation between one big endian value and one CPU endian
valude, which cause the match of DSCP filed not work as expect.

Fix it by convert the big endian data into CPU endian and remove
the unneeded mask operation.

Fixes: d96507404463 ("net/nfp: support IPv6 flow item")
Cc: stable@dpdk.org

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
 drivers/net/nfp/nfp_flow.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/nfp/nfp_flow.c b/drivers/net/nfp/nfp_flow.c
index 41b722f4d8..937fb390df 100644
--- a/drivers/net/nfp/nfp_flow.c
+++ b/drivers/net/nfp/nfp_flow.c
@@ -1232,6 +1232,7 @@ nfp_flow_merge_ipv6(__rte_unused struct nfp_app_fw_flower *app_fw_flower,
 		bool is_mask,
 		bool is_outer_layer)
 {
+	uint32_t vtc_flow;
 	struct nfp_flower_ipv6 *ipv6;
 	const struct rte_ipv6_hdr *hdr;
 	struct nfp_flower_meta_tci *meta_tci;
@@ -1255,12 +1256,12 @@ nfp_flow_merge_ipv6(__rte_unused struct nfp_app_fw_flower *app_fw_flower,
 
 		hdr = is_mask ? &mask->hdr : &spec->hdr;
 
+		vtc_flow = rte_be_to_cpu_32(hdr->vtc_flow);
 		if (ext_meta && (rte_be_to_cpu_32(ext_meta->nfp_flow_key_layer2) &
 				NFP_FLOWER_LAYER2_GRE)) {
 			ipv6_gre_tun = (struct nfp_flower_ipv6_gre_tun *)*mbuf_off;
 
-			ipv6_gre_tun->ip_ext.tos = (hdr->vtc_flow &
-					RTE_IPV6_HDR_TC_MASK) >> RTE_IPV6_HDR_TC_SHIFT;
+			ipv6_gre_tun->ip_ext.tos = vtc_flow >> RTE_IPV6_HDR_TC_SHIFT;
 			ipv6_gre_tun->ip_ext.ttl = hdr->hop_limits;
 			memcpy(ipv6_gre_tun->ipv6.ipv6_src, hdr->src_addr,
 					sizeof(ipv6_gre_tun->ipv6.ipv6_src));
@@ -1269,8 +1270,7 @@ nfp_flow_merge_ipv6(__rte_unused struct nfp_app_fw_flower *app_fw_flower,
 		} else {
 			ipv6_udp_tun = (struct nfp_flower_ipv6_udp_tun *)*mbuf_off;
 
-			ipv6_udp_tun->ip_ext.tos = (hdr->vtc_flow &
-					RTE_IPV6_HDR_TC_MASK) >> RTE_IPV6_HDR_TC_SHIFT;
+			ipv6_udp_tun->ip_ext.tos = vtc_flow >> RTE_IPV6_HDR_TC_SHIFT;
 			ipv6_udp_tun->ip_ext.ttl = hdr->hop_limits;
 			memcpy(ipv6_udp_tun->ipv6.ipv6_src, hdr->src_addr,
 					sizeof(ipv6_udp_tun->ipv6.ipv6_src));
@@ -1291,10 +1291,10 @@ nfp_flow_merge_ipv6(__rte_unused struct nfp_app_fw_flower *app_fw_flower,
 			*mbuf_off += sizeof(struct nfp_flower_tp_ports);
 
 		hdr = is_mask ? &mask->hdr : &spec->hdr;
+		vtc_flow = rte_be_to_cpu_32(hdr->vtc_flow);
 		ipv6 = (struct nfp_flower_ipv6 *)*mbuf_off;
 
-		ipv6->ip_ext.tos   = (hdr->vtc_flow & RTE_IPV6_HDR_TC_MASK) >>
-				RTE_IPV6_HDR_TC_SHIFT;
+		ipv6->ip_ext.tos   = vtc_flow >> RTE_IPV6_HDR_TC_SHIFT;
 		ipv6->ip_ext.proto = hdr->proto;
 		ipv6->ip_ext.ttl   = hdr->hop_limits;
 		memcpy(ipv6->ipv6_src, hdr->src_addr, sizeof(ipv6->ipv6_src));
-- 
2.39.1


  reply	other threads:[~2023-06-08  3:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-08  3:19 [PATCH 0/4] fix the data endian problem in IPv6 logic Chaoyong He
2023-06-08  3:19 ` Chaoyong He [this message]
2023-06-08  3:19 ` [PATCH 2/4] net/nfp: fix TOS of IPv6 VXLAN encap flow action Chaoyong He
2023-06-08  3:19 ` [PATCH 3/4] net/nfp: fix TOS of IPv6 GENEVE " Chaoyong He
2023-06-08  3:19 ` [PATCH 4/4] net/nfp: fix TOS of IPv6 NVGRE " Chaoyong He
2023-06-08 15:43 ` [PATCH 0/4] fix the data endian problem in IPv6 logic 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=20230608031956.814684-2-chaoyong.he@corigine.com \
    --to=chaoyong.he@corigine.com \
    --cc=dev@dpdk.org \
    --cc=niklas.soderlund@corigine.com \
    --cc=oss-drivers@corigine.com \
    --cc=stable@dpdk.org \
    /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).