From patchwork Tue Sep 8 03:15:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guinan Sun X-Patchwork-Id: 76822 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 26EA4A04AA; Tue, 8 Sep 2020 05:19:45 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 898031C134; Tue, 8 Sep 2020 05:19:44 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 54E3A1C133; Tue, 8 Sep 2020 05:19:42 +0200 (CEST) IronPort-SDR: EY6umrfu9Tfg30C/krCbR+HYf0p3lS8fppvloLro2U2hANroZ3OXX5qViMAgssOM3uwkMUpgi0 ptPnw9v+pm2g== X-IronPort-AV: E=McAfee;i="6000,8403,9737"; a="219625038" X-IronPort-AV: E=Sophos;i="5.76,404,1592895600"; d="scan'208";a="219625038" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Sep 2020 20:19:41 -0700 IronPort-SDR: iSxcrh61nXbbbkvmrvq4nC1botboymHsIjcGgKo/o6pPK7dkdERSE1dETfLptQhadFGCol7eGd WeCFAFg/K4zw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,404,1592895600"; d="scan'208";a="406997367" Received: from dpdk57.sh.intel.com (HELO localhost.localdomain) ([10.239.255.57]) by fmsmga001.fm.intel.com with ESMTP; 07 Sep 2020 20:19:39 -0700 From: Guinan Sun To: dev@dpdk.org Cc: Qi Zhang , Qiming Yang , Guinan Sun , stable@dpdk.org Date: Tue, 8 Sep 2020 03:15:05 +0000 Message-Id: <20200908031505.73237-1-guinanx.sun@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200828023328.62492-1-guinanx.sun@intel.com> References: <20200828023328.62492-1-guinanx.sun@intel.com> Subject: [dpdk-dev] [PATCH v2] net/ice: fix flow validation for unsupported patterns 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" When loading the OS default package and the pipeline mode is enabled by the "pipeline-mode-support=1" operation. In this case, the wrong parser is selected for processing and it will cause the unsupported patterns(pppoes/pfcp/l2tpv3/esp/ah) to be validated successfully. This patch corrects the parser selection issue. Fixes: 47d460d63233 ("net/ice: rework switch filter") Cc: stable@dpdk.org Signed-off-by: Guinan Sun Acked-by: Qi Zhang --- v2: * Add parser selector in pipline-mode. --- drivers/net/ice/ice_switch_filter.c | 100 ++++++++++++++++++++++------ 1 file changed, 81 insertions(+), 19 deletions(-) diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c index 24320ac7d..4dfeeef50 100644 --- a/drivers/net/ice/ice_switch_filter.c +++ b/drivers/net/ice/ice_switch_filter.c @@ -139,7 +139,42 @@ struct sw_meta { 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; +static struct ice_flow_parser ice_switch_perm_parser_os; +static struct ice_flow_parser ice_switch_perm_parser_comms; + +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[] = { @@ -147,6 +182,8 @@ ice_pattern_match_item ice_switch_pattern_dist_comms[] = { 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, @@ -228,7 +265,7 @@ ice_pattern_match_item ice_switch_pattern_dist_comms[] = { }; static struct -ice_pattern_match_item ice_switch_pattern_dist_os[] = { +ice_pattern_match_item ice_switch_pattern_perm_os[] = { {pattern_ethertype, ICE_SW_INSET_ETHER, ICE_INSET_NONE}, {pattern_ethertype_vlan, @@ -248,25 +285,27 @@ ice_pattern_match_item ice_switch_pattern_dist_os[] = { {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}, + ICE_SW_INSET_PERM_TUNNEL_IPV4, ICE_INSET_NONE}, {pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp, - ICE_SW_INSET_DIST_VXLAN_IPV4_UDP, ICE_INSET_NONE}, + ICE_SW_INSET_PERM_TUNNEL_IPV4_UDP, ICE_INSET_NONE}, {pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp, - ICE_SW_INSET_DIST_VXLAN_IPV4_TCP, ICE_INSET_NONE}, + ICE_SW_INSET_PERM_TUNNEL_IPV4_TCP, ICE_INSET_NONE}, {pattern_eth_ipv4_nvgre_eth_ipv4, - ICE_SW_INSET_DIST_NVGRE_IPV4, ICE_INSET_NONE}, + ICE_SW_INSET_PERM_TUNNEL_IPV4, ICE_INSET_NONE}, {pattern_eth_ipv4_nvgre_eth_ipv4_udp, - ICE_SW_INSET_DIST_NVGRE_IPV4_UDP, ICE_INSET_NONE}, + ICE_SW_INSET_PERM_TUNNEL_IPV4_UDP, ICE_INSET_NONE}, {pattern_eth_ipv4_nvgre_eth_ipv4_tcp, - ICE_SW_INSET_DIST_NVGRE_IPV4_TCP, ICE_INSET_NONE}, + ICE_SW_INSET_PERM_TUNNEL_IPV4_TCP, ICE_INSET_NONE}, }; static struct -ice_pattern_match_item ice_switch_pattern_perm[] = { +ice_pattern_match_item ice_switch_pattern_perm_comms[] = { {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, @@ -1813,7 +1852,7 @@ ice_switch_init(struct ice_adapter *ad) { int ret = 0; struct ice_flow_parser *dist_parser; - struct ice_flow_parser *perm_parser = &ice_switch_perm_parser; + struct ice_flow_parser *perm_parser; if (ad->active_pkg_type == ICE_PKG_TYPE_COMMS) dist_parser = &ice_switch_dist_parser_comms; @@ -1822,10 +1861,16 @@ ice_switch_init(struct ice_adapter *ad) else return -EINVAL; - if (ad->devargs.pipe_mode_support) + 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; + ret = ice_register_parser(perm_parser, ad); - else + } else { ret = ice_register_parser(dist_parser, ad); + } return ret; } @@ -1833,17 +1878,25 @@ static void ice_switch_uninit(struct ice_adapter *ad) { struct ice_flow_parser *dist_parser; - struct ice_flow_parser *perm_parser = &ice_switch_perm_parser; + struct ice_flow_parser *perm_parser; if (ad->active_pkg_type == ICE_PKG_TYPE_COMMS) dist_parser = &ice_switch_dist_parser_comms; - else + 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; - if (ad->devargs.pipe_mode_support) ice_unregister_parser(perm_parser, ad); - else + } else { ice_unregister_parser(dist_parser, ad); + } } static struct @@ -1877,10 +1930,19 @@ ice_flow_parser ice_switch_dist_parser_comms = { }; static struct -ice_flow_parser ice_switch_perm_parser = { +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 = { .engine = &ice_switch_engine, - .array = ice_switch_pattern_perm, - .array_len = RTE_DIM(ice_switch_pattern_perm), + .array = ice_switch_pattern_perm_comms, + .array_len = RTE_DIM(ice_switch_pattern_perm_comms), .parse_pattern_action = ice_switch_parse_pattern_action, .stage = ICE_FLOW_STAGE_PERMISSION, };