patches for DPDK stable branches
 help / color / Atom feed
From: Wei Zhao <wei.zhao1@intel.com>
To: dev@dpdk.org
Cc: stable@dpdk.org, qi.z.zhang@intel.com, nannan.lu@intel.com,
	Wei Zhao <wei.zhao1@intel.com>
Subject: [dpdk-stable] [PATCH v5 1/5] net/ice: add support more PPPoE packet type for switch
Date: Mon, 29 Jun 2020 13:10:26 +0800
Message-ID: <20200629051030.3541-2-wei.zhao1@intel.com> (raw)
In-Reply-To: <20200629051030.3541-1-wei.zhao1@intel.com>

This patch add more support for switch parser of pppoe packet,
it enable parse tcp/udp L4 layer and ipv4/ipv6 L3 layer parser for
pppoe payload, so we can use L4 dst/src port and L3 ip address as
input set for switch filter pppoe related rule.

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
---
 doc/guides/rel_notes/release_20_08.rst |   1 +
 drivers/net/ice/ice_switch_filter.c    | 115 +++++++++++++++++++++----
 2 files changed, 101 insertions(+), 15 deletions(-)

diff --git a/doc/guides/rel_notes/release_20_08.rst b/doc/guides/rel_notes/release_20_08.rst
index 3c40424cc..90b58a027 100644
--- a/doc/guides/rel_notes/release_20_08.rst
+++ b/doc/guides/rel_notes/release_20_08.rst
@@ -86,6 +86,7 @@ New Features
   Updated the Intel ice driver with new features and improvements, including:
 
   * Added support for DCF datapath configuration.
+  * Added support for more PPPoE packet type for switch filter.
 
 Removed Items
 -------------
diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c
index 5ccd020c5..3c0c36bce 100644
--- a/drivers/net/ice/ice_switch_filter.c
+++ b/drivers/net/ice/ice_switch_filter.c
@@ -26,6 +26,8 @@
 
 
 #define MAX_QGRP_NUM_TYPE 7
+#define ICE_PPP_IPV4_PROTO	0x0021
+#define ICE_PPP_IPV6_PROTO	0x0057
 
 #define ICE_SW_INSET_ETHER ( \
 	ICE_INSET_DMAC | ICE_INSET_SMAC | ICE_INSET_ETHERTYPE)
@@ -95,6 +97,18 @@
 	ICE_INSET_VLAN_OUTER | ICE_INSET_VLAN_INNER | \
 	ICE_INSET_DMAC | ICE_INSET_ETHERTYPE | ICE_INSET_PPPOE_SESSION | \
 	ICE_INSET_PPPOE_PROTO)
+#define ICE_SW_INSET_MAC_PPPOE_IPV4 ( \
+	ICE_SW_INSET_MAC_PPPOE | ICE_SW_INSET_MAC_IPV4)
+#define ICE_SW_INSET_MAC_PPPOE_IPV4_TCP ( \
+	ICE_SW_INSET_MAC_PPPOE | ICE_SW_INSET_MAC_IPV4_TCP)
+#define ICE_SW_INSET_MAC_PPPOE_IPV4_UDP ( \
+	ICE_SW_INSET_MAC_PPPOE | ICE_SW_INSET_MAC_IPV4_UDP)
+#define ICE_SW_INSET_MAC_PPPOE_IPV6 ( \
+	ICE_SW_INSET_MAC_PPPOE | ICE_SW_INSET_MAC_IPV6)
+#define ICE_SW_INSET_MAC_PPPOE_IPV6_TCP ( \
+	ICE_SW_INSET_MAC_PPPOE | ICE_SW_INSET_MAC_IPV6_TCP)
+#define ICE_SW_INSET_MAC_PPPOE_IPV6_UDP ( \
+	ICE_SW_INSET_MAC_PPPOE | ICE_SW_INSET_MAC_IPV6_UDP)
 #define ICE_SW_INSET_MAC_IPV4_ESP ( \
 	ICE_SW_INSET_MAC_IPV4 | ICE_INSET_ESP_SPI)
 #define ICE_SW_INSET_MAC_IPV6_ESP ( \
