From patchwork Mon Aug 30 07:56:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Yuying" X-Patchwork-Id: 97534 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 86DCFA034F; Mon, 30 Aug 2021 10:13:49 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 04A2241134; Mon, 30 Aug 2021 10:13:45 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id B7DA0410FA for ; Mon, 30 Aug 2021 10:13:43 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10091"; a="218272776" X-IronPort-AV: E=Sophos;i="5.84,362,1620716400"; d="scan'208";a="218272776" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Aug 2021 01:13:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,362,1620716400"; d="scan'208";a="540244825" Received: from dpdk-yyzhang2.sh.intel.com ([10.67.117.158]) by fmsmga002.fm.intel.com with ESMTP; 30 Aug 2021 01:13:41 -0700 From: Yuying Zhang To: dev@dpdk.org, qi.z.zhang@intel.com Cc: Yuying Zhang Date: Mon, 30 Aug 2021 07:56:47 +0000 Message-Id: <20210830075647.3011046-2-yuying.zhang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210830075647.3011046-1-yuying.zhang@intel.com> References: <20210830075647.3011046-1-yuying.zhang@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH RFC 2/2] net/ice: support drop any and steer all to queue X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" This patch supports drop any and steer all to queue in switch filter. Support new rte_flow pattern any to handle all packets. The usage is listed below. 1. drop any: flow create 0 ingress pattern any / end actions drop / end All packets received in port 0 will be dropped. 2. steer all to queue: flow create 0 ingress pattern any / end actions queue index 3 / end All packets received in port 0 will be steered to queue 3. Signed-off-by: Yuying Zhang --- drivers/net/ice/ice_generic_flow.c | 7 +++++++ drivers/net/ice/ice_generic_flow.h | 3 +++ drivers/net/ice/ice_switch_filter.c | 9 +++++++++ 3 files changed, 19 insertions(+) diff --git a/drivers/net/ice/ice_generic_flow.c b/drivers/net/ice/ice_generic_flow.c index 25d15a8adb..7ab0f4be24 100644 --- a/drivers/net/ice/ice_generic_flow.c +++ b/drivers/net/ice/ice_generic_flow.c @@ -65,6 +65,12 @@ enum rte_flow_item_type pattern_empty[] = { RTE_FLOW_ITEM_TYPE_END, }; +/* any */ +enum rte_flow_item_type pattern_any[] = { + RTE_FLOW_ITEM_TYPE_ANY, + RTE_FLOW_ITEM_TYPE_END, +}; + /* L2 */ enum rte_flow_item_type pattern_ethertype[] = { RTE_FLOW_ITEM_TYPE_ETH, @@ -2152,6 +2158,7 @@ static struct ice_ptype_match ice_ptype_map[] = { {pattern_eth_ipv4_nvgre_eth_ipv4_udp, ICE_MAC_IPV4_TUN_IPV4_UDP_PAY}, {pattern_eth_ipv4_nvgre_eth_ipv4_tcp, ICE_MAC_IPV4_TUN_IPV4_TCP}, {pattern_empty, 0}, + {pattern_any, 0}, }; static bool diff --git a/drivers/net/ice/ice_generic_flow.h b/drivers/net/ice/ice_generic_flow.h index 18918769d2..69d3698026 100644 --- a/drivers/net/ice/ice_generic_flow.h +++ b/drivers/net/ice/ice_generic_flow.h @@ -207,6 +207,9 @@ /* empty pattern */ extern enum rte_flow_item_type pattern_empty[]; +/* any */ +extern enum rte_flow_item_type pattern_any[]; + /* L2 */ extern enum rte_flow_item_type pattern_ethertype[]; extern enum rte_flow_item_type pattern_ethertype_vlan[]; diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c index 6525e6c115..93399a0291 100644 --- a/drivers/net/ice/ice_switch_filter.c +++ b/drivers/net/ice/ice_switch_filter.c @@ -247,6 +247,8 @@ ice_pattern_match_item ice_switch_pattern_dist_list[] = { ICE_SW_INSET_MAC_PPPOE_IPV4, ICE_INSET_NONE}, {pattern_eth_qinq_pppoes_ipv6, ICE_SW_INSET_MAC_PPPOE_IPV6, ICE_INSET_NONE}, + {pattern_any, + ICE_INSET_NONE, ICE_INSET_NONE}, }; static struct @@ -349,6 +351,8 @@ ice_pattern_match_item ice_switch_pattern_perm_list[] = { ICE_SW_INSET_MAC_PPPOE_IPV4, ICE_INSET_NONE}, {pattern_eth_qinq_pppoes_ipv6, ICE_SW_INSET_MAC_PPPOE_IPV6, ICE_INSET_NONE}, + {pattern_any, + ICE_INSET_NONE, ICE_INSET_NONE}, }; static int @@ -505,6 +509,10 @@ ice_switch_inset_get(const struct rte_flow_item pattern[], item_type = item->type; switch (item_type) { + case RTE_FLOW_ITEM_TYPE_ANY: + *tun_type = ICE_ANY; + break; + case RTE_FLOW_ITEM_TYPE_ETH: eth_spec = item->spec; eth_mask = item->mask; @@ -1628,6 +1636,7 @@ static bool ice_is_profile_rule(enum ice_sw_tunnel_type tun_type) { switch (tun_type) { + case ICE_ANY: case ICE_SW_TUN_PROFID_IPV6_ESP: case ICE_SW_TUN_PROFID_IPV6_AH: case ICE_SW_TUN_PROFID_MAC_IPV6_L2TPV3: