net/bnxt: modify IPv6 VTC flow field parsing
authorVenkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Fri, 12 Jun 2020 12:50:15 +0000 (18:20 +0530)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 30 Jun 2020 12:52:30 +0000 (14:52 +0200)
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>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
drivers/net/bnxt/tf_ulp/ulp_rte_parser.h
drivers/net/bnxt/tf_ulp/ulp_template_struct.h

index 3dd941f..ec576a9 100644 (file)
@@ -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));
index 868e6dc..c90bff4 100644 (file)
 #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);
index 4ca6049..8805b8b 100644 (file)
@@ -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