From patchwork Tue Jan 18 14:57:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Yuying" X-Patchwork-Id: 106001 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 mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 582BEA00C3; Tue, 18 Jan 2022 07:57:18 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id ECB35426EB; Tue, 18 Jan 2022 07:57:15 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 0F601426EA for ; Tue, 18 Jan 2022 07:57:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1642489034; x=1674025034; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=hRR0+PYdlPSgAej0gYF2SVVnG0em0/wiTYj/NuvLLAU=; b=cEgAjLeBjUPhUVka/AIMEGjIv5vjhGO0Mc0uTzQG+NPDC51gXQ0qc3jd NtMgbS6nqiuvb2nTcq+o5AqtkI4nhSGUjWKAz+tFtWsydqvn8MiQPd3oY oRIft73MT7ikB901wLrKEEcJkxLhObwLxwrdLTnqFmBkmvrIWQc9k8yxc qcRJzgZVen5XpDvHGgjQAtEtmiAgzJFh7xxrjKq+g9N7Dq97EFfLvY3cF 6NGJsz6OA/IeuWYjZO9cZXzC4OvZY0dRCADe8snP8lc2v0s6/whVbC+Hm 14EcfEYtyhT8j+pFn7cM96i2DmddnYMoWiqwziZIKM/5IzJNCdiT0DQdd w==; X-IronPort-AV: E=McAfee;i="6200,9189,10230"; a="331103357" X-IronPort-AV: E=Sophos;i="5.88,296,1635231600"; d="scan'208";a="331103357" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jan 2022 22:57:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,296,1635231600"; d="scan'208";a="693294313" Received: from dpdk-yuyingzh-icelake.sh.intel.com ([10.67.116.254]) by orsmga005.jf.intel.com with ESMTP; 17 Jan 2022 22:57:12 -0800 From: Yuying Zhang To: dev@dpdk.org, qi.z.zhang@intel.com Cc: Yuying Zhang Subject: [PATCH v2 2/2] net/ice: support drop any and steer all to queue Date: Tue, 18 Jan 2022 14:57:50 +0000 Message-Id: <20220118145750.718362-2-yuying.zhang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220118145750.718362-1-yuying.zhang@intel.com> References: <20220118145750.718362-1-yuying.zhang@intel.com> MIME-Version: 1.0 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 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 | 6 ++++++ drivers/net/ice/ice_generic_flow.h | 3 +++ drivers/net/ice/ice_switch_filter.c | 6 ++++++ 3 files changed, 15 insertions(+) diff --git a/drivers/net/ice/ice_generic_flow.c b/drivers/net/ice/ice_generic_flow.c index 406a0a953f..53b1c0b69a 100644 --- a/drivers/net/ice/ice_generic_flow.c +++ b/drivers/net/ice/ice_generic_flow.c @@ -65,6 +65,11 @@ enum rte_flow_item_type pattern_empty[] = { RTE_FLOW_ITEM_TYPE_END, }; +enum rte_flow_item_type pattern_any[] = { + RTE_FLOW_ITEM_TYPE_ANY, + RTE_FLOW_ITEM_TYPE_END, +}; + /* raw */ enum rte_flow_item_type pattern_raw[] = { RTE_FLOW_ITEM_TYPE_RAW, @@ -2111,6 +2116,7 @@ struct ice_ptype_match { static struct ice_ptype_match ice_ptype_map[] = { {pattern_raw, ICE_PTYPE_IPV4_PAY}, + {pattern_any, ICE_PTYPE_IPV4_PAY}, {pattern_eth_ipv4, ICE_PTYPE_IPV4_PAY}, {pattern_eth_ipv4_udp, ICE_PTYPE_IPV4_UDP_PAY}, {pattern_eth_ipv4_tcp, ICE_PTYPE_IPV4_TCP_PAY}, diff --git a/drivers/net/ice/ice_generic_flow.h b/drivers/net/ice/ice_generic_flow.h index 1b030c0466..11f51a5c15 100644 --- a/drivers/net/ice/ice_generic_flow.h +++ b/drivers/net/ice/ice_generic_flow.h @@ -124,6 +124,9 @@ /* empty pattern */ extern enum rte_flow_item_type pattern_empty[]; +/* any pattern */ +extern enum rte_flow_item_type pattern_any[]; + /* raw pattern */ extern enum rte_flow_item_type pattern_raw[]; diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c index bd805d9606..60f9a201f7 100644 --- a/drivers/net/ice/ice_switch_filter.c +++ b/drivers/net/ice/ice_switch_filter.c @@ -206,6 +206,7 @@ static struct ice_flow_parser ice_switch_perm_parser; static struct ice_pattern_match_item ice_switch_pattern_dist_list[] = { + {pattern_any, ICE_INSET_NONE, ICE_INSET_NONE, ICE_INSET_NONE}, {pattern_ethertype, ICE_SW_INSET_ETHER, ICE_INSET_NONE, ICE_INSET_NONE}, {pattern_ethertype_vlan, ICE_SW_INSET_MAC_VLAN, ICE_INSET_NONE, ICE_INSET_NONE}, {pattern_ethertype_qinq, ICE_SW_INSET_MAC_QINQ, ICE_INSET_NONE, ICE_INSET_NONE}, @@ -289,6 +290,7 @@ ice_pattern_match_item ice_switch_pattern_dist_list[] = { static struct ice_pattern_match_item ice_switch_pattern_perm_list[] = { + {pattern_any, ICE_INSET_NONE, ICE_INSET_NONE, ICE_INSET_NONE}, {pattern_ethertype, ICE_SW_INSET_ETHER, ICE_INSET_NONE, ICE_INSET_NONE}, {pattern_ethertype_vlan, ICE_SW_INSET_MAC_VLAN, ICE_INSET_NONE, ICE_INSET_NONE}, {pattern_ethertype_qinq, ICE_SW_INSET_MAC_QINQ, ICE_INSET_NONE, ICE_INSET_NONE}, @@ -582,6 +584,10 @@ ice_switch_parse_pattern(const struct rte_flow_item pattern[], item_type = item->type; switch (item_type) { + case RTE_FLOW_ITEM_TYPE_ANY: + *tun_type = ICE_SW_ANY; + break; + case RTE_FLOW_ITEM_TYPE_ETH: eth_spec = item->spec; eth_mask = item->mask;