From patchwork Thu Dec 24 07:01:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guo, Jia" X-Patchwork-Id: 85706 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 469D9A09FF; Thu, 24 Dec 2020 08:06:37 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D1D9ECA24; Thu, 24 Dec 2020 08:06:07 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 30290C9F8 for ; Thu, 24 Dec 2020 08:06:03 +0100 (CET) IronPort-SDR: bnNnW5BllQXzCZtH26TgC8F7MY7KI80dtxbrrGww9HT2ouFQH5ZPm3D44+Owt44QJ0MEMejXiQ kLfs4uoI9o+A== X-IronPort-AV: E=McAfee;i="6000,8403,9844"; a="175342398" X-IronPort-AV: E=Sophos;i="5.78,444,1599548400"; d="scan'208";a="175342398" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Dec 2020 23:05:53 -0800 IronPort-SDR: 0hNjmXFF/EIPtHZ4cMTxXQJIZxBH79ziX2Rsa1kfnFNXdiGvjI2ixJlaL92MQeKaLVqP0dLu7d LZqrE3PiJUqA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,444,1599548400"; d="scan'208";a="374282095" Received: from npg-dpdk-cvl-jeffguo-01.sh.intel.com ([10.67.111.128]) by orsmga008.jf.intel.com with ESMTP; 23 Dec 2020 23:05:51 -0800 From: Jeff Guo To: qi.z.zhang@intel.com, jingjing.wu@intel.com, qiming.yang@intel.com, haiyue.wang@intel.com Cc: dev@dpdk.org, jia.guo@intel.com, simei.su@intel.com Date: Thu, 24 Dec 2020 15:01:52 +0800 Message-Id: <20201224070157.76971-2-jia.guo@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201224070157.76971-1-jia.guo@intel.com> References: <20201216085854.7842-1-jia.guo@intel.com> <20201224070157.76971-1-jia.guo@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [dpdk-dev v2 1/6] net/ice/base: add package PTYPE enable information X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Scan the 'Marker PType TCAM' session to retrieve the Rx parser PTYPE enable information from the current package. Signed-off-by: Haiyue Wang Signed-off-by: Jeff Guo --- drivers/net/ice/base/ice_flex_pipe.c | 79 ++++++++++++++++++++++++++++ drivers/net/ice/base/ice_flex_pipe.h | 3 ++ drivers/net/ice/base/ice_flex_type.h | 19 +++++++ drivers/net/ice/base/ice_type.h | 1 + 4 files changed, 102 insertions(+) diff --git a/drivers/net/ice/base/ice_flex_pipe.c b/drivers/net/ice/base/ice_flex_pipe.c index 7594df1696..987bea5623 100644 --- a/drivers/net/ice/base/ice_flex_pipe.c +++ b/drivers/net/ice/base/ice_flex_pipe.c @@ -315,6 +315,84 @@ ice_pkg_enum_entry(struct ice_seg *ice_seg, struct ice_pkg_enum *state, return entry; } +/** + * ice_hw_ptype_ena - check if the PTYPE is enabled or not + * @hw: pointer to the HW structure + * @ptype: the hardware PTYPE + */ +bool ice_hw_ptype_ena(struct ice_hw *hw, u16 ptype) +{ + return ptype < ICE_FLOW_PTYPE_MAX && + ice_is_bit_set(hw->hw_ptype, ptype); +} + +/** + * ice_marker_ptype_tcam_handler + * @sect_type: section type + * @section: pointer to section + * @index: index of the Marker PType TCAM entry to be returned + * @offset: pointer to receive absolute offset, always 0 for ptype TCAM sections + * + * This is a callback function that can be passed to ice_pkg_enum_entry. + * Handles enumeration of individual Marker PType TCAM entries. + */ +static void * +ice_marker_ptype_tcam_handler(u32 sect_type, void *section, u32 index, + u32 *offset) +{ + struct ice_marker_ptype_tcam_section *marker_ptype; + + if (!section) + return NULL; + + if (sect_type != ICE_SID_RXPARSER_MARKER_PTYPE) + return NULL; + + if (index > ICE_MAX_MARKER_PTYPE_TCAMS_IN_BUF) + return NULL; + + if (offset) + *offset = 0; + + marker_ptype = (struct ice_marker_ptype_tcam_section *)section; + + if (index >= LE16_TO_CPU(marker_ptype->count)) + return NULL; + + return marker_ptype->tcam + index; +} + +/** + * ice_fill_hw_ptype - fill the enabled PTYPE bit information + * @hw: pointer to the HW structure + */ +static void +ice_fill_hw_ptype(struct ice_hw *hw) +{ + struct ice_marker_ptype_tcam_entry *tcam; + struct ice_seg *seg = hw->seg; + struct ice_pkg_enum state; + + ice_zero_bitmap(hw->hw_ptype, ICE_FLOW_PTYPE_MAX); + if (!seg) + return; + + ice_memset(&state, 0, sizeof(state), ICE_NONDMA_MEM); + + do { + tcam = (struct ice_marker_ptype_tcam_entry *) + ice_pkg_enum_entry(seg, &state, + ICE_SID_RXPARSER_MARKER_PTYPE, NULL, + ice_marker_ptype_tcam_handler); + if (tcam && + LE16_TO_CPU(tcam->addr) < ICE_MARKER_PTYPE_TCAM_ADDR_MAX && + LE16_TO_CPU(tcam->ptype) < ICE_FLOW_PTYPE_MAX) + ice_set_bit(LE16_TO_CPU(tcam->ptype), hw->hw_ptype); + + seg = NULL; + } while (tcam); +} + /** * ice_boost_tcam_handler * @sect_type: section type @@ -1511,6 +1589,7 @@ enum ice_status ice_init_pkg(struct ice_hw *hw, u8 *buf, u32 len) */ ice_init_pkg_regs(hw); ice_fill_blk_tbls(hw); + ice_fill_hw_ptype(hw); ice_get_prof_index_max(hw); } else { ice_debug(hw, ICE_DBG_INIT, "package load failed, %d\n", diff --git a/drivers/net/ice/base/ice_flex_pipe.h b/drivers/net/ice/base/ice_flex_pipe.h index 214c7a2837..66965d0975 100644 --- a/drivers/net/ice/base/ice_flex_pipe.h +++ b/drivers/net/ice/base/ice_flex_pipe.h @@ -48,6 +48,9 @@ bool ice_tunnel_port_in_use(struct ice_hw *hw, u16 port, u16 *index); bool ice_tunnel_get_type(struct ice_hw *hw, u16 port, enum ice_tunnel_type *type); +/* RX parser PType functions */ +bool ice_hw_ptype_ena(struct ice_hw *hw, u16 ptype); + /* XLT2/VSI group functions */ enum ice_status ice_vsig_find_vsi(struct ice_hw *hw, enum ice_block blk, u16 vsi, u16 *vsig); diff --git a/drivers/net/ice/base/ice_flex_type.h b/drivers/net/ice/base/ice_flex_type.h index 1dd57baccd..9213856ac1 100644 --- a/drivers/net/ice/base/ice_flex_type.h +++ b/drivers/net/ice/base/ice_flex_type.h @@ -472,6 +472,25 @@ struct ice_boost_tcam_section { sizeof(struct ice_boost_tcam_entry), \ sizeof(struct ice_boost_tcam_entry)) +/* package Marker PType TCAM entry */ +struct ice_marker_ptype_tcam_entry { +#define ICE_MARKER_PTYPE_TCAM_ADDR_MAX 1024 + __le16 addr; + __le16 ptype; + u8 keys[20]; +}; + +struct ice_marker_ptype_tcam_section { + __le16 count; + __le16 reserved; + struct ice_marker_ptype_tcam_entry tcam[STRUCT_HACK_VAR_LEN]; +}; + +#define ICE_MAX_MARKER_PTYPE_TCAMS_IN_BUF ICE_MAX_ENTRIES_IN_BUF( \ + ice_struct_size((struct ice_marker_ptype_tcam_section *)0, tcam, 1) - \ + sizeof(struct ice_marker_ptype_tcam_entry), \ + sizeof(struct ice_marker_ptype_tcam_entry)) + struct ice_xlt1_section { __le16 count; __le16 offset; diff --git a/drivers/net/ice/base/ice_type.h b/drivers/net/ice/base/ice_type.h index 6b8d44f0b4..8ba7ded9a2 100644 --- a/drivers/net/ice/base/ice_type.h +++ b/drivers/net/ice/base/ice_type.h @@ -985,6 +985,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; + ice_declare_bitmap(hw_ptype, ICE_FLOW_PTYPE_MAX); }; /* Statistics collected by each port, VSI, VEB, and S-channel */ From patchwork Thu Dec 24 07:01:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guo, Jia" X-Patchwork-Id: 85704 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E899FA09FF; Thu, 24 Dec 2020 08:06:05 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CCE4FC9F8; Thu, 24 Dec 2020 08:06:04 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 469BBC9F8 for ; Thu, 24 Dec 2020 08:06:00 +0100 (CET) IronPort-SDR: 0pxVpk75Er09/gB0EABKwA44XWIV8Q/wakPxLIcc2j2FwZd4+DgxjHv0+TSX2eAvr27VOFF9kD Qu6s6SfF42wg== X-IronPort-AV: E=McAfee;i="6000,8403,9844"; a="175342404" X-IronPort-AV: E=Sophos;i="5.78,444,1599548400"; d="scan'208";a="175342404" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Dec 2020 23:05:57 -0800 IronPort-SDR: 5bWbwhvbvjYypBOFzYUmKgFOJgid6uGKuhgERT7tXONK2cy1IwOXNCLA+pVIyfhnOA7q0TYKXC WFFtSG78pKKQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,444,1599548400"; d="scan'208";a="374282101" Received: from npg-dpdk-cvl-jeffguo-01.sh.intel.com ([10.67.111.128]) by orsmga008.jf.intel.com with ESMTP; 23 Dec 2020 23:05:54 -0800 From: Jeff Guo To: qi.z.zhang@intel.com, jingjing.wu@intel.com, qiming.yang@intel.com, haiyue.wang@intel.com Cc: dev@dpdk.org, jia.guo@intel.com, simei.su@intel.com Date: Thu, 24 Dec 2020 15:01:53 +0800 Message-Id: <20201224070157.76971-3-jia.guo@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201224070157.76971-1-jia.guo@intel.com> References: <20201216085854.7842-1-jia.guo@intel.com> <20201224070157.76971-1-jia.guo@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [dpdk-dev v2 2/6] net/ice: refactor package type parsing X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" If the PTYPE support of the package could be checked, no need to parse different PTYPE list for each type of the package. So, refactor the package type parsing mechanism in each flow engins. Signed-off-by: Jeff Guo --- drivers/net/ice/ice_acl_filter.c | 3 +- drivers/net/ice/ice_fdir_filter.c | 63 ++----------- drivers/net/ice/ice_generic_flow.c | 27 +++++- drivers/net/ice/ice_generic_flow.h | 9 +- drivers/net/ice/ice_hash.c | 47 ++-------- drivers/net/ice/ice_switch_filter.c | 139 ++++------------------------ 6 files changed, 64 insertions(+), 224 deletions(-) diff --git a/drivers/net/ice/ice_acl_filter.c b/drivers/net/ice/ice_acl_filter.c index f7dbe53574..363ce68318 100644 --- a/drivers/net/ice/ice_acl_filter.c +++ b/drivers/net/ice/ice_acl_filter.c @@ -914,7 +914,8 @@ ice_acl_parse(struct ice_adapter *ad, int ret; memset(filter, 0, sizeof(*filter)); - item = ice_search_pattern_match_item(pattern, array, array_len, error); + item = ice_search_pattern_match_item(ad, pattern, array, array_len, + error); if (!item) return -rte_errno; diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c index 175abcdd5c..ce6aa09d3d 100644 --- a/drivers/net/ice/ice_fdir_filter.c +++ b/drivers/net/ice/ice_fdir_filter.c @@ -84,34 +84,7 @@ ICE_INSET_IPV6_SRC | ICE_INSET_IPV6_DST | \ ICE_INSET_GTPU_TEID | ICE_INSET_GTPU_QFI) -static struct ice_pattern_match_item ice_fdir_pattern_os[] = { - {pattern_eth_ipv4, ICE_FDIR_INSET_ETH_IPV4, ICE_INSET_NONE}, - {pattern_eth_ipv4_udp, ICE_FDIR_INSET_ETH_IPV4_UDP, ICE_INSET_NONE}, - {pattern_eth_ipv4_tcp, ICE_FDIR_INSET_ETH_IPV4_TCP, ICE_INSET_NONE}, - {pattern_eth_ipv4_sctp, ICE_FDIR_INSET_ETH_IPV4_SCTP, ICE_INSET_NONE}, - {pattern_eth_ipv6, ICE_FDIR_INSET_ETH_IPV6, ICE_INSET_NONE}, - {pattern_eth_ipv6_udp, ICE_FDIR_INSET_ETH_IPV6_UDP, ICE_INSET_NONE}, - {pattern_eth_ipv6_tcp, ICE_FDIR_INSET_ETH_IPV6_TCP, ICE_INSET_NONE}, - {pattern_eth_ipv6_sctp, ICE_FDIR_INSET_ETH_IPV6_SCTP, ICE_INSET_NONE}, - {pattern_eth_ipv4_udp_vxlan_ipv4, - ICE_FDIR_INSET_VXLAN_IPV4, ICE_INSET_NONE}, - {pattern_eth_ipv4_udp_vxlan_ipv4_udp, - ICE_FDIR_INSET_VXLAN_IPV4_UDP, ICE_INSET_NONE}, - {pattern_eth_ipv4_udp_vxlan_ipv4_tcp, - ICE_FDIR_INSET_VXLAN_IPV4_TCP, ICE_INSET_NONE}, - {pattern_eth_ipv4_udp_vxlan_ipv4_sctp, - ICE_FDIR_INSET_VXLAN_IPV4_SCTP, ICE_INSET_NONE}, - {pattern_eth_ipv4_udp_vxlan_eth_ipv4, - ICE_FDIR_INSET_VXLAN_IPV4, ICE_INSET_NONE}, - {pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp, - ICE_FDIR_INSET_VXLAN_IPV4_UDP, ICE_INSET_NONE}, - {pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp, - ICE_FDIR_INSET_VXLAN_IPV4_TCP, ICE_INSET_NONE}, - {pattern_eth_ipv4_udp_vxlan_eth_ipv4_sctp, - ICE_FDIR_INSET_VXLAN_IPV4_SCTP, ICE_INSET_NONE}, -}; - -static struct ice_pattern_match_item ice_fdir_pattern_comms[] = { +static struct ice_pattern_match_item ice_fdir_pattern_list[] = { {pattern_ethertype, ICE_FDIR_INSET_ETH, ICE_INSET_NONE}, {pattern_eth_ipv4, ICE_FDIR_INSET_ETH_IPV4, ICE_INSET_NONE}, {pattern_eth_ipv4_udp, ICE_FDIR_INSET_ETH_IPV4_UDP, ICE_INSET_NONE}, @@ -143,8 +116,7 @@ static struct ice_pattern_match_item ice_fdir_pattern_comms[] = { {pattern_eth_ipv6_gtpu_eh, ICE_FDIR_INSET_IPV6_GTPU_EH, ICE_INSET_NONE}, }; -static struct ice_flow_parser ice_fdir_parser_os; -static struct ice_flow_parser ice_fdir_parser_comms; +static struct ice_flow_parser ice_fdir_parser; static int ice_fdir_is_tunnel_profile(enum ice_fdir_tunnel_type tunnel_type); @@ -1111,12 +1083,7 @@ ice_fdir_init(struct ice_adapter *ad) if (ret) return ret; - if (ad->active_pkg_type == ICE_PKG_TYPE_COMMS) - parser = &ice_fdir_parser_comms; - else if (ad->active_pkg_type == ICE_PKG_TYPE_OS_DEFAULT) - parser = &ice_fdir_parser_os; - else - return -EINVAL; + parser = &ice_fdir_parser; return ice_register_parser(parser, ad); } @@ -1124,16 +1091,13 @@ ice_fdir_init(struct ice_adapter *ad) static void ice_fdir_uninit(struct ice_adapter *ad) { - struct ice_pf *pf = &ad->pf; struct ice_flow_parser *parser; + struct ice_pf *pf = &ad->pf; if (ad->hw.dcf_enabled) return; - if (ad->active_pkg_type == ICE_PKG_TYPE_COMMS) - parser = &ice_fdir_parser_comms; - else - parser = &ice_fdir_parser_os; + parser = &ice_fdir_parser; ice_unregister_parser(parser, ad); @@ -2039,7 +2003,8 @@ ice_fdir_parse(struct ice_adapter *ad, int ret; memset(filter, 0, sizeof(*filter)); - item = ice_search_pattern_match_item(pattern, array, array_len, error); + item = ice_search_pattern_match_item(ad, pattern, array, array_len, + error); if (!item) return -rte_errno; @@ -2067,18 +2032,10 @@ ice_fdir_parse(struct ice_adapter *ad, return ret; } -static struct ice_flow_parser ice_fdir_parser_os = { - .engine = &ice_fdir_engine, - .array = ice_fdir_pattern_os, - .array_len = RTE_DIM(ice_fdir_pattern_os), - .parse_pattern_action = ice_fdir_parse, - .stage = ICE_FLOW_STAGE_DISTRIBUTOR, -}; - -static struct ice_flow_parser ice_fdir_parser_comms = { +static struct ice_flow_parser ice_fdir_parser = { .engine = &ice_fdir_engine, - .array = ice_fdir_pattern_comms, - .array_len = RTE_DIM(ice_fdir_pattern_comms), + .array = ice_fdir_pattern_list, + .array_len = RTE_DIM(ice_fdir_pattern_list), .parse_pattern_action = ice_fdir_parse, .stage = ICE_FLOW_STAGE_DISTRIBUTOR, }; diff --git a/drivers/net/ice/ice_generic_flow.c b/drivers/net/ice/ice_generic_flow.c index 1429cbc3b6..34a209af9d 100644 --- a/drivers/net/ice/ice_generic_flow.c +++ b/drivers/net/ice/ice_generic_flow.c @@ -2029,6 +2029,21 @@ ice_pattern_skip_void_item(struct rte_flow_item *items, rte_memcpy(items, pe, sizeof(struct rte_flow_item)); } +static bool +ice_pattern_is_support(__rte_unused struct ice_adapter *ad, + const struct rte_flow_item *pattern) +{ + const struct rte_flow_item *pb = pattern; + + while (pb != RTE_FLOW_ITEM_TYPE_END) { + if (!ice_hw_ptype_ena(&ad->hw, pb->type)) + return false; + pb++; + } + + return true; +} + /* Check if the pattern matches a supported item type array */ static bool ice_match_pattern(enum rte_flow_item_type *item_array, @@ -2047,10 +2062,11 @@ ice_match_pattern(enum rte_flow_item_type *item_array, } struct ice_pattern_match_item * -ice_search_pattern_match_item(const struct rte_flow_item pattern[], - struct ice_pattern_match_item *array, - uint32_t array_len, - struct rte_flow_error *error) +ice_search_pattern_match_item(struct ice_adapter *ad, + const struct rte_flow_item pattern[], + struct ice_pattern_match_item *array, + uint32_t array_len, + struct rte_flow_error *error) { uint16_t i = 0; struct ice_pattern_match_item *pattern_match_item; @@ -2083,6 +2099,9 @@ ice_search_pattern_match_item(const struct rte_flow_item pattern[], ice_pattern_skip_void_item(items, pattern); + if (!ice_pattern_is_support(ad, pattern)) + return NULL; + for (i = 0; i < array_len; i++) if (ice_match_pattern(array[i].pattern_list, items)) { diff --git a/drivers/net/ice/ice_generic_flow.h b/drivers/net/ice/ice_generic_flow.h index 434d2f425d..0dcb620809 100644 --- a/drivers/net/ice/ice_generic_flow.h +++ b/drivers/net/ice/ice_generic_flow.h @@ -593,10 +593,11 @@ int ice_register_parser(struct ice_flow_parser *parser, void ice_unregister_parser(struct ice_flow_parser *parser, struct ice_adapter *ad); struct ice_pattern_match_item * -ice_search_pattern_match_item(const struct rte_flow_item pattern[], - struct ice_pattern_match_item *array, - uint32_t array_len, - struct rte_flow_error *error); +ice_search_pattern_match_item(struct ice_adapter *ad, + const struct rte_flow_item pattern[], + struct ice_pattern_match_item *array, + uint32_t array_len, + struct rte_flow_error *error); int ice_flow_redirect(struct ice_adapter *ad, struct ice_flow_redirect *rd); diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c index fe3e06c579..fab2d397b7 100644 --- a/drivers/net/ice/ice_hash.c +++ b/drivers/net/ice/ice_hash.c @@ -313,21 +313,7 @@ struct rss_type_match_hdr hint_eth_pppoes = { ICE_FLOW_SEG_HDR_PPPOE, ETH_RSS_ETH | ETH_RSS_PPPOE}; -/* Supported pattern for os default package. */ -static struct ice_pattern_match_item ice_hash_pattern_list_os[] = { - {pattern_eth_ipv4, ICE_INSET_NONE, &hint_eth_ipv4}, - {pattern_eth_ipv4_udp, ICE_INSET_NONE, &hint_eth_ipv4_udp}, - {pattern_eth_ipv4_tcp, ICE_INSET_NONE, &hint_eth_ipv4_tcp}, - {pattern_eth_ipv4_sctp, ICE_INSET_NONE, &hint_eth_ipv4_sctp}, - {pattern_eth_ipv6, ICE_INSET_NONE, &hint_eth_ipv6}, - {pattern_eth_ipv6_udp, ICE_INSET_NONE, &hint_eth_ipv6_udp}, - {pattern_eth_ipv6_tcp, ICE_INSET_NONE, &hint_eth_ipv6_tcp}, - {pattern_eth_ipv6_sctp, ICE_INSET_NONE, &hint_eth_ipv6_sctp}, - {pattern_empty, ICE_INSET_NONE, &hint_empty}, -}; - -/* Supported pattern for comms package. */ -static struct ice_pattern_match_item ice_hash_pattern_list_comms[] = { +static struct ice_pattern_match_item ice_hash_pattern_list[] = { {pattern_empty, ICE_INSET_NONE, &hint_empty}, {pattern_eth_ipv4, ICE_INSET_NONE, @@ -915,19 +901,10 @@ static struct ice_flow_engine ice_hash_engine = { }; /* Register parser for os package. */ -static struct ice_flow_parser ice_hash_parser_os = { - .engine = &ice_hash_engine, - .array = ice_hash_pattern_list_os, - .array_len = RTE_DIM(ice_hash_pattern_list_os), - .parse_pattern_action = ice_hash_parse_pattern_action, - .stage = ICE_FLOW_STAGE_RSS, -}; - -/* Register parser for comms package. */ -static struct ice_flow_parser ice_hash_parser_comms = { +static struct ice_flow_parser ice_hash_parser = { .engine = &ice_hash_engine, - .array = ice_hash_pattern_list_comms, - .array_len = RTE_DIM(ice_hash_pattern_list_comms), + .array = ice_hash_pattern_list, + .array_len = RTE_DIM(ice_hash_pattern_list), .parse_pattern_action = ice_hash_parse_pattern_action, .stage = ICE_FLOW_STAGE_RSS, }; @@ -946,12 +923,7 @@ ice_hash_init(struct ice_adapter *ad) if (ad->hw.dcf_enabled) return 0; - if (ad->active_pkg_type == ICE_PKG_TYPE_OS_DEFAULT) - parser = &ice_hash_parser_os; - else if (ad->active_pkg_type == ICE_PKG_TYPE_COMMS) - parser = &ice_hash_parser_comms; - else - return -EINVAL; + parser = &ice_hash_parser; return ice_register_parser(parser, ad); } @@ -1211,8 +1183,8 @@ ice_hash_parse_pattern_action(__rte_unused struct ice_adapter *ad, } /* Check rss supported pattern and find matched pattern. */ - pattern_match_item = ice_search_pattern_match_item(pattern, - array, array_len, error); + pattern_match_item = ice_search_pattern_match_item(ad, pattern, array, + array_len, error); if (!pattern_match_item) { ret = -rte_errno; goto error; @@ -1352,10 +1324,7 @@ ice_hash_uninit(struct ice_adapter *ad) if (ad->hw.dcf_enabled) return; - if (ad->active_pkg_type == ICE_PKG_TYPE_OS_DEFAULT) - ice_unregister_parser(&ice_hash_parser_os, ad); - else if (ad->active_pkg_type == ICE_PKG_TYPE_COMMS) - ice_unregister_parser(&ice_hash_parser_comms, ad); + ice_unregister_parser(&ice_hash_parser, ad); } static void diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c index 8cba6eb7b1..e5b7d56068 100644 --- a/drivers/net/ice/ice_switch_filter.c +++ b/drivers/net/ice/ice_switch_filter.c @@ -137,47 +137,11 @@ struct sw_meta { struct ice_adv_rule_info rule_info; }; -static struct ice_flow_parser ice_switch_dist_parser_os; -static struct ice_flow_parser ice_switch_dist_parser_comms; -static struct ice_flow_parser ice_switch_perm_parser_os; -static struct ice_flow_parser ice_switch_perm_parser_comms; +static struct ice_flow_parser ice_switch_dist_parser; +static struct ice_flow_parser ice_switch_perm_parser; static struct -ice_pattern_match_item ice_switch_pattern_dist_os[] = { - {pattern_ethertype, - ICE_SW_INSET_ETHER, ICE_INSET_NONE}, - {pattern_ethertype_vlan, - ICE_SW_INSET_MAC_VLAN, ICE_INSET_NONE}, - {pattern_eth_arp, - ICE_INSET_NONE, ICE_INSET_NONE}, - {pattern_eth_ipv4, - ICE_SW_INSET_MAC_IPV4, ICE_INSET_NONE}, - {pattern_eth_ipv4_udp, - ICE_SW_INSET_MAC_IPV4_UDP, ICE_INSET_NONE}, - {pattern_eth_ipv4_tcp, - ICE_SW_INSET_MAC_IPV4_TCP, ICE_INSET_NONE}, - {pattern_eth_ipv6, - ICE_SW_INSET_MAC_IPV6, ICE_INSET_NONE}, - {pattern_eth_ipv6_udp, - ICE_SW_INSET_MAC_IPV6_UDP, ICE_INSET_NONE}, - {pattern_eth_ipv6_tcp, - ICE_SW_INSET_MAC_IPV6_TCP, ICE_INSET_NONE}, - {pattern_eth_ipv4_udp_vxlan_eth_ipv4, - ICE_SW_INSET_DIST_VXLAN_IPV4, ICE_INSET_NONE}, - {pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp, - ICE_SW_INSET_DIST_VXLAN_IPV4_UDP, ICE_INSET_NONE}, - {pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp, - ICE_SW_INSET_DIST_VXLAN_IPV4_TCP, ICE_INSET_NONE}, - {pattern_eth_ipv4_nvgre_eth_ipv4, - ICE_SW_INSET_DIST_NVGRE_IPV4, ICE_INSET_NONE}, - {pattern_eth_ipv4_nvgre_eth_ipv4_udp, - ICE_SW_INSET_DIST_NVGRE_IPV4_UDP, ICE_INSET_NONE}, - {pattern_eth_ipv4_nvgre_eth_ipv4_tcp, - ICE_SW_INSET_DIST_NVGRE_IPV4_TCP, ICE_INSET_NONE}, -}; - -static struct -ice_pattern_match_item ice_switch_pattern_dist_comms[] = { +ice_pattern_match_item ice_switch_pattern_dist_list[] = { {pattern_ethertype, ICE_SW_INSET_ETHER, ICE_INSET_NONE}, {pattern_ethertype_vlan, @@ -265,41 +229,7 @@ ice_pattern_match_item ice_switch_pattern_dist_comms[] = { }; static struct -ice_pattern_match_item ice_switch_pattern_perm_os[] = { - {pattern_ethertype, - ICE_SW_INSET_ETHER, ICE_INSET_NONE}, - {pattern_ethertype_vlan, - ICE_SW_INSET_MAC_VLAN, ICE_INSET_NONE}, - {pattern_eth_arp, - ICE_INSET_NONE, ICE_INSET_NONE}, - {pattern_eth_ipv4, - ICE_SW_INSET_MAC_IPV4, ICE_INSET_NONE}, - {pattern_eth_ipv4_udp, - ICE_SW_INSET_MAC_IPV4_UDP, ICE_INSET_NONE}, - {pattern_eth_ipv4_tcp, - ICE_SW_INSET_MAC_IPV4_TCP, ICE_INSET_NONE}, - {pattern_eth_ipv6, - ICE_SW_INSET_MAC_IPV6, ICE_INSET_NONE}, - {pattern_eth_ipv6_udp, - ICE_SW_INSET_MAC_IPV6_UDP, ICE_INSET_NONE}, - {pattern_eth_ipv6_tcp, - ICE_SW_INSET_MAC_IPV6_TCP, ICE_INSET_NONE}, - {pattern_eth_ipv4_udp_vxlan_eth_ipv4, - ICE_SW_INSET_PERM_TUNNEL_IPV4, ICE_INSET_NONE}, - {pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp, - ICE_SW_INSET_PERM_TUNNEL_IPV4_UDP, ICE_INSET_NONE}, - {pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp, - ICE_SW_INSET_PERM_TUNNEL_IPV4_TCP, ICE_INSET_NONE}, - {pattern_eth_ipv4_nvgre_eth_ipv4, - ICE_SW_INSET_PERM_TUNNEL_IPV4, ICE_INSET_NONE}, - {pattern_eth_ipv4_nvgre_eth_ipv4_udp, - ICE_SW_INSET_PERM_TUNNEL_IPV4_UDP, ICE_INSET_NONE}, - {pattern_eth_ipv4_nvgre_eth_ipv4_tcp, - ICE_SW_INSET_PERM_TUNNEL_IPV4_TCP, ICE_INSET_NONE}, -}; - -static struct -ice_pattern_match_item ice_switch_pattern_perm_comms[] = { +ice_pattern_match_item ice_switch_pattern_perm_list[] = { {pattern_ethertype, ICE_SW_INSET_ETHER, ICE_INSET_NONE}, {pattern_ethertype_vlan, @@ -1699,7 +1629,8 @@ ice_switch_parse_pattern_action(struct ice_adapter *ad, } pattern_match_item = - ice_search_pattern_match_item(pattern, array, array_len, error); + ice_search_pattern_match_item(ad, pattern, array, array_len, + error); if (!pattern_match_item) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_HANDLE, NULL, @@ -1859,21 +1790,11 @@ ice_switch_init(struct ice_adapter *ad) struct ice_flow_parser *dist_parser; struct ice_flow_parser *perm_parser; - if (ad->active_pkg_type == ICE_PKG_TYPE_COMMS) - dist_parser = &ice_switch_dist_parser_comms; - else if (ad->active_pkg_type == ICE_PKG_TYPE_OS_DEFAULT) - dist_parser = &ice_switch_dist_parser_os; - else - return -EINVAL; - if (ad->devargs.pipe_mode_support) { - if (ad->active_pkg_type == ICE_PKG_TYPE_COMMS) - perm_parser = &ice_switch_perm_parser_comms; - else - perm_parser = &ice_switch_perm_parser_os; - + perm_parser = &ice_switch_perm_parser; ret = ice_register_parser(perm_parser, ad); } else { + dist_parser = &ice_switch_dist_parser; ret = ice_register_parser(dist_parser, ad); } return ret; @@ -1885,21 +1806,11 @@ ice_switch_uninit(struct ice_adapter *ad) struct ice_flow_parser *dist_parser; struct ice_flow_parser *perm_parser; - if (ad->active_pkg_type == ICE_PKG_TYPE_COMMS) - dist_parser = &ice_switch_dist_parser_comms; - else if (ad->active_pkg_type == ICE_PKG_TYPE_OS_DEFAULT) - dist_parser = &ice_switch_dist_parser_os; - else - return; - if (ad->devargs.pipe_mode_support) { - if (ad->active_pkg_type == ICE_PKG_TYPE_COMMS) - perm_parser = &ice_switch_perm_parser_comms; - else - perm_parser = &ice_switch_perm_parser_os; - + perm_parser = &ice_switch_perm_parser; ice_unregister_parser(perm_parser, ad); } else { + dist_parser = &ice_switch_dist_parser; ice_unregister_parser(dist_parser, ad); } } @@ -1917,37 +1828,19 @@ ice_flow_engine ice_switch_engine = { }; static struct -ice_flow_parser ice_switch_dist_parser_os = { +ice_flow_parser ice_switch_dist_parser = { .engine = &ice_switch_engine, - .array = ice_switch_pattern_dist_os, - .array_len = RTE_DIM(ice_switch_pattern_dist_os), + .array = ice_switch_pattern_dist_list, + .array_len = RTE_DIM(ice_switch_pattern_dist_list), .parse_pattern_action = ice_switch_parse_pattern_action, .stage = ICE_FLOW_STAGE_DISTRIBUTOR, }; static struct -ice_flow_parser ice_switch_dist_parser_comms = { - .engine = &ice_switch_engine, - .array = ice_switch_pattern_dist_comms, - .array_len = RTE_DIM(ice_switch_pattern_dist_comms), - .parse_pattern_action = ice_switch_parse_pattern_action, - .stage = ICE_FLOW_STAGE_DISTRIBUTOR, -}; - -static struct -ice_flow_parser ice_switch_perm_parser_os = { - .engine = &ice_switch_engine, - .array = ice_switch_pattern_perm_os, - .array_len = RTE_DIM(ice_switch_pattern_perm_os), - .parse_pattern_action = ice_switch_parse_pattern_action, - .stage = ICE_FLOW_STAGE_PERMISSION, -}; - -static struct -ice_flow_parser ice_switch_perm_parser_comms = { +ice_flow_parser ice_switch_perm_parser = { .engine = &ice_switch_engine, - .array = ice_switch_pattern_perm_comms, - .array_len = RTE_DIM(ice_switch_pattern_perm_comms), + .array = ice_switch_pattern_perm_list, + .array_len = RTE_DIM(ice_switch_pattern_perm_list), .parse_pattern_action = ice_switch_parse_pattern_action, .stage = ICE_FLOW_STAGE_PERMISSION, }; From patchwork Thu Dec 24 07:01:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guo, Jia" X-Patchwork-Id: 85707 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id DDF79A09FF; Thu, 24 Dec 2020 08:07:00 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4F542CA32; Thu, 24 Dec 2020 08:06:10 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id A97B1C9FA for ; Thu, 24 Dec 2020 08:06:03 +0100 (CET) IronPort-SDR: WHUHv4byswsTQClUSbVRxERPsou7nRW/ozm+ybWH+SR1kzo/SkP6KC/mIu4TfWP4l2cvxpWLM2 /mKTnBea86XQ== X-IronPort-AV: E=McAfee;i="6000,8403,9844"; a="175342408" X-IronPort-AV: E=Sophos;i="5.78,444,1599548400"; d="scan'208";a="175342408" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Dec 2020 23:05:59 -0800 IronPort-SDR: kLcYFJNvb6PsspYcNl4nF4NoU2nwMRfR/47mfRjdNMl3I/NJNfbSosgPPWJx6KGVRhBiFKF7a0 ZZl97r3CQz+g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,444,1599548400"; d="scan'208";a="374282111" Received: from npg-dpdk-cvl-jeffguo-01.sh.intel.com ([10.67.111.128]) by orsmga008.jf.intel.com with ESMTP; 23 Dec 2020 23:05:57 -0800 From: Jeff Guo To: qi.z.zhang@intel.com, jingjing.wu@intel.com, qiming.yang@intel.com, haiyue.wang@intel.com Cc: dev@dpdk.org, jia.guo@intel.com, simei.su@intel.com Date: Thu, 24 Dec 2020 15:01:54 +0800 Message-Id: <20201224070157.76971-4-jia.guo@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201224070157.76971-1-jia.guo@intel.com> References: <20201216085854.7842-1-jia.guo@intel.com> <20201224070157.76971-1-jia.guo@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [dpdk-dev v2 3/6] net/ice/base: add new UDP tunnel type for ecpri X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Add new UDP tunnel type for ecpri. Signed-off-by: Jeff Guo --- drivers/net/ice/base/ice_flex_pipe.c | 1 + drivers/net/ice/base/ice_flex_type.h | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/net/ice/base/ice_flex_pipe.c b/drivers/net/ice/base/ice_flex_pipe.c index 987bea5623..31a4695343 100644 --- a/drivers/net/ice/base/ice_flex_pipe.c +++ b/drivers/net/ice/base/ice_flex_pipe.c @@ -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, "" } }; diff --git a/drivers/net/ice/base/ice_flex_type.h b/drivers/net/ice/base/ice_flex_type.h index 9213856ac1..f75a1005f3 100644 --- a/drivers/net/ice/base/ice_flex_type.h +++ b/drivers/net/ice/base/ice_flex_type.h @@ -535,6 +535,7 @@ struct ice_pkg_enum { enum ice_tunnel_type { TNL_VXLAN = 0, TNL_GENEVE, + TNL_ECPRI, TNL_LAST = 0xFF, TNL_ALL = 0xFF, }; From patchwork Thu Dec 24 07:01:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guo, Jia" X-Patchwork-Id: 85708 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 341D0A09FF; Thu, 24 Dec 2020 08:07:16 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9F655CA46; Thu, 24 Dec 2020 08:06:11 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id D681EC9FE for ; Thu, 24 Dec 2020 08:06:03 +0100 (CET) IronPort-SDR: QPAdwgEChxKZ6Ju/tj2Rzx2Nvjhw0hV5oONUWWJSA8h8KsSYUC54Xo9pI4mB8uwRdBighA1Tq6 SrAjHu9PdWKA== X-IronPort-AV: E=McAfee;i="6000,8403,9844"; a="175342411" X-IronPort-AV: E=Sophos;i="5.78,444,1599548400"; d="scan'208";a="175342411" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Dec 2020 23:06:02 -0800 IronPort-SDR: khd/FgnErA4HwLs5vAtne2275w7CQPM1vJUQGxDbOT5Ug6g5zZr8h1/ZqMcAB5Z4aV0TgoGK47 P8J3nKaifn0A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,444,1599548400"; d="scan'208";a="374282133" Received: from npg-dpdk-cvl-jeffguo-01.sh.intel.com ([10.67.111.128]) by orsmga008.jf.intel.com with ESMTP; 23 Dec 2020 23:05:59 -0800 From: Jeff Guo To: qi.z.zhang@intel.com, jingjing.wu@intel.com, qiming.yang@intel.com, haiyue.wang@intel.com Cc: dev@dpdk.org, jia.guo@intel.com, simei.su@intel.com Date: Thu, 24 Dec 2020 15:01:55 +0800 Message-Id: <20201224070157.76971-5-jia.guo@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201224070157.76971-1-jia.guo@intel.com> References: <20201216085854.7842-1-jia.guo@intel.com> <20201224070157.76971-1-jia.guo@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [dpdk-dev v2 4/6] net/ice: add PTYPE mapping for ecpri X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Until the new ecpri PTYPE be added into the RTE lib, just mapping ecpri to the PTYPE of RTE_PTYPE_L4_UDP in ice pmd. Signed-off-by: Jeff Guo --- drivers/net/ice/ice_rxtx.c | 44 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index d052bd0f1b..95be6f6791 100644 --- a/drivers/net/ice/ice_rxtx.c +++ b/drivers/net/ice/ice_rxtx.c @@ -3880,6 +3880,50 @@ ice_get_default_pkt_type(uint16_t ptype) RTE_PTYPE_TUNNEL_GTPU | RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_ICMP, + + /* IPv4 --> UDP ECPRI */ + [372] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | + RTE_PTYPE_L4_UDP, + [373] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | + RTE_PTYPE_L4_UDP, + [374] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | + RTE_PTYPE_L4_UDP, + [375] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | + RTE_PTYPE_L4_UDP, + [376] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | + RTE_PTYPE_L4_UDP, + [377] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | + RTE_PTYPE_L4_UDP, + [378] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | + RTE_PTYPE_L4_UDP, + [379] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | + RTE_PTYPE_L4_UDP, + [380] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | + RTE_PTYPE_L4_UDP, + [381] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | + RTE_PTYPE_L4_UDP, + + /* IPV6 --> UDP ECPRI */ + [382] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | + RTE_PTYPE_L4_UDP, + [383] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | + RTE_PTYPE_L4_UDP, + [384] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | + RTE_PTYPE_L4_UDP, + [385] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | + RTE_PTYPE_L4_UDP, + [386] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | + RTE_PTYPE_L4_UDP, + [387] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | + RTE_PTYPE_L4_UDP, + [388] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | + RTE_PTYPE_L4_UDP, + [389] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | + RTE_PTYPE_L4_UDP, + [390] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | + RTE_PTYPE_L4_UDP, + [391] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | + RTE_PTYPE_L4_UDP, /* All others reserved */ }; From patchwork Thu Dec 24 07:01:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guo, Jia" X-Patchwork-Id: 85709 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C3E94A09FF; Thu, 24 Dec 2020 08:07:38 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 55465CA5D; Thu, 24 Dec 2020 08:06:13 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 9494FC9FE for ; Thu, 24 Dec 2020 08:06:05 +0100 (CET) IronPort-SDR: ypHBVDdaJdK/jhfM6iKcMEDPG2rETh5Ur7gPht14aAUDeC+EQAk8LtUjRt1nTSffrzuG/SYtgF v3pmirU4fkGg== X-IronPort-AV: E=McAfee;i="6000,8403,9844"; a="175342415" X-IronPort-AV: E=Sophos;i="5.78,444,1599548400"; d="scan'208";a="175342415" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Dec 2020 23:06:05 -0800 IronPort-SDR: TNrkkqcMMpmS4q88hp90oZbAaiQUYWu2d4/s/skMWT8t47gw8QJXgTqrYf3qL1PHFY/rgekcTJ GTGC0Y2+43Ug== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,444,1599548400"; d="scan'208";a="374282154" Received: from npg-dpdk-cvl-jeffguo-01.sh.intel.com ([10.67.111.128]) by orsmga008.jf.intel.com with ESMTP; 23 Dec 2020 23:06:02 -0800 From: Jeff Guo To: qi.z.zhang@intel.com, jingjing.wu@intel.com, qiming.yang@intel.com, haiyue.wang@intel.com Cc: dev@dpdk.org, jia.guo@intel.com, simei.su@intel.com Date: Thu, 24 Dec 2020 15:01:56 +0800 Message-Id: <20201224070157.76971-6-jia.guo@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201224070157.76971-1-jia.guo@intel.com> References: <20201216085854.7842-1-jia.guo@intel.com> <20201224070157.76971-1-jia.guo@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [dpdk-dev v2 5/6] net/iavf: add PTYPE mapping for ecpri X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Until the new ecpri PTYPE be added into the RTE lib, just mapping ecpri to the PTYPE of RTE_PTYPE_L4_UDP in iavf pmd. Signed-off-by: Jeff Guo --- drivers/net/iavf/iavf_rxtx.c | 44 ++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index 21d508b3f4..2800dd6250 100644 --- a/drivers/net/iavf/iavf_rxtx.c +++ b/drivers/net/iavf/iavf_rxtx.c @@ -3193,6 +3193,50 @@ iavf_get_default_ptype_table(void) RTE_PTYPE_TUNNEL_GTPU | RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_ICMP, + + /* IPv4 --> UDP ECPRI */ + [372] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | + RTE_PTYPE_L4_UDP, + [373] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | + RTE_PTYPE_L4_UDP, + [374] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | + RTE_PTYPE_L4_UDP, + [375] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | + RTE_PTYPE_L4_UDP, + [376] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | + RTE_PTYPE_L4_UDP, + [377] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | + RTE_PTYPE_L4_UDP, + [378] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | + RTE_PTYPE_L4_UDP, + [379] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | + RTE_PTYPE_L4_UDP, + [380] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | + RTE_PTYPE_L4_UDP, + [381] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | + RTE_PTYPE_L4_UDP, + + /* IPV6 --> UDP ECPRI */ + [382] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | + RTE_PTYPE_L4_UDP, + [383] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | + RTE_PTYPE_L4_UDP, + [384] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | + RTE_PTYPE_L4_UDP, + [385] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | + RTE_PTYPE_L4_UDP, + [386] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | + RTE_PTYPE_L4_UDP, + [387] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | + RTE_PTYPE_L4_UDP, + [388] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | + RTE_PTYPE_L4_UDP, + [389] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | + RTE_PTYPE_L4_UDP, + [390] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | + RTE_PTYPE_L4_UDP, + [391] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | + RTE_PTYPE_L4_UDP, /* All others reserved */ }; From patchwork Thu Dec 24 07:01:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guo, Jia" X-Patchwork-Id: 85710 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7066CA09FF; Thu, 24 Dec 2020 08:07:55 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BFF65CA86; Thu, 24 Dec 2020 08:06:14 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id CF2A8CA2E for ; Thu, 24 Dec 2020 08:06:08 +0100 (CET) IronPort-SDR: dNOVA4/xbHMmu6C1fWUcHbf570Uts6pT6HklvsMU0Rpn0HDBfYSpBwZfLw0GN53c8cy77X9ATC tjdFKX+daG3w== X-IronPort-AV: E=McAfee;i="6000,8403,9844"; a="175342420" X-IronPort-AV: E=Sophos;i="5.78,444,1599548400"; d="scan'208";a="175342420" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Dec 2020 23:06:08 -0800 IronPort-SDR: 2Pj/NsSGJgZdb105BgAiB7YMogb6FZhlSk86zIjtfzs48MW67d9ReCdHJy+X2AQIRCZC4On07t 7mZUJGlBdaXQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,444,1599548400"; d="scan'208";a="374282172" Received: from npg-dpdk-cvl-jeffguo-01.sh.intel.com ([10.67.111.128]) by orsmga008.jf.intel.com with ESMTP; 23 Dec 2020 23:06:05 -0800 From: Jeff Guo To: qi.z.zhang@intel.com, jingjing.wu@intel.com, qiming.yang@intel.com, haiyue.wang@intel.com Cc: dev@dpdk.org, jia.guo@intel.com, simei.su@intel.com Date: Thu, 24 Dec 2020 15:01:57 +0800 Message-Id: <20201224070157.76971-7-jia.guo@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201224070157.76971-1-jia.guo@intel.com> References: <20201216085854.7842-1-jia.guo@intel.com> <20201224070157.76971-1-jia.guo@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [dpdk-dev v2 6/6] net/ice: enable ecpri tunnel port configure in dcf X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Add ecpri tunnel port add and rm ops to configure ecpri udp tunnel port in dcf. Signed-off-by: Jeff Guo --- drivers/net/ice/ice_dcf_ethdev.c | 67 ++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c index b0b2ecb0d6..08265db79f 100644 --- a/drivers/net/ice/ice_dcf_ethdev.c +++ b/drivers/net/ice/ice_dcf_ethdev.c @@ -26,6 +26,13 @@ #include "ice_dcf_ethdev.h" #include "ice_rxtx.h" +static int +ice_dcf_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel); +static int +ice_dcf_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel); + static uint16_t ice_dcf_recv_pkts(__rte_unused void *rx_queue, __rte_unused struct rte_mbuf **bufs, @@ -870,6 +877,64 @@ ice_dcf_link_update(__rte_unused struct rte_eth_dev *dev, return 0; } +/* Add UDP tunneling port */ +static int +ice_dcf_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel) +{ + struct ice_dcf_adapter *adapter = dev->data->dev_private; + struct ice_adapter *parent_adapter = &adapter->parent; + struct ice_hw *parent_hw = &parent_adapter->hw; + int ret = 0; + + if (!udp_tunnel) + return -EINVAL; + + switch (udp_tunnel->prot_type) { + case RTE_TUNNEL_TYPE_VXLAN: + ret = ice_create_tunnel(parent_hw, TNL_VXLAN, + udp_tunnel->udp_port); + break; + case RTE_TUNNEL_TYPE_ECPRI: + ret = ice_create_tunnel(parent_hw, TNL_ECPRI, + udp_tunnel->udp_port); + break; + default: + PMD_DRV_LOG(ERR, "Invalid tunnel type"); + ret = -EINVAL; + break; + } + + return ret; +} + +/* Delete UDP tunneling port */ +static int +ice_dcf_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, + struct rte_eth_udp_tunnel *udp_tunnel) +{ + struct ice_dcf_adapter *adapter = dev->data->dev_private; + struct ice_adapter *parent_adapter = &adapter->parent; + struct ice_hw *parent_hw = &parent_adapter->hw; + int ret = 0; + + if (!udp_tunnel) + return -EINVAL; + + switch (udp_tunnel->prot_type) { + case RTE_TUNNEL_TYPE_VXLAN: + case RTE_TUNNEL_TYPE_ECPRI: + ret = ice_destroy_tunnel(parent_hw, udp_tunnel->udp_port, 0); + break; + default: + PMD_DRV_LOG(ERR, "Invalid tunnel type"); + ret = -EINVAL; + break; + } + + return ret; +} + static const struct eth_dev_ops ice_dcf_eth_dev_ops = { .dev_start = ice_dcf_dev_start, .dev_stop = ice_dcf_dev_stop, @@ -892,6 +957,8 @@ static const struct eth_dev_ops ice_dcf_eth_dev_ops = { .allmulticast_enable = ice_dcf_dev_allmulticast_enable, .allmulticast_disable = ice_dcf_dev_allmulticast_disable, .filter_ctrl = ice_dcf_dev_filter_ctrl, + .udp_tunnel_port_add = ice_dcf_dev_udp_tunnel_port_add, + .udp_tunnel_port_del = ice_dcf_dev_udp_tunnel_port_del, }; static int