Skip to contentSkip to conversation

net/ice: couple of new DCF features

RFC New Steven Zou 1 participant 1 message May 14, 2021 Network drivers

lore
Share & tools
lore

Steven Zou

author
#0 lore raw

RFC 1/1 net/ice: couple of new DCF features

From: "Zou, Steven" <[email protected]>

This patchset is for couple of new feature on DCF
1, enable multiple DCF instances
2, enhanced GRE in DCF support
3, enhanced VxLAN support

---
 app/test-pmd/cmdline.c                   |  13 +-
 drivers/common/iavf/virtchnl.h           |   6 +-
 drivers/net/iavf/iavf_ethdev.c           |   2 +-
 drivers/net/ice/base/ice_common.c        |  25 ++
 drivers/net/ice/base/ice_flex_pipe.c     |  30 ++-
 drivers/net/ice/base/ice_flex_pipe.h     |   2 +-
 drivers/net/ice/base/ice_flex_type.h     |   1 +
 drivers/net/ice/base/ice_protocol_type.h |  16 ++
 drivers/net/ice/base/ice_switch.c        | 398 ++++++++++++++++++++++++++++++-
 drivers/net/ice/base/ice_type.h          |   2 +
 drivers/net/ice/ice_acl_filter.c         |  11 +-
 drivers/net/ice/ice_dcf.c                |  23 +-
 drivers/net/ice/ice_dcf.h                |   3 +
 drivers/net/ice/ice_dcf_ethdev.c         | 228 +++++++++++++-----
 drivers/net/ice/ice_dcf_parent.c         |   8 +
 drivers/net/ice/ice_ethdev.c             |   4 +
 drivers/net/ice/ice_generic_flow.c       |  37 +++
 drivers/net/ice/ice_generic_flow.h       |   9 +
 drivers/net/ice/ice_switch_filter.c      | 134 ++++++++++-
 lib/librte_ethdev/rte_ethdev.h           |   1 +
 20 files changed, 871 insertions(+), 82 deletions(-)