@@ -154,10 +168,6 @@ ice_pattern_match_item ice_switch_pattern_dist_comms[] = {
 			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},
-	{pattern_eth_pppoed,
-			ICE_SW_INSET_MAC_PPPOE, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoed,
-			ICE_SW_INSET_MAC_PPPOE, ICE_INSET_NONE},
 	{pattern_eth_pppoes,
 			ICE_SW_INSET_MAC_PPPOE, ICE_INSET_NONE},
 	{pattern_eth_vlan_pppoes,
@@ -166,6 +176,30 @@ ice_pattern_match_item ice_switch_pattern_dist_comms[] = {
 			ICE_SW_INSET_MAC_PPPOE_PROTO, ICE_INSET_NONE},
 	{pattern_eth_vlan_pppoes_proto,
 			ICE_SW_INSET_MAC_PPPOE_PROTO, ICE_INSET_NONE},
+	{pattern_eth_pppoes_ipv4,
+			ICE_SW_INSET_MAC_PPPOE_IPV4, ICE_INSET_NONE},
+	{pattern_eth_pppoes_ipv4_tcp,
+			ICE_SW_INSET_MAC_PPPOE_IPV4_TCP, ICE_INSET_NONE},
+	{pattern_eth_pppoes_ipv4_udp,
+			ICE_SW_INSET_MAC_PPPOE_IPV4_UDP, ICE_INSET_NONE},
+	{pattern_eth_pppoes_ipv6,
+			ICE_SW_INSET_MAC_PPPOE_IPV6, ICE_INSET_NONE},
+	{pattern_eth_pppoes_ipv6_tcp,
+			ICE_SW_INSET_MAC_PPPOE_IPV6_TCP, ICE_INSET_NONE},
+	{pattern_eth_pppoes_ipv6_udp,
+			ICE_SW_INSET_MAC_PPPOE_IPV6_UDP, ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes_ipv4,
+			ICE_SW_INSET_MAC_PPPOE_IPV4, ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes_ipv4_tcp,
+			ICE_SW_INSET_MAC_PPPOE_IPV4_TCP, ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes_ipv4_udp,
+			ICE_SW_INSET_MAC_PPPOE_IPV4_UDP, ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes_ipv6,
+			ICE_SW_INSET_MAC_PPPOE_IPV6, ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes_ipv6_tcp,
+			ICE_SW_INSET_MAC_PPPOE_IPV6_TCP, ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes_ipv6_udp,
+			ICE_SW_INSET_MAC_PPPOE_IPV6_UDP, ICE_INSET_NONE},
 	{pattern_eth_ipv4_esp,
 			ICE_SW_INSET_MAC_IPV4_ESP, ICE_INSET_NONE},
 	{pattern_eth_ipv4_udp_esp,
@@ -254,10 +288,6 @@ ice_pattern_match_item ice_switch_pattern_perm[] = {
 			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},
-	{pattern_eth_pppoed,
-			ICE_SW_INSET_MAC_PPPOE, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoed,
-			ICE_SW_INSET_MAC_PPPOE, ICE_INSET_NONE},
 	{pattern_eth_pppoes,
 			ICE_SW_INSET_MAC_PPPOE, ICE_INSET_NONE},
 	{pattern_eth_vlan_pppoes,
@@ -266,6 +296,30 @@ ice_pattern_match_item ice_switch_pattern_perm[] = {
 			ICE_SW_INSET_MAC_PPPOE_PROTO, ICE_INSET_NONE},
 	{pattern_eth_vlan_pppoes_proto,
 			ICE_SW_INSET_MAC_PPPOE_PROTO, ICE_INSET_NONE},
+	{pattern_eth_pppoes_ipv4,
+			ICE_SW_INSET_MAC_PPPOE_IPV4, ICE_INSET_NONE},
+	{pattern_eth_pppoes_ipv4_tcp,
+			ICE_SW_INSET_MAC_PPPOE_IPV4_TCP, ICE_INSET_NONE},
+	{pattern_eth_pppoes_ipv4_udp,
+			ICE_SW_INSET_MAC_PPPOE_IPV4_UDP, ICE_INSET_NONE},
+	{pattern_eth_pppoes_ipv6,
+			ICE_SW_INSET_MAC_PPPOE_IPV6, ICE_INSET_NONE},
+	{pattern_eth_pppoes_ipv6_tcp,
+			ICE_SW_INSET_MAC_PPPOE_IPV6_TCP, ICE_INSET_NONE},
+	{pattern_eth_pppoes_ipv6_udp,
+			ICE_SW_INSET_MAC_PPPOE_IPV6_UDP, ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes_ipv4,
+			ICE_SW_INSET_MAC_PPPOE_IPV4, ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes_ipv4_tcp,
+			ICE_SW_INSET_MAC_PPPOE_IPV4_TCP, ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes_ipv4_udp,
+			ICE_SW_INSET_MAC_PPPOE_IPV4_UDP, ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes_ipv6,
+			ICE_SW_INSET_MAC_PPPOE_IPV6, ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes_ipv6_tcp,
+			ICE_SW_INSET_MAC_PPPOE_IPV6_TCP, ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes_ipv6_udp,
+			ICE_SW_INSET_MAC_PPPOE_IPV6_UDP, ICE_INSET_NONE},
 	{pattern_eth_ipv4_esp,
 			ICE_SW_INSET_MAC_IPV4_ESP, ICE_INSET_NONE},
 	{pattern_eth_ipv4_udp_esp,
@@ -416,13 +470,16 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 	const struct rte_flow_item_l2tpv3oip *l2tp_spec, *l2tp_mask;
 	const struct rte_flow_item_pfcp *pfcp_spec, *pfcp_mask;
 	uint64_t input_set = ICE_INSET_NONE;
-	uint16_t j, t = 0;
+	bool pppoe_elem_valid = 0;
+	bool pppoe_patt_valid = 0;
+	bool pppoe_prot_valid = 0;
 	bool profile_rule = 0;
 	bool tunnel_valid = 0;
-	bool pppoe_valid = 0;
 	bool ipv6_valiad = 0;
 	bool ipv4_valiad = 0;
 	bool udp_valiad = 0;
+	bool tcp_valiad = 0;
+	uint16_t j, t = 0;
 
 	for (item = pattern; item->type !=
 			RTE_FLOW_ITEM_TYPE_END; item++) {
@@ -752,6 +809,7 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 		case RTE_FLOW_ITEM_TYPE_TCP:
 			tcp_spec = item->spec;
 			tcp_mask = item->mask;
+			tcp_valiad = 1;
 			if (tcp_spec && tcp_mask) {
 				/* Check TCP mask and update input set */
 				if (tcp_mask->hdr.sent_seq ||
@@ -969,6 +1027,7 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 					"Invalid pppoe item");
 				return 0;
 			}
+			pppoe_patt_valid = 1;
 			if (pppoe_spec && pppoe_mask) {
 				/* Check pppoe mask and update input set */
 				if (pppoe_mask->length ||
@@ -989,7 +1048,7 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 					input_set |= ICE_INSET_PPPOE_SESSION;
 				}
 				t++;
-				pppoe_valid = 1;
+				pppoe_elem_valid = 1;
 			}
 			break;
 
@@ -1010,7 +1069,7 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 				return 0;
 			}
 			if (pppoe_proto_spec && pppoe_proto_mask) {
-				if (pppoe_valid)
+				if (pppoe_elem_valid)
 					t--;
 				list[t].type = ICE_PPPOE;
 				if (pppoe_proto_mask->proto_id) {
@@ -1019,9 +1078,21 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 					list[t].m_u.pppoe_hdr.ppp_prot_id =
 						pppoe_proto_mask->proto_id;
 					input_set |= ICE_INSET_PPPOE_PROTO;
+
+					pppoe_prot_valid = 1;
 				}
+				if ((pppoe_proto_mask->proto_id &
+					pppoe_proto_spec->proto_id) !=
+					    CPU_TO_BE16(ICE_PPP_IPV4_PROTO) &&
+					(pppoe_proto_mask->proto_id &
+					pppoe_proto_spec->proto_id) !=
+					    CPU_TO_BE16(ICE_PPP_IPV6_PROTO))
+					*tun_type = ICE_SW_TUN_PPPOE_PAY;
+				else
+					*tun_type = ICE_SW_TUN_PPPOE;
 				t++;
 			}
+
 			break;
 
 		case RTE_FLOW_ITEM_TYPE_ESP:
@@ -1232,6 +1303,23 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 		}
 	}
 
+	if (pppoe_patt_valid && !pppoe_prot_valid) {
+		if (ipv6_valiad && udp_valiad)
+			*tun_type = ICE_SW_TUN_PPPOE_IPV6_UDP;
+		else if (ipv6_valiad && tcp_valiad)
+			*tun_type = ICE_SW_TUN_PPPOE_IPV6_TCP;
+		else if (ipv4_valiad && udp_valiad)
+			*tun_type = ICE_SW_TUN_PPPOE_IPV4_UDP;
+		else if (ipv4_valiad && tcp_valiad)
+			*tun_type = ICE_SW_TUN_PPPOE_IPV4_TCP;
+		else if (ipv6_valiad)
+			*tun_type = ICE_SW_TUN_PPPOE_IPV6;
+		else if (ipv4_valiad)
+			*tun_type = ICE_SW_TUN_PPPOE_IPV4;
+		else
+			*tun_type = ICE_SW_TUN_PPPOE;
+	}
+
 	*lkups_num = t;
 
 	return input_set;
@@ -1447,9 +1535,6 @@ ice_switch_parse_pattern_action(struct ice_adapter *ad,
 			tun_type = ICE_SW_TUN_VXLAN;
 		if (item->type == RTE_FLOW_ITEM_TYPE_NVGRE)
 			tun_type = ICE_SW_TUN_NVGRE;
-		if (item->type == RTE_FLOW_ITEM_TYPE_PPPOED ||
-				item->type == RTE_FLOW_ITEM_TYPE_PPPOES)
-			tun_type = ICE_SW_TUN_PPPOE;
 		if (item->type == RTE_FLOW_ITEM_TYPE_ETH) {
 			const struct rte_flow_item_eth *eth_mask;
 			if (item->mask)
-- 
2.19.1


  reply index

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200605074031.16231-1-wei.zhao1@intel.com>
2020-06-05  7:40 ` [dpdk-stable] [PATCH 2/4] net/ice: add redirect support for VSI list rule Wei Zhao
2020-06-05  7:40 ` [dpdk-stable] [PATCH 3/4] net/ice: add check for NVGRE protocol Wei Zhao
2020-06-05  7:40 ` [dpdk-stable] [PATCH 4/4] net/ice: support switch flow for specific L4 type Wei Zhao
2020-06-17  6:14 ` [dpdk-stable] [PATCH v2 0/4] enable more PPPoE packet type for switch Wei Zhao
2020-06-17  6:14   ` [dpdk-stable] [PATCH v2 1/4] net/ice: add support " Wei Zhao
2020-06-17  6:14   ` [dpdk-stable] [PATCH v2 2/4] net/ice: add redirect support for VSI list rule Wei Zhao
2020-06-22 15:25     ` Zhang, Qi Z
2020-06-17  6:14   ` [dpdk-stable] [PATCH v2 3/4] net/ice: add check for NVGRE protocol Wei Zhao
2020-06-22 15:49     ` Zhang, Qi Z
2020-06-23  1:11       ` Zhao1, Wei
2020-06-17  6:14   ` [dpdk-stable] [PATCH v2 4/4] net/ice: support switch flow for specific L4 type Wei Zhao
2020-06-22 15:36     ` Zhang, Qi Z
2020-06-23  1:12       ` Zhao1, Wei
2020-06-28  3:21   ` [dpdk-stable] [PATCH v3 0/4] enable more PPPoE packet type for switch Wei Zhao
2020-06-28  3:21     ` [dpdk-stable] [PATCH v3 1/4] net/ice: add support " Wei Zhao
2020-06-28  3:21     ` [dpdk-stable] [PATCH v3 2/4] net/ice: fix tunnel type for switch rule Wei Zhao
2020-06-28  3:21     ` [dpdk-stable] [PATCH v3 3/4] net/ice: support switch flow for specific L4 type Wei Zhao
2020-06-28  3:21     ` [dpdk-stable] [PATCH v3 4/4] net/ice: add input set byte number check Wei Zhao
2020-06-28  5:01   ` [dpdk-stable] [PATCH v3 0/4] enable more PPPoE packet type for switch Wei Zhao
2020-06-28  5:01     ` [dpdk-stable] [PATCH v3 1/4] net/ice: add support " Wei Zhao
2020-06-28  5:01     ` [dpdk-stable] [PATCH v3 2/4] net/ice: fix tunnel type for switch rule Wei Zhao
2020-06-28  5:01     ` [dpdk-stable] [PATCH v3 3/4] net/ice: support switch flow for specific L4 type Wei Zhao
2020-06-29  1:55       ` Zhang, Qi Z
2020-06-29  2:01         ` Zhao1, Wei
2020-06-28  5:01     ` [dpdk-stable] [PATCH v3 4/4] net/ice: add input set byte number check Wei Zhao
2020-06-28  5:28     ` [dpdk-stable] [PATCH v4 0/4] enable more PPPoE packet type for switch Wei Zhao
2020-06-28  5:28       ` [dpdk-stable] [PATCH v4 1/4] net/ice: add support " Wei Zhao
2020-06-28  5:28       ` [dpdk-stable] [PATCH v4 2/4] net/ice: fix tunnel type for switch rule Wei Zhao
2020-06-28  5:28       ` [dpdk-stable] [PATCH v4 3/4] net/ice: support switch flow for specific L4 type Wei Zhao
2020-06-28  5:28       ` [dpdk-stable] [PATCH v4 4/4] net/ice: add input set byte number check Wei Zhao
2020-06-29  5:10       ` [dpdk-stable] [PATCH v5 0/5] enable more PPPoE packet type for switch Wei Zhao
2020-06-29  5:10         ` Wei Zhao [this message]
2020-06-29  5:10         ` [dpdk-stable] [PATCH v5 2/5] net/ice: fix tunnel type for switch rule Wei Zhao
2020-06-29  5:10         ` [dpdk-stable] [PATCH v5 3/5] net/ice: support switch flow for specific L4 type Wei Zhao
2020-06-29  5:10         ` [dpdk-stable] [PATCH v5 4/5] net/ice: add input set byte number check Wei Zhao
2020-06-29  5:10         ` [dpdk-stable] [PATCH v5 5/5] net/ice: fix typo Wei Zhao
2020-07-03  2:47         ` [dpdk-stable] [PATCH v5 0/5] enable more PPPoE packet type for switch Lu, Nannan
2020-07-03  6:19         ` [dpdk-stable] [PATCH v6 " Wei Zhao
2020-07-03  6:19           ` [dpdk-stable] [PATCH v6 1/5] net/ice: add support more PPPoE packeat " Wei Zhao
2020-07-03  6:19           ` [dpdk-stable] [PATCH v6 2/5] net/ice: fix tunnel type for switch rule Wei Zhao
2020-07-03  6:19           ` [dpdk-stable] [PATCH v6 3/5] net/ice: support switch flow for specific L4 type Wei Zhao
2020-07-03  6:19           ` [dpdk-stable] [PATCH v6 4/5] net/ice: add input set byte number check Wei Zhao
2020-07-03  6:19           ` [dpdk-stable] [PATCH v6 5/5] net/ice: fix typo Wei Zhao
2020-07-03 13:46           ` [dpdk-stable] [PATCH v6 0/5] enable more PPPoE packet type for switch Zhang, Qi Z

Reply instructions:

You may reply publically 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=20200629051030.3541-2-wei.zhao1@intel.com \
    --to=wei.zhao1@intel.com \
    --cc=dev@dpdk.org \
    --cc=nannan.lu@intel.com \
    --cc=qi.z.zhang@intel.com \
    --cc=stable@dpdk.org \
    /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

patches for DPDK stable branches

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ http://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/ public-inbox