]> git.droids-corp.org - dpdk.git/commitdiff
net/ice/base: add function to set HW profile for raw flow
authorJunfeng Guo <junfeng.guo@intel.com>
Wed, 3 Nov 2021 04:40:01 +0000 (12:40 +0800)
committerQi Zhang <qi.z.zhang@intel.com>
Wed, 3 Nov 2021 12:00:27 +0000 (13:00 +0100)
Based on the parser library, we can directly set HW profile and
associate the main/ctrl vsi.

This patch set also updated the base code BSD release version.

Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
drivers/net/ice/base/README
drivers/net/ice/base/ice_flex_pipe.c
drivers/net/ice/base/ice_flex_pipe.h
drivers/net/ice/base/ice_flow.c
drivers/net/ice/base/ice_flow.h

index 87a1cebfac8fcaf16238180d05e50404fa7d1d41..8123ec8c3017d0cdd8d8817f1416cf9d2422f5ea 100644 (file)
@@ -6,7 +6,7 @@ IntelĀ® ICE driver
 ==================
 
 This directory contains source code of FreeBSD ice driver of version
-2021.04.29 released by the team which develops
+2021.11.02 released by the team which develops
 basic drivers for any ice NIC. The directory of base/ contains the
 original source package.
 This driver is valid for the product(s) listed below
index 06a233990fa4e8b0a09b33a650dbac08da1135a7..395787806baa0b47ff21ede45d8aea89aa0118f2 100644 (file)
@@ -6365,3 +6365,52 @@ err_ice_rem_prof_id_flow:
 
        return status;
 }
+
+/**
+ * ice_flow_assoc_hw_prof - add profile id flow for main/ctrl VSI flow entry
+ * @hw: pointer to the HW struct
+ * @blk: HW block
+ * @dest_vsi_handle: dest VSI handle
+ * @fdir_vsi_handle: fdir programming VSI handle
+ * @id: profile id (handle)
+ *
+ * Calling this function will update the hardware tables to enable the
+ * profile indicated by the ID parameter for the VSIs specified in the VSI
+ * array. Once successfully called, the flow will be enabled.
+ */
+enum ice_status
+ice_flow_assoc_hw_prof(struct ice_hw *hw, enum ice_block blk,
+                      u16 dest_vsi_handle, u16 fdir_vsi_handle, int id)
+{
+       enum ice_status status = ICE_SUCCESS;
+       u16 vsi_num;
+
+       vsi_num = ice_get_hw_vsi_num(hw, dest_vsi_handle);
+       status = ice_add_prof_id_flow(hw, blk, vsi_num, id);
+       if (status) {
+               ice_debug(hw, ICE_DBG_FLOW, "HW profile add failed for main VSI flow entry, %d\n",
+                         status);
+               goto err_add_prof;
+       }
+
+       if (blk != ICE_BLK_FD)
+               return status;
+
+       vsi_num = ice_get_hw_vsi_num(hw, fdir_vsi_handle);
+       status = ice_add_prof_id_flow(hw, blk, vsi_num, id);
+       if (status) {
+               ice_debug(hw, ICE_DBG_FLOW, "HW profile add failed for ctrl VSI flow entry, %d\n",
+                         status);
+               goto err_add_entry;
+       }
+
+       return status;
+
+err_add_entry:
+       vsi_num = ice_get_hw_vsi_num(hw, dest_vsi_handle);
+       ice_rem_prof_id_flow(hw, blk, vsi_num, id);
+err_add_prof:
+       ice_flow_rem_prof(hw, blk, id);
+
+       return status;
+}
index dd332312ddafea35d9e4c71a0fd9b1ec375912fa..23ba45564a50ca00f3fb3bb83a8fe4a678077a7d 100644 (file)
@@ -76,6 +76,9 @@ enum ice_status
 ice_add_prof_id_flow(struct ice_hw *hw, enum ice_block blk, u16 vsi, u64 hdl);
 enum ice_status
 ice_rem_prof_id_flow(struct ice_hw *hw, enum ice_block blk, u16 vsi, u64 hdl);
+enum ice_status
+ice_flow_assoc_hw_prof(struct ice_hw *hw, enum ice_block blk,
+                      u16 dest_vsi_handle, u16 fdir_vsi_handle, int id);
 enum ice_status ice_init_pkg(struct ice_hw *hw, u8 *buff, u32 len);
 enum ice_status
 ice_copy_and_init_pkg(struct ice_hw *hw, const u8 *buf, u32 len);
index 77b6b130c1ec68ac5ba46a91ffbb5ea326a7f8c5..f699dbbc745d375448dd634e3ac6d334e0643808 100644 (file)
@@ -2524,6 +2524,90 @@ ice_flow_disassoc_prof(struct ice_hw *hw, enum ice_block blk,
        return status;
 }
 
+#define FLAG_GTP_EH_PDU_LINK   BIT_ULL(13)
+#define FLAG_GTP_EH_PDU                BIT_ULL(14)
+
+#define FLAG_GTPU_MSK  \
+       (FLAG_GTP_EH_PDU | FLAG_GTP_EH_PDU_LINK)
+#define FLAG_GTPU_DW   \
+       (FLAG_GTP_EH_PDU | FLAG_GTP_EH_PDU_LINK)
+#define FLAG_GTPU_UP   \
+       (FLAG_GTP_EH_PDU)
+/**
+ * ice_flow_set_hw_prof - Set HW flow profile based on the parsed profile info
+ * @hw: pointer to the HW struct
+ * @dest_vsi_handle: dest VSI handle
+ * @fdir_vsi_handle: fdir programming VSI handle
+ * @prof: stores parsed profile info from raw flow
+ * @blk: classification stage
+ */
+enum ice_status
+ice_flow_set_hw_prof(struct ice_hw *hw, u16 dest_vsi_handle,
+                    u16 fdir_vsi_handle, struct ice_parser_profile *prof,
+                    enum ice_block blk)
+{
+       int id = ice_find_first_bit(prof->ptypes, UINT16_MAX);
+       struct ice_flow_prof_params *params;
+       u8 fv_words = hw->blk[blk].es.fvw;
+       enum ice_status status;
+       u16 vsi_num;
+       int i, idx;
+
+       params = (struct ice_flow_prof_params *)ice_malloc(hw, sizeof(*params));
+       if (!params)
+               return ICE_ERR_NO_MEMORY;
+
+       for (i = 0; i < ICE_MAX_FV_WORDS; i++) {
+               params->es[i].prot_id = ICE_PROT_INVALID;
+               params->es[i].off = ICE_FV_OFFSET_INVAL;
+       }
+
+       for (i = 0; i < prof->fv_num; i++) {
+               if (hw->blk[blk].es.reverse)
+                       idx = fv_words - i - 1;
+               else
+                       idx = i;
+               params->es[idx].prot_id = prof->fv[i].proto_id;
+               params->es[idx].off = prof->fv[i].offset;
+               params->mask[idx] = CPU_TO_BE16(prof->fv[i].msk);
+       }
+
+       switch (prof->flags) {
+       case FLAG_GTPU_DW:
+               params->attr = ice_attr_gtpu_down;
+               params->attr_cnt = ARRAY_SIZE(ice_attr_gtpu_down);
+               break;
+       case FLAG_GTPU_UP:
+               params->attr = ice_attr_gtpu_up;
+               params->attr_cnt = ARRAY_SIZE(ice_attr_gtpu_up);
+               break;
+       default:
+               if (prof->flags_msk & FLAG_GTPU_MSK) {
+                       params->attr = ice_attr_gtpu_session;
+                       params->attr_cnt = ARRAY_SIZE(ice_attr_gtpu_session);
+               }
+               break;
+       }
+
+       status = ice_add_prof(hw, blk, id, (u8 *)prof->ptypes,
+                             params->attr, params->attr_cnt,
+                             params->es, params->mask, false);
+       if (status)
+               goto free_params;
+
+       status = ice_flow_assoc_hw_prof(hw, blk, dest_vsi_handle,
+                                       fdir_vsi_handle, id);
+       if (status)
+               goto free_params;
+
+       return ICE_SUCCESS;
+
+free_params:
+       ice_free(hw, params);
+
+       return status;
+}
+
 /**
  * ice_flow_add_prof - Add a flow profile for packet segments and matched fields
  * @hw: pointer to the HW struct
index 371d960066b034bf4ce82b613aeed4899e128460..dea7b3c0e882ac303b0b2e8e238409024381b27d 100644 (file)
@@ -548,6 +548,10 @@ enum ice_status
 ice_flow_assoc_vsig_vsi(struct ice_hw *hw, enum ice_block blk, u16 vsi_handle,
                        u16 vsig);
 enum ice_status
+ice_flow_set_hw_prof(struct ice_hw *hw, u16 dest_vsi_handle,
+                    u16 fdir_vsi_handle, struct ice_parser_profile *prof,
+                    enum ice_block blk);
+enum ice_status
 ice_flow_get_hw_prof(struct ice_hw *hw, enum ice_block blk, u64 prof_id,
                     u8 *hw_prof);