app/test-pmd/cmdline.c +6 -7
index 2d18b6c..4b52091 100644
@@ -9084,7 +9084,7 @@ struct cmd_tunnel_filter_result {
 
 /* *** CONFIGURE TUNNEL UDP PORT *** */
 struct cmd_tunnel_udp_config {
-	cmdline_fixed_string_t cmd;
+        cmdline_fixed_string_t rx_vxlan_port;
 	cmdline_fixed_string_t what;
 	uint16_t udp_port;
 	portid_t port_id;
@@ -9101,8 +9101,7 @@ struct cmd_tunnel_udp_config {
 
 	tunnel_udp.udp_port = res->udp_port;
 
-	if (!strcmp(res->cmd, "rx_vxlan_port"))
-		tunnel_udp.prot_type = RTE_TUNNEL_TYPE_VXLAN;
+        tunnel_udp.prot_type = RTE_TUNNEL_TYPE_VXLAN;
 
 	if (!strcmp(res->what, "add"))
 		ret = rte_eth_dev_udp_tunnel_port_add(res->port_id,
@@ -9115,9 +9114,9 @@ struct cmd_tunnel_udp_config {
 		printf("udp tunneling add error: (%s)\n", strerror(-ret));
 }
 
-cmdline_parse_token_string_t cmd_tunnel_udp_config_cmd =
-	TOKEN_STRING_INITIALIZER(struct cmd_tunnel_udp_config,
-				cmd, "rx_vxlan_port");
+cmdline_parse_token_string_t cmd_tunnel_udp_config_rx_vxlan_port =
+        TOKEN_STRING_INITIALIZER(struct cmd_tunnel_udp_config,
+                                rx_vxlan_port, "rx_vxlan_port");
 cmdline_parse_token_string_t cmd_tunnel_udp_config_what =
 	TOKEN_STRING_INITIALIZER(struct cmd_tunnel_udp_config,
 				what, "add#rm");
@@ -9134,7 +9133,7 @@ struct cmd_tunnel_udp_config {
 	.help_str = "rx_vxlan_port add|rm <udp_port> <port_id>: "
 		"Add/Remove a tunneling UDP port filter",
 	.tokens = {
-		(void *)&cmd_tunnel_udp_config_cmd,
+		(void *)&cmd_tunnel_udp_config_rx_vxlan_port,
 		(void *)&cmd_tunnel_udp_config_what,
 		(void *)&cmd_tunnel_udp_config_udp_port,
 		(void *)&cmd_tunnel_udp_config_port_id,
drivers/common/iavf/virtchnl.h +5 -1
index 302cc24..e7f7a02 100644
@@ -128,7 +128,9 @@ enum virtchnl_ops {
 	VIRTCHNL_OP_DISABLE_CHANNELS = 31,
 	VIRTCHNL_OP_ADD_CLOUD_FILTER = 32,
 	VIRTCHNL_OP_DEL_CLOUD_FILTER = 33,
-	/* opcodes 34, 35, 36, 37 and 38 are reserved */
+	/* opcodes 34, 35, 36 and 37 are reserved */
+        VIRTCHNL_OP_DCF_RULE_FLUSH = 6000,
+        VIRTCHNL_OP_DCF_VLAN_OFFLOAD = 38,
 	VIRTCHNL_OP_DCF_CMD_DESC = 39,
 	VIRTCHNL_OP_DCF_CMD_BUFF = 40,
 	VIRTCHNL_OP_DCF_DISABLE = 41,
@@ -771,6 +773,7 @@ enum virtchnl_event_codes {
 	VIRTCHNL_EVENT_RESET_IMPENDING,
 	VIRTCHNL_EVENT_PF_DRIVER_CLOSE,
 	VIRTCHNL_EVENT_DCF_VSI_MAP_UPDATE,
+        VIRTCHNL_EVENT_DCF_VSI_INFO = 1000,
 };
 
 #define PF_EVENT_SEVERITY_INFO		0
@@ -1468,6 +1471,7 @@ enum virtchnl_vector_limits {
 		 */
 		valid_len = msglen;
 		break;
+        case VIRTCHNL_OP_DCF_RULE_FLUSH:
 	case VIRTCHNL_OP_DCF_DISABLE:
 	case VIRTCHNL_OP_DCF_GET_VSI_MAP:
 	case VIRTCHNL_OP_DCF_GET_PKG_INFO:
drivers/net/iavf/iavf_ethdev.c +1 -1
index 93c68e6..eca54a9 100644
@@ -2115,7 +2115,7 @@ static int iavf_parse_devargs(struct rte_eth_dev *dev)
 iavf_dcf_cap_check_handler(__rte_unused const char *key,
 			   const char *value, __rte_unused void *opaque)
 {
-	if (strcmp(value, "dcf"))
+        if (strcmp(value, "dcf") && strcmp(value, "mdcf"))
 		return -1;
 
 	return 0;
drivers/net/ice/base/ice_common.c +25 -0
index 304e55e..4039e34 100644
@@ -538,6 +538,28 @@ enum ice_status
 	return ice_aq_send_cmd(hw, &desc, NULL, 0, cd);
 }
 
+static int ice_buildin_recipe_init(struct ice_hw *hw)
+{
+        struct ice_switch_info *sw = hw->switch_info;
+        struct ice_sw_recipe *recipe;
+
+        sw->buildin_recipes = ice_malloc(hw,
+                        sizeof(sw->buildin_recipes[0]) * ICE_MAX_NUM_RECIPES);
+
+        if (!sw->buildin_recipes)
+                return ICE_ERR_NO_MEMORY;
+
+        recipe = &sw->buildin_recipes[10];
+        recipe->is_root = 1;
+
+        recipe->lkup_exts.n_val_words = 1;
+        recipe->lkup_exts.field_mask[0] = 0x00ff;
+        recipe->lkup_exts.fv_words[0].off = 8;
+        recipe->lkup_exts.fv_words[0].prot_id = 32;
+
+        return ICE_SUCCESS;
+}
+
 /**
  * ice_init_fltr_mgmt_struct - initializes filter management list and locks
  * @hw: pointer to the HW struct
@@ -558,6 +580,8 @@ enum ice_status ice_init_fltr_mgmt_struct(struct ice_hw *hw)
 	INIT_LIST_HEAD(&sw->vsi_list_map_head);
 	sw->prof_res_bm_init = 0;
 
+        ice_buildin_recipe_init(hw);
+
 	status = ice_init_def_sw_recp(hw, &hw->switch_info->recp_list);
 	if (status) {
 		ice_free(hw, hw->switch_info);
@@ -628,6 +652,7 @@ enum ice_status ice_init_fltr_mgmt_struct(struct ice_hw *hw)
 			ice_free(hw, recps[i].root_buf);
 	}
 	ice_rm_sw_replay_rule_info(hw, sw);
+        ice_free(hw, sw->buildin_recipes);
 	ice_free(hw, sw->recp_list);
 	ice_free(hw, sw);
 }
drivers/net/ice/base/ice_flex_pipe.c +29 -1
index 7594df1..6906259 100644
@@ -13,6 +13,7 @@
 static const struct ice_tunnel_type_scan tnls[] = {
 	{ TNL_VXLAN,		"TNL_VXLAN_PF" },
 	{ TNL_GENEVE,		"TNL_GENEVE_PF" },
+        { TNL_ECPRI,           "TNL_UDP_ECPRI_PF" },
 	{ TNL_LAST,		"" }
 };
 
@@ -1280,6 +1281,9 @@ static void ice_init_pkg_regs(struct ice_hw *hw)
  */
 static enum ice_status ice_chk_pkg_version(struct ice_pkg_ver *pkg_ver)
 {
+        if (pkg_ver->major == 0xFF)
+            return ICE_SUCCESS;
+
 	if (pkg_ver->major != ICE_PKG_SUPP_VER_MAJ ||
 	    pkg_ver->minor != ICE_PKG_SUPP_VER_MNR)
 		return ICE_ERR_NOT_SUPPORTED;
@@ -1664,6 +1668,7 @@ static struct ice_buf_build *ice_pkg_buf_alloc(struct ice_hw *hw)
  * @ids_cnt: lookup/protocol count
  * @bm: bitmap of field vectors to consider
  * @fv_list: Head of a list
+ * @lkup_exts: lookup elements
  *
  * Finds all the field vector entries from switch block that contain
  * a given protocol ID and returns a list of structures of type
@@ -1674,7 +1679,8 @@ static struct ice_buf_build *ice_pkg_buf_alloc(struct ice_hw *hw)
  */
 enum ice_status
 ice_get_sw_fv_list(struct ice_hw *hw, u8 *prot_ids, u16 ids_cnt,
-		   ice_bitmap_t *bm, struct LIST_HEAD_TYPE *fv_list)
+                   ice_bitmap_t *bm, struct LIST_HEAD_TYPE *fv_list,
+                   struct ice_prot_lkup_ext *lkup_exts)
 {
 	struct ice_sw_fv_list_entry *fvl;
 	struct ice_sw_fv_list_entry *tmp;
@@ -1705,6 +1711,7 @@ enum ice_status
 		if (!ice_is_bit_set(bm, (u16)offset))
 			continue;
 
+#if 0
 		for (i = 0; i < ids_cnt; i++) {
 			int j;
 
@@ -1729,6 +1736,27 @@ enum ice_status
 				break;
 			}
 		}
+#else
+                int found = 1;
+                for (i = 0; i < lkup_exts->n_val_words; i++) {
+                        int j;
+
+                        for (j = 0; j < hw->blk[ICE_BLK_SW].es.fvw; j++)
+                                if (fv->ew[j].prot_id == lkup_exts->fv_words[i].prot_id && fv->ew[j].off == lkup_exts->fv_words[i].off)
+                                        break;
+                        if (j >= hw->blk[ICE_BLK_SW].es.fvw)
+                                found = 0;
+                }
+                if (found) {
+                        fvl = (struct ice_sw_fv_list_entry *)
+                                ice_malloc(hw, sizeof(*fvl));
+                        if (!fvl)
+                                goto err;
+                        fvl->fv_ptr = fv;
+                        fvl->profile_id = offset;
+                        LIST_ADD(&fvl->list_entry, fv_list);
+                }
+#endif
 	} while (fv);
 	if (LIST_EMPTY(fv_list))
 		return ICE_ERR_CFG;
drivers/net/ice/base/ice_flex_pipe.h +1 -1
index 214c7a2..4ea0650 100644
@@ -37,7 +37,7 @@ enum ice_status
 ice_init_prof_result_bm(struct ice_hw *hw);
 enum ice_status
 ice_get_sw_fv_list(struct ice_hw *hw, u8 *prot_ids, u16 ids_cnt,
-		   ice_bitmap_t *bm, struct LIST_HEAD_TYPE *fv_list);
+                   ice_bitmap_t *bm, struct LIST_HEAD_TYPE *fv_list, struct ice_prot_lkup_ext *lkup_exts);
 bool
 ice_get_open_tunnel_port(struct ice_hw *hw, enum ice_tunnel_type type,
 			 u16 *port);
drivers/net/ice/base/ice_flex_type.h +1 -0
index 1dd57ba..bbe7a8a 100644
@@ -516,6 +516,7 @@ struct ice_pkg_enum {
 enum ice_tunnel_type {
 	TNL_VXLAN = 0,
 	TNL_GENEVE,
+        TNL_ECPRI,
 	TNL_LAST = 0xFF,
 	TNL_ALL = 0xFF,
 };
drivers/net/ice/base/ice_protocol_type.h +16 -0
index e8caefd..f9fc208 100644
@@ -44,6 +44,7 @@ enum ice_protocol_type {
 	ICE_GENEVE,
 	ICE_VXLAN_GPE,
 	ICE_NVGRE,
+        ICE_GRE,
 	ICE_GTP,
 	ICE_PPPOE,
 	ICE_PFCP,
@@ -65,6 +66,7 @@ enum ice_sw_tunnel_type {
 	ICE_SW_TUN_VXLAN,	/* VXLAN matches only non-VLAN pkts */
 	ICE_SW_TUN_VXLAN_VLAN,  /* VXLAN matches both VLAN and non-VLAN pkts */
 	ICE_SW_TUN_NVGRE,
+        ICE_SW_TUN_GRE,
 	ICE_SW_TUN_UDP, /* This means all "UDP" tunnel types: VXLAN-GPE, VXLAN
 			 * and GENEVE
 			 */
@@ -196,6 +198,10 @@ enum ice_prot_id {
 #define ICE_TUN_FLAG_VLAN_MASK 0x01
 #define ICE_TUN_FLAG_FV_IND 2
 
+#define ICE_GRE_FLAG_MDID 22
+#define ICE_GRE_FLAG_MDID_OFF (ICE_MDID_SIZE * ICE_GRE_FLAG_MDID)
+#define ICE_GRE_FLAG_MASK 0x01C0
+
 #define ICE_PROTOCOL_MAX_ENTRIES 16
 
 /* Mapping of software defined protocol ID to hardware defined protocol ID */
@@ -336,6 +342,15 @@ struct ice_nvgre {
 	__be32 tni_flow;
 };
 
+struct ice_gre {
+        __be16 flags;
+        __be16 protocol;
+        __be16 chksum;
+        __be16 offset;
+        __be32 key;
+        __be32 seqnum;
+};
+
 union ice_prot_hdr {
 	struct ice_ether_hdr eth_hdr;
 	struct ice_ethtype_hdr ethertype;
@@ -346,6 +361,7 @@ struct ice_nvgre {
 	struct ice_sctp_hdr sctp_hdr;
 	struct ice_udp_tnl_hdr tnl_hdr;
 	struct ice_nvgre nvgre_hdr;
+        struct ice_gre gre_hdr;
 	struct ice_udp_gtp_hdr gtp_hdr;
 	struct ice_pppoe_hdr pppoe_hdr;
 	struct ice_pfcp_hdr pfcp_hdr;
drivers/net/ice/base/ice_switch.c +391 -7

558 lines not on this page · raw message

drivers/net/ice/base/ice_type.h +2 -0
index 6b8d44f..d364066 100644
@@ -838,6 +838,7 @@ struct ice_switch_info {
 	u16 max_used_prof_index;
 
 	ice_declare_bitmap(prof_res_bm[ICE_MAX_NUM_PROFILES], ICE_MAX_FV_WORDS);
+        struct ice_sw_recipe *buildin_recipes;
 };
 
 /* Port hardware description */
@@ -985,6 +986,7 @@ struct ice_hw {
 	ice_declare_bitmap(fdir_perfect_fltr, ICE_FLTR_PTYPE_MAX);
 	struct ice_lock rss_locks;	/* protect RSS configuration */
 	struct LIST_HEAD_TYPE rss_list_head;
+        u8 use_buildin_recipe;
 };
 
 /* Statistics collected by each port, VSI, VEB, and S-channel */
drivers/net/ice/ice_acl_filter.c +9 -2
index f7dbe53..2658515 100644
@@ -25,6 +25,7 @@
 #include "ice_ethdev.h"
 #include "ice_generic_flow.h"
 #include "base/ice_flow.h"
+#include "ice_dcf_ethdev.h"
 
 #define MAX_ACL_SLOTS_ID 2048
 
@@ -978,8 +979,11 @@ static void ice_deinit_acl(struct ice_pf *pf)
 	struct ice_pf *pf = &ad->pf;
 	struct ice_hw *hw = ICE_PF_TO_HW(pf);
 	struct ice_flow_parser *parser = &ice_acl_parser;
+        struct rte_eth_dev *eth_dev = ad->eth_dev;
+        struct ice_dcf_adapter *dcf_adapter = eth_dev->data->dev_private;
+        struct ice_dcf_hw *dcf_hw = &dcf_adapter->real_hw;
 
-	if (!ad->hw.dcf_enabled)
+        if (!ad->hw.dcf_enabled || dcf_hw->multi_inst)
 		return 0;
 
 	ret = ice_acl_prof_alloc(hw);
@@ -1025,8 +1029,11 @@ static void ice_deinit_acl(struct ice_pf *pf)
 	struct ice_pf *pf = &ad->pf;
 	struct ice_hw *hw = ICE_PF_TO_HW(pf);
 	struct ice_flow_parser *parser = &ice_acl_parser;
+        struct rte_eth_dev *eth_dev = ad->eth_dev;
+        struct ice_dcf_adapter *dcf_adapter = eth_dev->data->dev_private;
+        struct ice_dcf_hw *dcf_hw = &dcf_adapter->real_hw;
 
-	if (ad->hw.dcf_enabled) {
+        if (ad->hw.dcf_enabled && !dcf_hw->multi_inst) {
 		ice_unregister_parser(parser, ad);
 		ice_deinit_acl(pf);
 		ice_acl_prof_free(hw);
drivers/net/ice/ice_dcf.c +20 -3
index 44dbd3b..d4b1bb9 100644
@@ -642,7 +642,8 @@
 
 	if (ice_dcf_get_vf_vsi_map(hw) < 0) {
 		PMD_INIT_LOG(ERR, "Failed to get VF VSI map");
-		ice_dcf_mode_disable(hw);
+                if (!hw->multi_inst)
+		        ice_dcf_mode_disable(hw);
 		goto err_alloc;
 	}
 
@@ -700,8 +701,8 @@
 	rte_intr_disable(intr_handle);
 	rte_intr_callback_unregister(intr_handle,
 				     ice_dcf_dev_interrupt_handler, hw);
-
-	ice_dcf_mode_disable(hw);
+        if (!hw->multi_inst)
+	        ice_dcf_mode_disable(hw);
 	iavf_shutdown_adminq(&hw->avf);
 
 	rte_free(hw->arq_buf);
@@ -1079,3 +1080,19 @@
 	rte_free(list);
 	return err;
 }
+
+int
+ice_dcf_flush_rules(struct ice_dcf_hw *hw)
+{
+        struct dcf_virtchnl_cmd args;
+        int err = 0;
+
+        memset(&args, 0, sizeof(args));
+        args.v_op = VIRTCHNL_OP_DCF_RULE_FLUSH;
+
+        err = ice_dcf_execute_virtchnl_cmd(hw, &args);
+        if (err)
+                PMD_DRV_LOG(WARNING, "fail to execute command OF_DCF_RULE_FLUSH, DCF role must be preempted.");
+
+        return 0;
+}
drivers/net/ice/ice_dcf.h +3 -0
index ff02996..bebbc88 100644
@@ -51,6 +51,8 @@ struct ice_dcf_hw {
 	uint16_t vsi_id;
 
 	struct rte_eth_dev *eth_dev;
+        bool multi_inst;
+        bool dcf_replaced;
 	uint8_t *rss_lut;
 	uint8_t *rss_key;
 	uint64_t supported_rxdid;
@@ -77,5 +79,6 @@ int ice_dcf_send_aq_cmd(void *dcf_hw, struct ice_aq_desc *desc,
 int ice_dcf_query_stats(struct ice_dcf_hw *hw,
 			struct virtchnl_eth_stats *pstats);
 int ice_dcf_add_del_all_mac_addr(struct ice_dcf_hw *hw, bool add);
+int ice_dcf_flush_rules(struct ice_dcf_hw *hw);
 
 #endif /* _ICE_DCF_H_ */
drivers/net/ice/ice_dcf_ethdev.c +172 -56

285 lines not on this page · raw message

drivers/net/ice/ice_dcf_parent.c +8 -0
index 30ead4c..fdeef7d 100644
@@ -112,6 +112,9 @@
 {
 	struct ice_dcf_hw *hw = param;
 
+        if (hw->multi_inst)
+                return NULL;
+
 	usleep(ICE_DCF_VSI_UPDATE_SERVICE_INTERVAL);
 
 	rte_spinlock_lock(&vsi_update_lock);
@@ -160,6 +163,10 @@
 		pthread_create(&thread, NULL,
 			       ice_dcf_vsi_update_service_handler, dcf_hw);
 		break;
+        case VIRTCHNL_EVENT_DCF_VSI_INFO:
+                if (dcf_hw->vsi_id != pf_msg->event_data.vf_vsi_map.vsi_id)
+                        dcf_hw->dcf_replaced = true;
+                break;
 	default:
 		PMD_DRV_LOG(ERR, "Unknown event received %u", pf_msg->event);
 		break;
@@ -381,6 +388,7 @@ static void ice_dcf_uninit_parent_hw(struct ice_hw *hw)
 	parent_hw->aq_send_cmd_fn = ice_dcf_send_aq_cmd;
 	parent_hw->aq_send_cmd_param = &adapter->real_hw;
 	parent_hw->dcf_enabled = true;
+        hw->dcf_replaced = false;
 
 	err = ice_dcf_init_parent_hw(parent_hw);
 	if (err) {
drivers/net/ice/ice_ethdev.c +4 -0
index b01f2cd..58bffe1 100644
@@ -72,6 +72,7 @@ struct proto_xtr_ol_flag {
 
 #define ICE_OS_DEFAULT_PKG_NAME		"ICE OS Default Package"
 #define ICE_COMMS_PKG_NAME			"ICE COMMS Package"
+#define ICE_CUSTOM_OS_PKG_NAME             "Tencent ICE OS Package"
 #define ICE_MAX_RES_DESC_NUM        1024
 
 static int ice_dev_configure(struct rte_eth_dev *dev);
@@ -1810,6 +1811,9 @@ enum ice_pkg_type
 	else if (!strncmp((char *)hw->active_pkg_name, ICE_COMMS_PKG_NAME,
 		ICE_PKG_NAME_SIZE))
 		package_type = ICE_PKG_TYPE_COMMS;
+        if (!strncmp((char *)hw->active_pkg_name, ICE_CUSTOM_OS_PKG_NAME,
+                ICE_PKG_NAME_SIZE))
+                package_type = ICE_PKG_TYPE_OS_DEFAULT;
 	else
 		package_type = ICE_PKG_TYPE_UNKNOWN;
 
drivers/net/ice/ice_generic_flow.c +37 -0
index cead476..f42df9b 100644
@@ -17,6 +17,7 @@
 
 #include "ice_ethdev.h"
 #include "ice_generic_flow.h"
+#include "ice_dcf.h"
 
 /**
  * Non-pipeline mode, fdir and switch both used as distributor,
@@ -1003,6 +1004,33 @@ enum rte_flow_item_type pattern_eth_ipv6_nvgre_eth_ipv6_icmp6[] = {
 	RTE_FLOW_ITEM_TYPE_ICMP6,
 	RTE_FLOW_ITEM_TYPE_END,
 };
+/* IPv4 GRE RAW IPv4 */
+enum rte_flow_item_type pattern_eth_ipv4_gre_raw_ipv4[] = {
+        RTE_FLOW_ITEM_TYPE_ETH,
+        RTE_FLOW_ITEM_TYPE_IPV4,
+        RTE_FLOW_ITEM_TYPE_GRE,
+        RTE_FLOW_ITEM_TYPE_RAW,
+        RTE_FLOW_ITEM_TYPE_IPV4,
+        RTE_FLOW_ITEM_TYPE_END,
+};
+enum rte_flow_item_type pattern_eth_ipv4_gre_raw_ipv4_udp[] = {
+        RTE_FLOW_ITEM_TYPE_ETH,
+        RTE_FLOW_ITEM_TYPE_IPV4,
+        RTE_FLOW_ITEM_TYPE_GRE,
+        RTE_FLOW_ITEM_TYPE_RAW,
+        RTE_FLOW_ITEM_TYPE_IPV4,
+        RTE_FLOW_ITEM_TYPE_UDP,
+        RTE_FLOW_ITEM_TYPE_END,
+};
+enum rte_flow_item_type pattern_eth_ipv4_gre_raw_ipv4_tcp[] = {
+        RTE_FLOW_ITEM_TYPE_ETH,
+        RTE_FLOW_ITEM_TYPE_IPV4,
+        RTE_FLOW_ITEM_TYPE_GRE,
+        RTE_FLOW_ITEM_TYPE_RAW,
+        RTE_FLOW_ITEM_TYPE_IPV4,
+        RTE_FLOW_ITEM_TYPE_TCP,
+        RTE_FLOW_ITEM_TYPE_END,
+};
 
 /*IPv4 GTPU (EH) */
 enum rte_flow_item_type pattern_eth_ipv4_gtpu[] = {
@@ -2286,10 +2314,16 @@ struct ice_pattern_match_item *
 		struct rte_flow_error *error)
 {
 	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+        struct ice_adapter *ad =
+                ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
+        struct ice_dcf_hw *hw = ad->hw.aq_send_cmd_param;
 	struct rte_flow *p_flow;
 	void *temp;
 	int ret = 0;
 
+        if (hw->dcf_replaced)
+                return ret;
+
 	TAILQ_FOREACH_SAFE(p_flow, &pf->flow_list, node, temp) {
 		ret = ice_flow_destroy(dev, p_flow, error);
 		if (ret) {
@@ -2298,6 +2332,9 @@ struct ice_pattern_match_item *
 		}
 	}
 
+        if (ad->hw.dcf_enabled && hw->multi_inst)
+                return ice_dcf_flush_rules(ad->hw.aq_send_cmd_param);
+
 	return ret;
 }
 
drivers/net/ice/ice_generic_flow.h +9 -0
index 434d2f4..f212736 100644
@@ -35,6 +35,7 @@
 #define ICE_PROT_AH                (1ULL << 24)
 #define ICE_PROT_L2TPV3OIP         (1ULL << 25)
 #define ICE_PROT_PFCP              (1ULL << 26)
+#define ICE_PROT_GRE               (1ULL << 27)
 
 /* field */
 
@@ -61,6 +62,7 @@
 #define ICE_L2TPV3OIP_SESSION_ID   (1ULL << 43)
 #define ICE_PFCP_SEID              (1ULL << 42)
 #define ICE_PFCP_S_FIELD           (1ULL << 41)
+#define ICE_RAW_PATTERN            (1ULL << 40)
 
 /* input set */
 
@@ -189,6 +191,8 @@
 	(ICE_PROT_GTPU | ICE_GTPU_TEID)
 #define ICE_INSET_GTPU_QFI \
 	(ICE_PROT_GTPU | ICE_GTPU_QFI)
+#define ICE_INSET_RAW \
+        (ICE_PROT_GRE | ICE_RAW_PATTERN)
 #define ICE_INSET_PPPOE_SESSION \
 	(ICE_PROT_PPPOE_S | ICE_PPPOE_SESSION)
 #define ICE_INSET_PPPOE_PROTO \
@@ -361,6 +365,11 @@
 extern enum rte_flow_item_type pattern_eth_ipv6_nvgre_eth_ipv6_sctp[];
 extern enum rte_flow_item_type pattern_eth_ipv6_nvgre_eth_ipv6_icmp6[];
 
+/* IPv4 GRE RAW IPv4 */
+extern enum rte_flow_item_type pattern_eth_ipv4_gre_raw_ipv4[];
+extern enum rte_flow_item_type pattern_eth_ipv4_gre_raw_ipv4_udp[];
+extern enum rte_flow_item_type pattern_eth_ipv4_gre_raw_ipv4_tcp[];
+
 /* IPv4 GTPU (EH) */
 extern enum rte_flow_item_type pattern_eth_ipv4_gtpu[];
 extern enum rte_flow_item_type pattern_eth_ipv4_gtpu_eh[];
drivers/net/ice/ice_switch_filter.c +131 -3

232 lines not on this page · raw message

lib/librte_ethdev/rte_ethdev.h +1 -0
index 0934e02..846fa66 100644
@@ -1043,6 +1043,7 @@ enum rte_eth_tunnel_type {
 	RTE_TUNNEL_TYPE_IP_IN_GRE,
 	RTE_L2_TUNNEL_TYPE_E_TAG,
 	RTE_TUNNEL_TYPE_VXLAN_GPE,
+        RTE_TUNNEL_TYPE_ECPRI,
 	RTE_TUNNEL_TYPE_MAX,
 };
 
Signature · 1 line
1.8.3.1