[27/36] net/bnxt: parse ipv6 vtc_flow field for more granularly
diff mbox series

Message ID 20200610065733.18698-28-somnath.kotur@broadcom.com
State Superseded, archived
Delegated to: Ajit Khaparde
Headers show
Series
  • bnxt fixes and enhancements
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Somnath Kotur June 10, 2020, 6:57 a.m. UTC
From: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>

ipv6 vtc_flow contains three fields
1. Version
2. Priority / Traffic Class
3. Flow Label
Currently, these are not parsed separately and also not set separately
in the field bitmap by the flow parser. However, the template treats
them separately. As a result, the flow matching doesn't succeed because
the bitmaps of parser and the template doesn't match.

This patch fixes this problem by parsing the above mentioned fields
individually to align with the template.

Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Michael Baucom <michael.baucom@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      | 37 ++++++++++++++++++++++++---
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h      | 10 ++++++++
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |  2 +-
 3 files changed, 44 insertions(+), 5 deletions(-)

Patch
diff mbox series

diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
index 3dd941f..ec576a9 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
@@ -598,6 +598,7 @@  ulp_rte_ipv6_hdr_handler(const struct rte_flow_item *item,
 	uint32_t idx = params->field_idx;
 	uint32_t size;
 	uint32_t inner_l3, outer_l3;
+	uint32_t vtcf, vtcf_mask;
 
 	inner_l3 = ULP_COMP_FLD_IDX_RD(params, BNXT_ULP_CF_IDX_I_L3);
 	if (inner_l3) {
@@ -606,14 +607,27 @@  ulp_rte_ipv6_hdr_handler(const struct rte_flow_item *item,
 	}
 
 	/*
-	 * Copy the rte_flow_item for ipv4 into hdr_field using ipv4
+	 * Copy the rte_flow_item for ipv6 into hdr_field using ipv6
 	 * header fields
 	 */
 	if (ipv6_spec) {
 		size = sizeof(ipv6_spec->hdr.vtc_flow);
+
+		vtcf = BNXT_ULP_GET_IPV6_VER(ipv6_spec->hdr.vtc_flow);
 		field = ulp_rte_parser_fld_copy(&params->hdr_field[idx],
-						&ipv6_spec->hdr.vtc_flow,
+						&vtcf,
+						size);
+
+		vtcf = BNXT_ULP_GET_IPV6_TC(ipv6_spec->hdr.vtc_flow);
+		field = ulp_rte_parser_fld_copy(field,
+						&vtcf,
+						size);
+
+		vtcf = BNXT_ULP_GET_IPV6_FLOWLABEL(ipv6_spec->hdr.vtc_flow);
+		field = ulp_rte_parser_fld_copy(field,
+						&vtcf,
 						size);
+
 		size = sizeof(ipv6_spec->hdr.payload_len);
 		field = ulp_rte_parser_fld_copy(field,
 						&ipv6_spec->hdr.payload_len,
@@ -636,9 +650,24 @@  ulp_rte_ipv6_hdr_handler(const struct rte_flow_item *item,
 						size);
 	}
 	if (ipv6_mask) {
+		size = sizeof(ipv6_mask->hdr.vtc_flow);
+
+		vtcf_mask = BNXT_ULP_GET_IPV6_VER(ipv6_mask->hdr.vtc_flow);
+		ulp_rte_prsr_mask_copy(params, &idx,
+				       &vtcf_mask,
+				       size);
+
+		vtcf_mask = BNXT_ULP_GET_IPV6_TC(ipv6_mask->hdr.vtc_flow);
 		ulp_rte_prsr_mask_copy(params, &idx,
-				       &ipv6_mask->hdr.vtc_flow,
-				       sizeof(ipv6_mask->hdr.vtc_flow));
+				       &vtcf_mask,
+				       size);
+
+		vtcf_mask =
+			BNXT_ULP_GET_IPV6_FLOWLABEL(ipv6_mask->hdr.vtc_flow);
+		ulp_rte_prsr_mask_copy(params, &idx,
+				       &vtcf_mask,
+				       size);
+
 		ulp_rte_prsr_mask_copy(params, &idx,
 				       &ipv6_mask->hdr.payload_len,
 				       sizeof(ipv6_mask->hdr.payload_len));
diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h
index 868e6dc..c90bff4 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h
+++ b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h
@@ -21,6 +21,16 @@ 
 #define BNXT_ULP_ENCAP_UDP_SIZE			4
 #define BNXT_ULP_INVALID_SVIF_VAL		-1U
 
+#define	BNXT_ULP_GET_IPV6_VER(vtcf)		\
+			(((vtcf) & BNXT_ULP_PARSER_IPV6_VER_MASK) >> 28)
+#define	BNXT_ULP_GET_IPV6_TC(vtcf)		\
+			(((vtcf) & BNXT_ULP_PARSER_IPV6_TC) >> 20)
+#define	BNXT_ULP_GET_IPV6_FLOWLABEL(vtcf)	\
+			((vtcf) & BNXT_ULP_PARSER_IPV6_FLOW_LABEL)
+#define	BNXT_ULP_PARSER_IPV6_VER_MASK		0xf0000000
+#define	BNXT_ULP_PARSER_IPV6_TC			0x0ff00000
+#define	BNXT_ULP_PARSER_IPV6_FLOW_LABEL		0x000fffff
+
 /* Function to handle the parsing of the RTE port id. */
 int32_t
 ulp_rte_parser_svif_process(struct ulp_rte_parser_params *params);
diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_struct.h b/drivers/net/bnxt/tf_ulp/ulp_template_struct.h
index 9b1bdbb..36bf5a4 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_template_struct.h
+++ b/drivers/net/bnxt/tf_ulp/ulp_template_struct.h
@@ -23,7 +23,7 @@ 
 #define BNXT_ULP_PROTO_HDR_S_VLAN_NUM	3
 #define BNXT_ULP_PROTO_HDR_VLAN_NUM	6
 #define BNXT_ULP_PROTO_HDR_IPV4_NUM	10
-#define BNXT_ULP_PROTO_HDR_IPV6_NUM	6
+#define BNXT_ULP_PROTO_HDR_IPV6_NUM	8
 #define BNXT_ULP_PROTO_HDR_UDP_NUM	4
 #define BNXT_ULP_PROTO_HDR_TCP_NUM	9
 #define BNXT_ULP_PROTO_HDR_VXLAN_NUM	4