DPDK patches and discussions
 help / color / mirror / Atom feed
From: Yuying Zhang <yuying.zhang@intel.com>
To: dev@dpdk.org, qi.z.zhang@intel.com
Cc: Yuying Zhang <yuying.zhang@intel.com>
Subject: [dpdk-dev] [PATCH RFC 2/2] net/ice: support drop any and steer all to queue
Date: Mon, 30 Aug 2021 07:56:47 +0000	[thread overview]
Message-ID: <20210830075647.3011046-2-yuying.zhang@intel.com> (raw)
In-Reply-To: <20210830075647.3011046-1-yuying.zhang@intel.com>

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 <yuying.zhang@intel.com>
---
 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:
-- 
2.25.1


      reply	other threads:[~2021-08-30  8:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-30  7:56 [dpdk-dev] [PATCH RFC 1/2] net/ice/base: " Yuying Zhang
2021-08-30  7:56 ` Yuying Zhang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210830075647.3011046-2-yuying.zhang@intel.com \
    --to=yuying.zhang@intel.com \
    --cc=dev@dpdk.org \
    --cc=qi.z.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).