]> git.droids-corp.org - dpdk.git/commitdiff
net/ice/base: enable flow director for IPv6 next protocol
authorJie Wang <jie1x.wang@intel.com>
Sat, 7 May 2022 09:13:45 +0000 (17:13 +0800)
committerQi Zhang <qi.z.zhang@intel.com>
Tue, 17 May 2022 00:44:21 +0000 (02:44 +0200)
To support the new DDP and be compatible with the old version DDP
file, API function 'check_ddp_support_proto_id' is added to detect
if the required protocol ID is supported by the current DDP file.

Add new protocol ID IPV6_NEXT_PROTO support for PF FDIR if current
DDP is new DDP and keep behavior if it is the old version DDP.

Signed-off-by: Jie Wang <jie1x.wang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
drivers/net/ice/base/ice_flow.c
drivers/net/ice/base/ice_parser.c
drivers/net/ice/base/ice_parser.h
drivers/net/ice/base/ice_proto_grp.c
drivers/net/ice/base/ice_proto_grp.h
drivers/net/ice/base/ice_protocol_type.h

index bcbb9b12c4d55aa1ffe87a3af155c9ced2c842c3..4a73f0c6744aba9bdc1a1027542f90cf065fa50c 100644 (file)
@@ -1370,6 +1370,7 @@ ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,
        u16 sib_mask = 0;
        u16 mask;
        u16 off;
+       bool exist;
 
        flds = params->prof->segs[seg].fields;
 
@@ -1410,7 +1411,16 @@ ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,
                break;
        case ICE_FLOW_FIELD_IDX_IPV6_TTL:
        case ICE_FLOW_FIELD_IDX_IPV6_PROT:
-               prot_id = seg == 0 ? ICE_PROT_IPV6_OF_OR_S : ICE_PROT_IPV6_IL;
+               prot_id = ICE_PROT_IPV6_NEXT_PROTO;
+               exist = ice_check_ddp_support_proto_id(hw, prot_id);
+               if (!exist)
+                       prot_id = seg == 0 ?
+                                 ICE_PROT_IPV6_OF_OR_S :
+                                 ICE_PROT_IPV6_IL;
+               else
+                       prot_id = seg == 0 ?
+                                 ICE_PROT_IPV6_NEXT_PROTO :
+                                 ICE_PROT_IPV6_IL;
 
                /* TTL and PROT share the same extraction seq. entry.
                 * Each is considered a sibling to the other in terms of sharing
@@ -1543,6 +1553,10 @@ ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,
        flds[fld].xtrct.disp = (u8)(ice_flds_info[fld].off % ese_bits);
        flds[fld].xtrct.idx = params->es_cnt;
        flds[fld].xtrct.mask = ice_flds_info[fld].mask;
+       if (prot_id == ICE_PROT_IPV6_NEXT_PROTO) {
+               flds[fld].xtrct.off = 0;
+               flds[fld].xtrct.disp = 0;
+       }
 
        /* Adjust the next field-entry index after accommodating the number of
         * entries this field consumes
index 9b106baff0d48fe6033a8fc6a1d20488150d1723..6529f5d635fead17c07e009b644cffbd8641d7c7 100644 (file)
@@ -552,3 +552,38 @@ void ice_parser_profile_dump(struct ice_hw *hw, struct ice_parser_profile *prof)
        ice_info(hw, "flags = 0x%04x\n", prof->flags);
        ice_info(hw, "flags_msk = 0x%04x\n", prof->flags_msk);
 }
+
+/**
+ * ice_check_ddp_support_proto_id - check DDP package file support protocol ID
+ * @hw: pointer to the HW struct
+ * @proto_id: protocol ID value
+ *
+ * This function maintains the compatibility of the program process by checking
+ * whether the current DDP file supports the required protocol ID.
+ */
+bool ice_check_ddp_support_proto_id(struct ice_hw *hw,
+                                   enum ice_prot_id proto_id)
+{
+       struct ice_proto_grp_item *proto_grp_table;
+       struct ice_proto_grp_item *proto_grp;
+       bool exist = false;
+       u16 idx, i;
+
+       proto_grp_table = ice_proto_grp_table_get(hw);
+       if (!proto_grp_table)
+               return false;
+
+       for (idx = 0; idx < ICE_PROTO_GRP_TABLE_SIZE; idx++) {
+               proto_grp = &proto_grp_table[idx];
+               for (i = 0; i < ICE_PROTO_COUNT_PER_GRP; i++) {
+                       if (proto_grp->po[i].proto_id == proto_id) {
+                               exist = true;
+                               goto exit;
+                       }
+               }
+       }
+
+exit:
+       ice_free(hw, proto_grp_table);
+       return exist;
+}
index 816aea782abe2ebc7a94d5774999d0fad3d72303..22c73b686b96e7e1b9b6a55fd2c383a65ec5116a 100644 (file)
@@ -110,4 +110,6 @@ enum ice_status ice_parser_profile_init(struct ice_parser_result *rslt,
                                        struct ice_parser_profile *prof);
 void ice_parser_profile_dump(struct ice_hw *hw,
                             struct ice_parser_profile *prof);
+bool ice_check_ddp_support_proto_id(struct ice_hw *hw,
+                                   enum ice_prot_id proto_id);
 #endif /* _ICE_PARSER_H_ */
index 69d5d9a18a77bd53feb1e3f85b90ceaf5a0bc2d4..7ce87de110e79c700c3b242526d2f1cbf29353aa 100644 (file)
@@ -5,7 +5,6 @@
 #include "ice_common.h"
 #include "ice_parser_util.h"
 
-#define ICE_PROTO_GRP_TABLE_SIZE 192
 
 static void _proto_off_dump(struct ice_hw *hw, struct ice_proto_off *po,
                            int idx)
index 88d84505dd54cb9519164a985e6d0d8f4ba175d2..1a5b5d5f448c698e937996f18f235b02ba6a462d 100644 (file)
@@ -6,6 +6,7 @@
 #define _ICE_PROTO_GRP_H_
 
 #define ICE_PROTO_COUNT_PER_GRP 8
+#define ICE_PROTO_GRP_TABLE_SIZE 192
 
 struct ice_proto_off {
        bool polarity; /* true: positive, false: nagtive */
index 0e6e5990beba4aea4b0885a6c711b91af89893d3..83867418c6dbf5699ead8acd866d4c18d5db0075 100644 (file)
@@ -163,6 +163,7 @@ enum ice_prot_id {
        ICE_PROT_IPV6_OF_OR_S   = 40,
        ICE_PROT_IPV6_IL        = 41,
        ICE_PROT_IPV6_IL_IL     = 42,
+       ICE_PROT_IPV6_NEXT_PROTO = 43,
        ICE_PROT_IPV6_FRAG      = 47,
        ICE_PROT_TCP_IL         = 49,
        ICE_PROT_UDP_OF         = 52,