* [dpdk-dev] [PATCH 0/3] add support for L2TP AH ESP and NAT-T on switch
@ 2020-04-17 8:26 Wei Zhao
2020-04-17 8:26 ` [dpdk-dev] [PATCH 1/3] net/ice/base: add support for " Wei Zhao
` (3 more replies)
0 siblings, 4 replies; 12+ messages in thread
From: Wei Zhao @ 2020-04-17 8:26 UTC (permalink / raw)
To: dev; +Cc: qi.z.zhang, qi.fu
This patch set add switch filter support for AH ESP NAT-T
and L2TP protocol, and use spi or session idas input set
for switch rule.
Wei Zhao (3):
net/ice/base: add support for AH ESP and NAT-T on switch
net/ice/base: add support for L2TP on switch
net/ice: add flow support for AH ESP and L2TP
drivers/net/ice/base/ice_protocol_type.h | 14 +
drivers/net/ice/base/ice_switch.c | 311 +++++++++++++++++++++++
drivers/net/ice/base/ice_switch.h | 2 +
drivers/net/ice/ice_generic_flow.c | 25 ++
drivers/net/ice/ice_generic_flow.h | 23 ++
drivers/net/ice/ice_switch_filter.c | 198 ++++++++++++---
6 files changed, 543 insertions(+), 30 deletions(-)
--
2.19.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [dpdk-dev] [PATCH 1/3] net/ice/base: add support for AH ESP and NAT-T on switch
2020-04-17 8:26 [dpdk-dev] [PATCH 0/3] add support for L2TP AH ESP and NAT-T on switch Wei Zhao
@ 2020-04-17 8:26 ` Wei Zhao
2020-04-17 8:26 ` [dpdk-dev] [PATCH 2/3] net/ice/base: add support for L2TP " Wei Zhao
` (2 subsequent siblings)
3 siblings, 0 replies; 12+ messages in thread
From: Wei Zhao @ 2020-04-17 8:26 UTC (permalink / raw)
To: dev; +Cc: qi.z.zhang, qi.fu, Wei Zhao
Add dummy packet and tunnel type to support
AH ESP and NAT-T on switch, now we can use spi as
input set for swicth rule.
Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
---
drivers/net/ice/base/ice_protocol_type.h | 12 ++
drivers/net/ice/base/ice_switch.c | 235 +++++++++++++++++++++++
drivers/net/ice/base/ice_switch.h | 1 +
3 files changed, 248 insertions(+)
diff --git a/drivers/net/ice/base/ice_protocol_type.h b/drivers/net/ice/base/ice_protocol_type.h
index 3fb065169..2ca7cd8ac 100644
--- a/drivers/net/ice/base/ice_protocol_type.h
+++ b/drivers/net/ice/base/ice_protocol_type.h
@@ -50,6 +50,7 @@ enum ice_protocol_type {
ICE_L2TPV3,
ICE_ESP,
ICE_AH,
+ ICE_NAT_T,
ICE_PROTOCOL_LAST
};
@@ -65,6 +66,12 @@ enum ice_sw_tunnel_type {
*/
ICE_SW_TUN_GTP,
ICE_SW_TUN_PPPOE,
+ ICE_SW_TUN_IPV4_ESP,
+ ICE_SW_TUN_IPV6_ESP,
+ ICE_SW_TUN_IPV4_AH,
+ ICE_SW_TUN_IPV6_AH,
+ ICE_SW_TUN_IPV4_NAT_T,
+ ICE_SW_TUN_IPV6_NAT_T,
ICE_SW_TUN_PROFID_IPV6_ESP,
ICE_SW_TUN_PROFID_IPV6_AH,
ICE_SW_TUN_PROFID_MAC_IPV6_L2TPV3,
@@ -287,6 +294,10 @@ struct ice_ah_hdr {
__be32 seq;
};
+struct ice_nat_t_hdr {
+ struct ice_esp_hdr esp;
+};
+
struct ice_nvgre {
__be16 flags;
__be16 protocol;
@@ -309,6 +320,7 @@ union ice_prot_hdr {
struct ice_l2tpv3_sess_hdr l2tpv3_sess_hdr;
struct ice_esp_hdr esp_hdr;
struct ice_ah_hdr ah_hdr;
+ struct ice_nat_t_hdr nat_t_hdr;
};
/* This is mapping table entry that maps every word within a given protocol
diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c
index 07f8efd65..1da438f5e 100644
--- a/drivers/net/ice/base/ice_switch.c
+++ b/drivers/net/ice/base/ice_switch.c
@@ -590,6 +590,176 @@ static const u8 dummy_pppoe_ipv6_packet[] = {
0x00, 0x00, /* 2 bytes for 4 bytes alignment */
};
+static const struct ice_dummy_pkt_offsets dummy_ipv4_esp_packet_offsets[] = {
+ { ICE_MAC_OFOS, 0 },
+ { ICE_IPV4_OFOS, 14 },
+ { ICE_ESP, 34 },
+ { ICE_PROTOCOL_LAST, 0 },
+};
+
+static const u8 dummy_ipv4_esp_pkt[] = {
+ 0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x08, 0x00,
+
+ 0x45, 0x00, 0x00, 0x1c, /* ICE_IPV4_IL 14 */
+ 0x00, 0x00, 0x40, 0x00,
+ 0x40, 0x32, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+
+ 0x00, 0x00, 0x00, 0x00, /* ICE_ESP 34 */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, /* 2 bytes for 4 bytes alignment */
+};
+
+static const struct ice_dummy_pkt_offsets dummy_ipv6_esp_packet_offsets[] = {
+ { ICE_MAC_OFOS, 0 },
+ { ICE_IPV6_OFOS, 14 },
+ { ICE_ESP, 54 },
+ { ICE_PROTOCOL_LAST, 0 },
+};
+
+static const u8 dummy_ipv6_esp_pkt[] = {
+ 0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x86, 0xDD,
+
+ 0x60, 0x00, 0x00, 0x00, /* ICE_IPV6_OFOS 14 */
+ 0x00, 0x08, 0x32, 0x00, /* Next header ESP */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+
+ 0x00, 0x00, 0x00, 0x00, /* ICE_ESP 54 */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, /* 2 bytes for 4 bytes alignment */
+};
+
+static const struct ice_dummy_pkt_offsets dummy_ipv4_ah_packet_offsets[] = {
+ { ICE_MAC_OFOS, 0 },
+ { ICE_IPV4_OFOS, 14 },
+ { ICE_AH, 34 },
+ { ICE_PROTOCOL_LAST, 0 },
+};
+
+static const u8 dummy_ipv4_ah_pkt[] = {
+ 0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x08, 0x00,
+
+ 0x45, 0x00, 0x00, 0x20, /* ICE_IPV4_IL 14 */
+ 0x00, 0x00, 0x40, 0x00,
+ 0x40, 0x33, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+
+ 0x00, 0x00, 0x00, 0x00, /* ICE_AH 34 */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, /* 2 bytes for 4 bytes alignment */
+};
+
+static const struct ice_dummy_pkt_offsets dummy_ipv6_ah_packet_offsets[] = {
+ { ICE_MAC_OFOS, 0 },
+ { ICE_IPV6_OFOS, 14 },
+ { ICE_AH, 54 },
+ { ICE_PROTOCOL_LAST, 0 },
+};
+
+static const u8 dummy_ipv6_ah_pkt[] = {
+ 0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x86, 0xDD,
+
+ 0x60, 0x00, 0x00, 0x00, /* ICE_IPV6_OFOS 14 */
+ 0x00, 0x0c, 0x33, 0x00, /* Next header AH */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+
+ 0x00, 0x00, 0x00, 0x00, /* ICE_AH 54 */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, /* 2 bytes for 4 bytes alignment */
+};
+
+static const struct ice_dummy_pkt_offsets dummy_ipv4_nat_packet_offsets[] = {
+ { ICE_MAC_OFOS, 0 },
+ { ICE_IPV4_OFOS, 14 },
+ { ICE_UDP_ILOS, 34 },
+ { ICE_NAT_T, 42 },
+ { ICE_PROTOCOL_LAST, 0 },
+};
+
+static const u8 dummy_ipv4_nat_pkt[] = {
+ 0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x08, 0x00,
+
+ 0x45, 0x00, 0x00, 0x24, /* ICE_IPV4_IL 14 */
+ 0x00, 0x00, 0x40, 0x00,
+ 0x40, 0x11, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+
+ 0x00, 0x00, 0x11, 0x94, /* ICE_NAT_T 34 */
+ 0x00, 0x00, 0x00, 0x00,
+
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, /* 2 bytes for 4 bytes alignment */
+};
+
+static const struct ice_dummy_pkt_offsets dummy_ipv6_nat_packet_offsets[] = {
+ { ICE_MAC_OFOS, 0 },
+ { ICE_IPV6_OFOS, 14 },
+ { ICE_UDP_ILOS, 54 },
+ { ICE_NAT_T, 62 },
+ { ICE_PROTOCOL_LAST, 0 },
+};
+
+static const u8 dummy_ipv6_nat_pkt[] = {
+ 0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x86, 0xDD,
+
+ 0x60, 0x00, 0x00, 0x00, /* ICE_IPV6_OFOS 14 */
+ 0x00, 0x10, 0x11, 0x00, /* Next header NAT_T */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+
+ 0x00, 0x00, 0x11, 0x94, /* ICE_NAT_T 54 */
+ 0x00, 0x00, 0x00, 0x00,
+
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, /* 2 bytes for 4 bytes alignment */
+
+};
+
/* this is a recipe to profile association bitmap */
static ice_declare_bitmap(recipe_to_profile[ICE_MAX_NUM_RECIPES],
ICE_MAX_NUM_PROFILES);
@@ -4947,6 +5117,11 @@ static const struct ice_prot_ext_tbl_entry ice_prot_ext[ICE_PROTOCOL_LAST] = {
{ ICE_NVGRE, { 0, 2, 4, 6 } },
{ ICE_GTP, { 8, 10, 12, 14, 16, 18, 20 } },
{ ICE_PPPOE, { 0, 2, 4, 6 } },
+ { ICE_PFCP, { 8, 10, 12, 14, 16, 18, 20, 22 } },
+ { ICE_L2TPV3, { 0, 2, 4, 6, 8, 10 } },
+ { ICE_ESP, { 0, 2, 4, 6 } },
+ { ICE_AH, { 0, 2, 4, 6, 8, 10 } },
+ { ICE_NAT_T, { 8, 10, 12, 14 } },
};
/* The following table describes preferred grouping of recipes.
@@ -4974,6 +5149,11 @@ static const struct ice_protocol_entry ice_prot_id_tbl[ICE_PROTOCOL_LAST] = {
{ ICE_NVGRE, ICE_GRE_OF_HW },
{ ICE_GTP, ICE_UDP_OF_HW },
{ ICE_PPPOE, ICE_PPPOE_HW },
+ { ICE_PFCP, ICE_UDP_ILOS_HW },
+ { ICE_L2TPV3, ICE_L2TPV3_HW },
+ { ICE_ESP, ICE_ESP_HW },
+ { ICE_AH, ICE_AH_HW },
+ { ICE_NAT_T, ICE_UDP_ILOS_HW },
};
/**
@@ -5762,6 +5942,7 @@ ice_get_compat_fv_bitmap(struct ice_hw *hw, struct ice_adv_rule_info *rinfo,
ice_set_bit(ICE_PROFID_MAC_IPV6_L2TPV3, bm);
return;
case ICE_SW_TUN_PROFID_IPV6_NAT_T:
+ case ICE_SW_TUN_IPV6_NAT_T:
ice_set_bit(ICE_PROFID_IPV6_NAT_T, bm);
return;
case ICE_SW_TUN_PROFID_IPV4_PFCP_NODE:
@@ -5776,6 +5957,9 @@ ice_get_compat_fv_bitmap(struct ice_hw *hw, struct ice_adv_rule_info *rinfo,
case ICE_SW_TUN_PROFID_IPV6_PFCP_SESSION:
ice_set_bit(ICE_PROFID_IPV6_PFCP_SESSION, bm);
return;
+ case ICE_SW_TUN_IPV4_NAT_T:
+ ice_set_bit(ICE_PROFID_IPV4_NAT_T, bm);
+ return;
case ICE_SW_TUN_AND_NON_TUN:
default:
prof_type = ICE_PROF_ALL;
@@ -6071,6 +6255,48 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
ipv6 = true;
}
+ if (tun_type == ICE_SW_TUN_IPV4_ESP) {
+ *pkt = dummy_ipv4_esp_pkt;
+ *pkt_len = sizeof(dummy_ipv4_esp_pkt);
+ *offsets = dummy_ipv4_esp_packet_offsets;
+ return;
+ }
+
+ if (tun_type == ICE_SW_TUN_IPV6_ESP) {
+ *pkt = dummy_ipv6_esp_pkt;
+ *pkt_len = sizeof(dummy_ipv6_esp_pkt);
+ *offsets = dummy_ipv6_esp_packet_offsets;
+ return;
+ }
+
+ if (tun_type == ICE_SW_TUN_IPV4_AH) {
+ *pkt = dummy_ipv4_ah_pkt;
+ *pkt_len = sizeof(dummy_ipv4_ah_pkt);
+ *offsets = dummy_ipv4_ah_packet_offsets;
+ return;
+ }
+
+ if (tun_type == ICE_SW_TUN_IPV6_AH) {
+ *pkt = dummy_ipv6_ah_pkt;
+ *pkt_len = sizeof(dummy_ipv6_ah_pkt);
+ *offsets = dummy_ipv6_ah_packet_offsets;
+ return;
+ }
+
+ if (tun_type == ICE_SW_TUN_IPV4_NAT_T) {
+ *pkt = dummy_ipv4_nat_pkt;
+ *pkt_len = sizeof(dummy_ipv4_nat_pkt);
+ *offsets = dummy_ipv4_nat_packet_offsets;
+ return;
+ }
+
+ if (tun_type == ICE_SW_TUN_IPV6_NAT_T) {
+ *pkt = dummy_ipv6_nat_pkt;
+ *pkt_len = sizeof(dummy_ipv6_nat_pkt);
+ *offsets = dummy_ipv6_nat_packet_offsets;
+ return;
+ }
+
if (tun_type == ICE_SW_TUN_GTP) {
*pkt = dummy_udp_gtp_packet;
*pkt_len = sizeof(dummy_udp_gtp_packet);
@@ -6260,6 +6486,15 @@ ice_fill_adv_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
case ICE_PPPOE:
len = sizeof(struct ice_pppoe_hdr);
break;
+ case ICE_ESP:
+ len = sizeof(struct ice_esp_hdr);
+ break;
+ case ICE_NAT_T:
+ len = sizeof(struct ice_nat_t_hdr);
+ break;
+ case ICE_AH:
+ len = sizeof(struct ice_ah_hdr);
+ break;
default:
return ICE_ERR_PARAM;
}
diff --git a/drivers/net/ice/base/ice_switch.h b/drivers/net/ice/base/ice_switch.h
index f7ae5c741..765ed0945 100644
--- a/drivers/net/ice/base/ice_switch.h
+++ b/drivers/net/ice/base/ice_switch.h
@@ -18,6 +18,7 @@
/* Switch Profile IDs for Profile related switch rules */
#define ICE_PROFID_IPV6_ESP 72
#define ICE_PROFID_IPV6_AH 74
+#define ICE_PROFID_IPV4_NAT_T 75
#define ICE_PROFID_IPV6_NAT_T 76
#define ICE_PROFID_MAC_IPV6_L2TPV3 78
#define ICE_PROFID_IPV4_PFCP_NODE 79
--
2.19.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [dpdk-dev] [PATCH 2/3] net/ice/base: add support for L2TP on switch
2020-04-17 8:26 [dpdk-dev] [PATCH 0/3] add support for L2TP AH ESP and NAT-T on switch Wei Zhao
2020-04-17 8:26 ` [dpdk-dev] [PATCH 1/3] net/ice/base: add support for " Wei Zhao
@ 2020-04-17 8:26 ` Wei Zhao
2020-04-17 8:26 ` [dpdk-dev] [PATCH 3/3] net/ice: add flow support for AH ESP and L2TP Wei Zhao
2020-04-20 5:18 ` [dpdk-dev] [PATCH v2 0/3] add support for L2TP AH ESP and NAT-T on switch Wei Zhao
3 siblings, 0 replies; 12+ messages in thread
From: Wei Zhao @ 2020-04-17 8:26 UTC (permalink / raw)
To: dev; +Cc: qi.z.zhang, qi.fu, Wei Zhao
Add dummy packet and tunnel type to support
L2TP on switch, now we can use session id as
input set for swicth rule.
Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
---
drivers/net/ice/base/ice_protocol_type.h | 2 +
drivers/net/ice/base/ice_switch.c | 76 ++++++++++++++++++++++++
drivers/net/ice/base/ice_switch.h | 1 +
3 files changed, 79 insertions(+)
diff --git a/drivers/net/ice/base/ice_protocol_type.h b/drivers/net/ice/base/ice_protocol_type.h
index 2ca7cd8ac..46cd77e68 100644
--- a/drivers/net/ice/base/ice_protocol_type.h
+++ b/drivers/net/ice/base/ice_protocol_type.h
@@ -72,6 +72,8 @@ enum ice_sw_tunnel_type {
ICE_SW_TUN_IPV6_AH,
ICE_SW_TUN_IPV4_NAT_T,
ICE_SW_TUN_IPV6_NAT_T,
+ ICE_SW_TUN_IPV4_L2TPV3,
+ ICE_SW_TUN_IPV6_L2TPV3,
ICE_SW_TUN_PROFID_IPV6_ESP,
ICE_SW_TUN_PROFID_IPV6_AH,
ICE_SW_TUN_PROFID_MAC_IPV6_L2TPV3,
diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c
index 1da438f5e..28924085e 100644
--- a/drivers/net/ice/base/ice_switch.c
+++ b/drivers/net/ice/base/ice_switch.c
@@ -760,6 +760,61 @@ static const u8 dummy_ipv6_nat_pkt[] = {
};
+static const struct ice_dummy_pkt_offsets dummy_ipv4_l2tpv3_packet_offsets[] = {
+ { ICE_MAC_OFOS, 0 },
+ { ICE_IPV4_OFOS, 14 },
+ { ICE_L2TPV3, 34 },
+ { ICE_PROTOCOL_LAST, 0 },
+};
+
+static const u8 dummy_ipv4_l2tpv3_pkt[] = {
+ 0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x08, 0x00,
+
+ 0x45, 0x00, 0x00, 0x20, /* ICE_IPV4_IL 14 */
+ 0x00, 0x00, 0x40, 0x00,
+ 0x40, 0x73, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+
+ 0x00, 0x00, 0x00, 0x00, /* ICE_L2TPV3 34 */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, /* 2 bytes for 4 bytes alignment */
+};
+
+static const struct ice_dummy_pkt_offsets dummy_ipv6_l2tpv3_packet_offsets[] = {
+ { ICE_MAC_OFOS, 0 },
+ { ICE_IPV6_OFOS, 14 },
+ { ICE_L2TPV3, 54 },
+ { ICE_PROTOCOL_LAST, 0 },
+};
+
+static const u8 dummy_ipv6_l2tpv3_pkt[] = {
+ 0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x86, 0xDD,
+
+ 0x60, 0x00, 0x00, 0x00, /* ICE_IPV6_IL 14 */
+ 0x00, 0x0c, 0x73, 0x40,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+
+ 0x00, 0x00, 0x00, 0x00, /* ICE_L2TPV3 54 */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, /* 2 bytes for 4 bytes alignment */
+};
+
/* this is a recipe to profile association bitmap */
static ice_declare_bitmap(recipe_to_profile[ICE_MAX_NUM_RECIPES],
ICE_MAX_NUM_PROFILES);
@@ -5939,6 +5994,7 @@ ice_get_compat_fv_bitmap(struct ice_hw *hw, struct ice_adv_rule_info *rinfo,
ice_set_bit(ICE_PROFID_IPV6_AH, bm);
return;
case ICE_SW_TUN_PROFID_MAC_IPV6_L2TPV3:
+ case ICE_SW_TUN_IPV6_L2TPV3:
ice_set_bit(ICE_PROFID_MAC_IPV6_L2TPV3, bm);
return;
case ICE_SW_TUN_PROFID_IPV6_NAT_T:
@@ -5960,6 +6016,9 @@ ice_get_compat_fv_bitmap(struct ice_hw *hw, struct ice_adv_rule_info *rinfo,
case ICE_SW_TUN_IPV4_NAT_T:
ice_set_bit(ICE_PROFID_IPV4_NAT_T, bm);
return;
+ case ICE_SW_TUN_IPV4_L2TPV3:
+ ice_set_bit(ICE_PROFID_MAC_IPV4_L2TPV3, bm);
+ return;
case ICE_SW_TUN_AND_NON_TUN:
default:
prof_type = ICE_PROF_ALL;
@@ -6297,6 +6356,20 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
return;
}
+ if (tun_type == ICE_SW_TUN_IPV4_L2TPV3) {
+ *pkt = dummy_ipv4_l2tpv3_pkt;
+ *pkt_len = sizeof(dummy_ipv4_l2tpv3_pkt);
+ *offsets = dummy_ipv4_l2tpv3_packet_offsets;
+ return;
+ }
+
+ if (tun_type == ICE_SW_TUN_IPV6_L2TPV3) {
+ *pkt = dummy_ipv6_l2tpv3_pkt;
+ *pkt_len = sizeof(dummy_ipv6_l2tpv3_pkt);
+ *offsets = dummy_ipv6_l2tpv3_packet_offsets;
+ return;
+ }
+
if (tun_type == ICE_SW_TUN_GTP) {
*pkt = dummy_udp_gtp_packet;
*pkt_len = sizeof(dummy_udp_gtp_packet);
@@ -6495,6 +6568,9 @@ ice_fill_adv_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
case ICE_AH:
len = sizeof(struct ice_ah_hdr);
break;
+ case ICE_L2TPV3:
+ len = sizeof(struct ice_l2tpv3_sess_hdr);
+ break;
default:
return ICE_ERR_PARAM;
}
diff --git a/drivers/net/ice/base/ice_switch.h b/drivers/net/ice/base/ice_switch.h
index 765ed0945..8cbda4081 100644
--- a/drivers/net/ice/base/ice_switch.h
+++ b/drivers/net/ice/base/ice_switch.h
@@ -20,6 +20,7 @@
#define ICE_PROFID_IPV6_AH 74
#define ICE_PROFID_IPV4_NAT_T 75
#define ICE_PROFID_IPV6_NAT_T 76
+#define ICE_PROFID_MAC_IPV4_L2TPV3 77
#define ICE_PROFID_MAC_IPV6_L2TPV3 78
#define ICE_PROFID_IPV4_PFCP_NODE 79
#define ICE_PROFID_IPV4_PFCP_SESSION 80
--
2.19.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [dpdk-dev] [PATCH 3/3] net/ice: add flow support for AH ESP and L2TP
2020-04-17 8:26 [dpdk-dev] [PATCH 0/3] add support for L2TP AH ESP and NAT-T on switch Wei Zhao
2020-04-17 8:26 ` [dpdk-dev] [PATCH 1/3] net/ice/base: add support for " Wei Zhao
2020-04-17 8:26 ` [dpdk-dev] [PATCH 2/3] net/ice/base: add support for L2TP " Wei Zhao
@ 2020-04-17 8:26 ` Wei Zhao
2020-04-20 5:16 ` Zhang, Qi Z
2020-04-20 5:18 ` [dpdk-dev] [PATCH v2 0/3] add support for L2TP AH ESP and NAT-T on switch Wei Zhao
3 siblings, 1 reply; 12+ messages in thread
From: Wei Zhao @ 2020-04-17 8:26 UTC (permalink / raw)
To: dev; +Cc: qi.z.zhang, qi.fu, Wei Zhao
Add switch filter support for AH ESP and L2TP protocol,
and use spi or session idas input set for switch rule.
Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
---
drivers/net/ice/ice_generic_flow.c | 25 ++++
drivers/net/ice/ice_generic_flow.h | 23 ++++
drivers/net/ice/ice_switch_filter.c | 198 +++++++++++++++++++++++-----
3 files changed, 216 insertions(+), 30 deletions(-)
diff --git a/drivers/net/ice/ice_generic_flow.c b/drivers/net/ice/ice_generic_flow.c
index 3365aeb86..ad103d0e8 100644
--- a/drivers/net/ice/ice_generic_flow.c
+++ b/drivers/net/ice/ice_generic_flow.c
@@ -1382,18 +1382,37 @@ enum rte_flow_item_type pattern_eth_qinq_pppoes_ipv6_icmp6[] = {
RTE_FLOW_ITEM_TYPE_ICMP6,
RTE_FLOW_ITEM_TYPE_END,
};
+enum rte_flow_item_type pattern_eth_ipv4_esp[] = {
+ RTE_FLOW_ITEM_TYPE_ETH,
+ RTE_FLOW_ITEM_TYPE_IPV4,
+ RTE_FLOW_ITEM_TYPE_ESP,
+ RTE_FLOW_ITEM_TYPE_END,
+};
enum rte_flow_item_type pattern_eth_ipv6_esp[] = {
RTE_FLOW_ITEM_TYPE_ETH,
RTE_FLOW_ITEM_TYPE_IPV6,
RTE_FLOW_ITEM_TYPE_ESP,
RTE_FLOW_ITEM_TYPE_END,
};
+enum rte_flow_item_type pattern_eth_ipv4_ah[] = {
+ RTE_FLOW_ITEM_TYPE_ETH,
+ RTE_FLOW_ITEM_TYPE_IPV4,
+ RTE_FLOW_ITEM_TYPE_AH,
+ RTE_FLOW_ITEM_TYPE_END,
+};
enum rte_flow_item_type pattern_eth_ipv6_ah[] = {
RTE_FLOW_ITEM_TYPE_ETH,
RTE_FLOW_ITEM_TYPE_IPV6,
RTE_FLOW_ITEM_TYPE_AH,
RTE_FLOW_ITEM_TYPE_END,
};
+enum rte_flow_item_type pattern_eth_ipv4_udp_esp[] = {
+ RTE_FLOW_ITEM_TYPE_ETH,
+ RTE_FLOW_ITEM_TYPE_IPV4,
+ RTE_FLOW_ITEM_TYPE_UDP,
+ RTE_FLOW_ITEM_TYPE_ESP,
+ RTE_FLOW_ITEM_TYPE_END,
+};
enum rte_flow_item_type pattern_eth_ipv6_udp_esp[] = {
RTE_FLOW_ITEM_TYPE_ETH,
RTE_FLOW_ITEM_TYPE_IPV6,
@@ -1408,6 +1427,12 @@ enum rte_flow_item_type pattern_eth_ipv6_udp_ah[] = {
RTE_FLOW_ITEM_TYPE_AH,
RTE_FLOW_ITEM_TYPE_END,
};
+enum rte_flow_item_type pattern_eth_ipv4_l2tp[] = {
+ RTE_FLOW_ITEM_TYPE_ETH,
+ RTE_FLOW_ITEM_TYPE_IPV4,
+ RTE_FLOW_ITEM_TYPE_L2TPV3OIP,
+ RTE_FLOW_ITEM_TYPE_END,
+};
enum rte_flow_item_type pattern_eth_ipv6_l2tp[] = {
RTE_FLOW_ITEM_TYPE_ETH,
RTE_FLOW_ITEM_TYPE_IPV6,
diff --git a/drivers/net/ice/ice_generic_flow.h b/drivers/net/ice/ice_generic_flow.h
index 9fe35df45..492a48cd9 100644
--- a/drivers/net/ice/ice_generic_flow.h
+++ b/drivers/net/ice/ice_generic_flow.h
@@ -31,6 +31,10 @@
#define ICE_PROT_NVGRE (1ULL << 20)
#define ICE_PROT_GTPU (1ULL << 21)
#define ICE_PROT_PPPOE_S (1ULL << 22)
+#define ICE_PROT_ESP (1ULL << 23)
+#define ICE_PROT_AH (1ULL << 24)
+#define ICE_PROT_L2TPV3OIP (1ULL << 25)
+#define ICE_PROT_PFCP (1ULL << 26)
/* field */
@@ -52,6 +56,11 @@
#define ICE_GTPU_QFI (1ULL << 48)
#define ICE_PPPOE_SESSION (1ULL << 47)
#define ICE_PPPOE_PROTO (1ULL << 46)
+#define ICE_ESP_SPI (1ULL << 45)
+#define ICE_AH_SPI (1ULL << 44)
+#define ICE_L2TPV3OIP_SESSION_ID (1ULL << 43)
+#define ICE_PFCP_SEID (1ULL << 42)
+#define ICE_PFCP_S_FIELD (1ULL << 41)
/* input set */
@@ -184,6 +193,16 @@
(ICE_PROT_PPPOE_S | ICE_PPPOE_SESSION)
#define ICE_INSET_PPPOE_PROTO \
(ICE_PROT_PPPOE_S | ICE_PPPOE_PROTO)
+#define ICE_INSET_ESP_SPI \
+ (ICE_PROT_ESP | ICE_ESP_SPI)
+#define ICE_INSET_AH_SPI \
+ (ICE_PROT_AH | ICE_AH_SPI)
+#define ICE_INSET_L2TPV3OIP_SESSION_ID \
+ (ICE_PROT_L2TPV3OIP | ICE_L2TPV3OIP_SESSION_ID)
+#define ICE_INSET_PFCP_S_FIELD \
+ (ICE_PROT_PFCP | ICE_PFCP_S_FIELD)
+#define ICE_INSET_PFCP_SEID \
+ (ICE_PROT_PFCP | ICE_PFCP_S_FIELD | ICE_PFCP_SEID)
/* empty pattern */
extern enum rte_flow_item_type pattern_empty[];
@@ -392,14 +411,18 @@ extern enum rte_flow_item_type pattern_eth_vlan_pppoes_ipv6_icmp6[];
extern enum rte_flow_item_type pattern_eth_qinq_pppoes_ipv6_icmp6[];
/* ESP */
+extern enum rte_flow_item_type pattern_eth_ipv4_esp[];
+extern enum rte_flow_item_type pattern_eth_ipv4_udp_esp[];
extern enum rte_flow_item_type pattern_eth_ipv6_esp[];
extern enum rte_flow_item_type pattern_eth_ipv6_udp_esp[];
/* AH */
+extern enum rte_flow_item_type pattern_eth_ipv4_ah[];
extern enum rte_flow_item_type pattern_eth_ipv6_ah[];
extern enum rte_flow_item_type pattern_eth_ipv6_udp_ah[];
/* L2TP */
+extern enum rte_flow_item_type pattern_eth_ipv4_l2tp[];
extern enum rte_flow_item_type pattern_eth_ipv6_l2tp[];
/* PFCP */
diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c
index 55a5618a7..78cda6acd 100644
--- a/drivers/net/ice/ice_switch_filter.c
+++ b/drivers/net/ice/ice_switch_filter.c
@@ -95,6 +95,24 @@
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_IPV4_ESP ( \
+ ICE_SW_INSET_MAC_IPV4 | ICE_INSET_ESP_SPI)
+#define ICE_SW_INSET_MAC_IPV6_ESP ( \
+ ICE_SW_INSET_MAC_IPV6 | ICE_INSET_ESP_SPI)
+#define ICE_SW_INSET_MAC_IPV4_AH ( \
+ ICE_SW_INSET_MAC_IPV4 | ICE_INSET_AH_SPI)
+#define ICE_SW_INSET_MAC_IPV6_AH ( \
+ ICE_SW_INSET_MAC_IPV6 | ICE_INSET_AH_SPI)
+#define ICE_SW_INSET_MAC_IPV4_L2TP ( \
+ ICE_SW_INSET_MAC_IPV4 | ICE_INSET_L2TPV3OIP_SESSION_ID)
+#define ICE_SW_INSET_MAC_IPV6_L2TP ( \
+ ICE_SW_INSET_MAC_IPV6 | ICE_INSET_L2TPV3OIP_SESSION_ID)
+#define ICE_SW_INSET_MAC_IPV4_PFCP ( \
+ ICE_SW_INSET_MAC_IPV4 | \
+ ICE_INSET_PFCP_S_FIELD | ICE_INSET_PFCP_SEID)
+#define ICE_SW_INSET_MAC_IPV6_PFCP ( \
+ ICE_SW_INSET_MAC_IPV6 | \
+ ICE_INSET_PFCP_S_FIELD | ICE_INSET_PFCP_SEID)
struct sw_meta {
struct ice_adv_lkup_elem *list;
@@ -148,16 +166,24 @@ 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_ipv4_esp,
+ ICE_SW_INSET_MAC_IPV4_ESP, ICE_INSET_NONE},
+ {pattern_eth_ipv4_udp_esp,
+ ICE_SW_INSET_MAC_IPV6_ESP, ICE_INSET_NONE},
{pattern_eth_ipv6_esp,
- ICE_INSET_NONE, ICE_INSET_NONE},
+ ICE_SW_INSET_MAC_IPV4_ESP, ICE_INSET_NONE},
{pattern_eth_ipv6_udp_esp,
- ICE_INSET_NONE, ICE_INSET_NONE},
+ ICE_SW_INSET_MAC_IPV6_ESP, ICE_INSET_NONE},
+ {pattern_eth_ipv4_ah,
+ ICE_SW_INSET_MAC_IPV4_AH, ICE_INSET_NONE},
{pattern_eth_ipv6_ah,
- ICE_INSET_NONE, ICE_INSET_NONE},
+ ICE_SW_INSET_MAC_IPV6_AH, ICE_INSET_NONE},
{pattern_eth_ipv6_udp_ah,
ICE_INSET_NONE, ICE_INSET_NONE},
+ {pattern_eth_ipv4_l2tp,
+ ICE_SW_INSET_MAC_IPV4_L2TP, ICE_INSET_NONE},
{pattern_eth_ipv6_l2tp,
- ICE_INSET_NONE, ICE_INSET_NONE},
+ ICE_SW_INSET_MAC_IPV6_L2TP, ICE_INSET_NONE},
{pattern_eth_ipv4_pfcp,
ICE_INSET_NONE, ICE_INSET_NONE},
{pattern_eth_ipv6_pfcp,
@@ -240,16 +266,24 @@ 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_ipv4_esp,
+ ICE_SW_INSET_MAC_IPV4_ESP, ICE_INSET_NONE},
+ {pattern_eth_ipv4_udp_esp,
+ ICE_SW_INSET_MAC_IPV6_ESP, ICE_INSET_NONE},
{pattern_eth_ipv6_esp,
- ICE_INSET_NONE, ICE_INSET_NONE},
+ ICE_SW_INSET_MAC_IPV4_ESP, ICE_INSET_NONE},
{pattern_eth_ipv6_udp_esp,
- ICE_INSET_NONE, ICE_INSET_NONE},
+ ICE_SW_INSET_MAC_IPV6_ESP, ICE_INSET_NONE},
+ {pattern_eth_ipv4_ah,
+ ICE_SW_INSET_MAC_IPV4_AH, ICE_INSET_NONE},
{pattern_eth_ipv6_ah,
- ICE_INSET_NONE, ICE_INSET_NONE},
+ ICE_SW_INSET_MAC_IPV6_AH, ICE_INSET_NONE},
{pattern_eth_ipv6_udp_ah,
ICE_INSET_NONE, ICE_INSET_NONE},
+ {pattern_eth_ipv4_l2tp,
+ ICE_SW_INSET_MAC_IPV4_L2TP, ICE_INSET_NONE},
{pattern_eth_ipv6_l2tp,
- ICE_INSET_NONE, ICE_INSET_NONE},
+ ICE_SW_INSET_MAC_IPV6_L2TP, ICE_INSET_NONE},
{pattern_eth_ipv4_pfcp,
ICE_INSET_NONE, ICE_INSET_NONE},
{pattern_eth_ipv6_pfcp,
@@ -383,11 +417,12 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
const struct rte_flow_item_pfcp *pfcp_spec, *pfcp_mask;
uint64_t input_set = ICE_INSET_NONE;
uint16_t j, t = 0;
- uint16_t tunnel_valid = 0;
- uint16_t pppoe_valid = 0;
- uint16_t ipv6_valiad = 0;
- uint16_t udp_valiad = 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;
for (item = pattern; item->type !=
RTE_FLOW_ITEM_TYPE_END; item++) {
@@ -470,6 +505,7 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
case RTE_FLOW_ITEM_TYPE_IPV4:
ipv4_spec = item->spec;
ipv4_mask = item->mask;
+ ipv4_valiad = 1;
if (ipv4_spec && ipv4_mask) {
/* Check IPv4 mask and update input set */
if (ipv4_mask->hdr.version_ihl ||
@@ -991,48 +1027,151 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
case RTE_FLOW_ITEM_TYPE_ESP:
esp_spec = item->spec;
esp_mask = item->mask;
- if (esp_spec || esp_mask) {
+ if ((esp_spec && !esp_mask) ||
+ (!esp_spec && esp_mask)) {
rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ITEM,
item,
"Invalid esp item");
- return -ENOTSUP;
+ return 0;
+ }
+ /* Check esp mask and update input set */
+ if (esp_mask && esp_mask->hdr.seq) {
+ rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ITEM,
+ item,
+ "Invalid esp mask");
+ return 0;
+ }
+
+ if (!esp_spec && !esp_mask && !input_set) {
+ profile_rule = 1;
+ if (ipv6_valiad && udp_valiad)
+ *tun_type =
+ ICE_SW_TUN_PROFID_IPV6_NAT_T;
+ else if (ipv6_valiad)
+ *tun_type = ICE_SW_TUN_PROFID_IPV6_ESP;
+ else if (ipv4_valiad)
+ return 0;
+ } else if (esp_spec && esp_mask &&
+ esp_mask->hdr.spi){
+ if (udp_valiad)
+ list[t].type = ICE_NAT_T;
+ else
+ list[t].type = ICE_ESP;
+ list[t].h_u.esp_hdr.spi =
+ esp_spec->hdr.spi;
+ list[t].m_u.esp_hdr.spi =
+ esp_mask->hdr.spi;
+ input_set |= ICE_INSET_ESP_SPI;
+ t++;
+ }
+
+ if (!profile_rule) {
+ if (ipv6_valiad && udp_valiad)
+ *tun_type = ICE_SW_TUN_IPV6_NAT_T;
+ else if (ipv4_valiad && udp_valiad)
+ *tun_type = ICE_SW_TUN_IPV4_NAT_T;
+ else if (ipv6_valiad)
+ *tun_type = ICE_SW_TUN_IPV6_ESP;
+ else if (ipv4_valiad)
+ *tun_type = ICE_SW_TUN_IPV4_ESP;
}
- if (ipv6_valiad && udp_valiad)
- *tun_type = ICE_SW_TUN_PROFID_IPV6_NAT_T;
- else if (ipv6_valiad)
- *tun_type = ICE_SW_TUN_PROFID_IPV6_ESP;
break;
case RTE_FLOW_ITEM_TYPE_AH:
ah_spec = item->spec;
ah_mask = item->mask;
- if (ah_spec || ah_mask) {
+ if ((ah_spec && !ah_mask) ||
+ (!ah_spec && ah_mask)) {
rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ITEM,
item,
"Invalid ah item");
- return -ENOTSUP;
+ return 0;
+ }
+ /* Check ah mask and update input set */
+ if (ah_mask &&
+ (ah_mask->next_hdr ||
+ ah_mask->payload_len ||
+ ah_mask->seq_num ||
+ ah_mask->reserved)) {
+ rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ITEM,
+ item,
+ "Invalid ah mask");
+ return 0;
+ }
+
+ if (!ah_spec && !ah_mask && !input_set) {
+ profile_rule = 1;
+ if (ipv6_valiad && udp_valiad)
+ *tun_type =
+ ICE_SW_TUN_PROFID_IPV6_NAT_T;
+ else if (ipv6_valiad)
+ *tun_type = ICE_SW_TUN_PROFID_IPV6_AH;
+ else if (ipv4_valiad)
+ return 0;
+ } else if (ah_spec && ah_mask &&
+ ah_mask->spi){
+ list[t].type = ICE_AH;
+ list[t].h_u.ah_hdr.spi =
+ ah_spec->spi;
+ list[t].m_u.ah_hdr.spi =
+ ah_mask->spi;
+ input_set |= ICE_INSET_AH_SPI;
+ t++;
+ }
+
+ if (!profile_rule) {
+ if (udp_valiad)
+ return 0;
+ else if (ipv6_valiad)
+ *tun_type = ICE_SW_TUN_IPV6_AH;
+ else if (ipv4_valiad)
+ *tun_type = ICE_SW_TUN_IPV4_AH;
}
- if (ipv6_valiad && udp_valiad)
- *tun_type = ICE_SW_TUN_PROFID_IPV6_NAT_T;
- else if (ipv6_valiad)
- *tun_type = ICE_SW_TUN_PROFID_IPV6_AH;
break;
case RTE_FLOW_ITEM_TYPE_L2TPV3OIP:
l2tp_spec = item->spec;
l2tp_mask = item->mask;
- if (l2tp_spec || l2tp_mask) {
+ if ((l2tp_spec && !l2tp_mask) ||
+ (!l2tp_spec && l2tp_mask)) {
rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ITEM,
item,
"Invalid l2tp item");
- return -ENOTSUP;
+ return 0;
+ }
+
+ if (!l2tp_spec && !l2tp_mask && !input_set) {
+ if (ipv6_valiad)
+ *tun_type =
+ ICE_SW_TUN_PROFID_MAC_IPV6_L2TPV3;
+ else if (ipv4_valiad)
+ return 0;
+ } else if (l2tp_spec && l2tp_mask &&
+ l2tp_mask->session_id){
+ list[t].type = ICE_L2TPV3;
+ list[t].h_u.l2tpv3_sess_hdr.session_id =
+ l2tp_spec->session_id;
+ list[t].m_u.l2tpv3_sess_hdr.session_id =
+ l2tp_mask->session_id;
+ input_set |= ICE_INSET_L2TPV3OIP_SESSION_ID;
+ t++;
+ }
+
+ if (!profile_rule) {
+ if (ipv6_valiad)
+ *tun_type =
+ ICE_SW_TUN_IPV6_L2TPV3;
+ else if (ipv4_valiad)
+ *tun_type =
+ ICE_SW_TUN_IPV4_L2TPV3;
}
- if (ipv6_valiad)
- *tun_type = ICE_SW_TUN_PROFID_MAC_IPV6_L2TPV3;
break;
+
case RTE_FLOW_ITEM_TYPE_PFCP:
pfcp_spec = item->spec;
pfcp_mask = item->mask;
@@ -1082,7 +1221,6 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
}
break;
-
case RTE_FLOW_ITEM_TYPE_VOID:
break;
--
2.19.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [dpdk-dev] [PATCH 3/3] net/ice: add flow support for AH ESP and L2TP
2020-04-17 8:26 ` [dpdk-dev] [PATCH 3/3] net/ice: add flow support for AH ESP and L2TP Wei Zhao
@ 2020-04-20 5:16 ` Zhang, Qi Z
2020-04-20 5:18 ` Zhao1, Wei
0 siblings, 1 reply; 12+ messages in thread
From: Zhang, Qi Z @ 2020-04-20 5:16 UTC (permalink / raw)
To: Zhao1, Wei, dev; +Cc: Fu, Qi
> -----Original Message-----
> From: Zhao1, Wei <wei.zhao1@intel.com>
> Sent: Friday, April 17, 2020 4:26 PM
> To: dev@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Fu, Qi <qi.fu@intel.com>; Zhao1,
> Wei <wei.zhao1@intel.com>
> Subject: [PATCH 3/3] net/ice: add flow support for AH ESP and L2TP
>
> Add switch filter support for AH ESP and L2TP protocol, and use spi or
> session idas input set for switch rule.
>
> Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> ---
.....
> struct sw_meta {
> struct ice_adv_lkup_elem *list;
> @@ -148,16 +166,24 @@ 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_ipv4_esp,
> + ICE_SW_INSET_MAC_IPV4_ESP, ICE_INSET_NONE},
> + {pattern_eth_ipv4_udp_esp,
> + ICE_SW_INSET_MAC_IPV6_ESP, ICE_INSET_NONE},
Why IPv6 input be used by IPv4 flow? Just typo?
> {pattern_eth_ipv6_esp,
> - ICE_INSET_NONE, ICE_INSET_NONE},
> + ICE_SW_INSET_MAC_IPV4_ESP, ICE_INSET_NONE},
Same issue.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [dpdk-dev] [PATCH 3/3] net/ice: add flow support for AH ESP and L2TP
2020-04-20 5:16 ` Zhang, Qi Z
@ 2020-04-20 5:18 ` Zhao1, Wei
0 siblings, 0 replies; 12+ messages in thread
From: Zhao1, Wei @ 2020-04-20 5:18 UTC (permalink / raw)
To: Zhang, Qi Z, dev; +Cc: Fu, Qi
Ok, fix in v2
> -----Original Message-----
> From: Zhang, Qi Z <qi.z.zhang@intel.com>
> Sent: Monday, April 20, 2020 1:17 PM
> To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org
> Cc: Fu, Qi <qi.fu@intel.com>
> Subject: RE: [PATCH 3/3] net/ice: add flow support for AH ESP and L2TP
>
>
>
> > -----Original Message-----
> > From: Zhao1, Wei <wei.zhao1@intel.com>
> > Sent: Friday, April 17, 2020 4:26 PM
> > To: dev@dpdk.org
> > Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Fu, Qi <qi.fu@intel.com>;
> > Zhao1, Wei <wei.zhao1@intel.com>
> > Subject: [PATCH 3/3] net/ice: add flow support for AH ESP and L2TP
> >
> > Add switch filter support for AH ESP and L2TP protocol, and use spi or
> > session idas input set for switch rule.
> >
> > Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> > ---
> .....
>
> > struct sw_meta {
> > struct ice_adv_lkup_elem *list;
> > @@ -148,16 +166,24 @@ 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_ipv4_esp,
> > + ICE_SW_INSET_MAC_IPV4_ESP, ICE_INSET_NONE},
> > + {pattern_eth_ipv4_udp_esp,
> > + ICE_SW_INSET_MAC_IPV6_ESP, ICE_INSET_NONE},
>
> Why IPv6 input be used by IPv4 flow? Just typo?
>
> > {pattern_eth_ipv6_esp,
> > - ICE_INSET_NONE, ICE_INSET_NONE},
> > + ICE_SW_INSET_MAC_IPV4_ESP, ICE_INSET_NONE},
>
> Same issue.
>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [dpdk-dev] [PATCH v2 0/3] add support for L2TP AH ESP and NAT-T on switch
2020-04-17 8:26 [dpdk-dev] [PATCH 0/3] add support for L2TP AH ESP and NAT-T on switch Wei Zhao
` (2 preceding siblings ...)
2020-04-17 8:26 ` [dpdk-dev] [PATCH 3/3] net/ice: add flow support for AH ESP and L2TP Wei Zhao
@ 2020-04-20 5:18 ` Wei Zhao
2020-04-20 5:18 ` [dpdk-dev] [PATCH v2 1/3] net/ice/base: add support for " Wei Zhao
` (3 more replies)
3 siblings, 4 replies; 12+ messages in thread
From: Wei Zhao @ 2020-04-20 5:18 UTC (permalink / raw)
To: dev; +Cc: qi.z.zhang, qi.fu
This patch set add switch filter support for AH ESP NAT-T
and L2TP protocol, and use spi or session idas input set
for switch rule.
v2:
-fix bug for input set error.
Wei Zhao (3):
net/ice/base: add support for AH ESP and NAT-T on switch
net/ice/base: add support for L2TP on switch
net/ice: add flow support for AH ESP and L2TP
drivers/net/ice/base/ice_protocol_type.h | 14 +
drivers/net/ice/base/ice_switch.c | 311 +++++++++++++++++++++++
drivers/net/ice/base/ice_switch.h | 2 +
drivers/net/ice/ice_generic_flow.c | 25 ++
drivers/net/ice/ice_generic_flow.h | 23 ++
drivers/net/ice/ice_switch_filter.c | 198 ++++++++++++---
6 files changed, 543 insertions(+), 30 deletions(-)
--
2.19.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [dpdk-dev] [PATCH v2 1/3] net/ice/base: add support for AH ESP and NAT-T on switch
2020-04-20 5:18 ` [dpdk-dev] [PATCH v2 0/3] add support for L2TP AH ESP and NAT-T on switch Wei Zhao
@ 2020-04-20 5:18 ` Wei Zhao
2020-04-20 5:18 ` [dpdk-dev] [PATCH v2 2/3] net/ice/base: add support for L2TP " Wei Zhao
` (2 subsequent siblings)
3 siblings, 0 replies; 12+ messages in thread
From: Wei Zhao @ 2020-04-20 5:18 UTC (permalink / raw)
To: dev; +Cc: qi.z.zhang, qi.fu, Wei Zhao
Add dummy packet and tunnel type to support
AH ESP and NAT-T on switch, now we can use spi as
input set for swicth rule.
Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
---
drivers/net/ice/base/ice_protocol_type.h | 12 ++
drivers/net/ice/base/ice_switch.c | 235 +++++++++++++++++++++++
drivers/net/ice/base/ice_switch.h | 1 +
3 files changed, 248 insertions(+)
diff --git a/drivers/net/ice/base/ice_protocol_type.h b/drivers/net/ice/base/ice_protocol_type.h
index 3fb065169..2ca7cd8ac 100644
--- a/drivers/net/ice/base/ice_protocol_type.h
+++ b/drivers/net/ice/base/ice_protocol_type.h
@@ -50,6 +50,7 @@ enum ice_protocol_type {
ICE_L2TPV3,
ICE_ESP,
ICE_AH,
+ ICE_NAT_T,
ICE_PROTOCOL_LAST
};
@@ -65,6 +66,12 @@ enum ice_sw_tunnel_type {
*/
ICE_SW_TUN_GTP,
ICE_SW_TUN_PPPOE,
+ ICE_SW_TUN_IPV4_ESP,
+ ICE_SW_TUN_IPV6_ESP,
+ ICE_SW_TUN_IPV4_AH,
+ ICE_SW_TUN_IPV6_AH,
+ ICE_SW_TUN_IPV4_NAT_T,
+ ICE_SW_TUN_IPV6_NAT_T,
ICE_SW_TUN_PROFID_IPV6_ESP,
ICE_SW_TUN_PROFID_IPV6_AH,
ICE_SW_TUN_PROFID_MAC_IPV6_L2TPV3,
@@ -287,6 +294,10 @@ struct ice_ah_hdr {
__be32 seq;
};
+struct ice_nat_t_hdr {
+ struct ice_esp_hdr esp;
+};
+
struct ice_nvgre {
__be16 flags;
__be16 protocol;
@@ -309,6 +320,7 @@ union ice_prot_hdr {
struct ice_l2tpv3_sess_hdr l2tpv3_sess_hdr;
struct ice_esp_hdr esp_hdr;
struct ice_ah_hdr ah_hdr;
+ struct ice_nat_t_hdr nat_t_hdr;
};
/* This is mapping table entry that maps every word within a given protocol
diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c
index 07f8efd65..1da438f5e 100644
--- a/drivers/net/ice/base/ice_switch.c
+++ b/drivers/net/ice/base/ice_switch.c
@@ -590,6 +590,176 @@ static const u8 dummy_pppoe_ipv6_packet[] = {
0x00, 0x00, /* 2 bytes for 4 bytes alignment */
};
+static const struct ice_dummy_pkt_offsets dummy_ipv4_esp_packet_offsets[] = {
+ { ICE_MAC_OFOS, 0 },
+ { ICE_IPV4_OFOS, 14 },
+ { ICE_ESP, 34 },
+ { ICE_PROTOCOL_LAST, 0 },
+};
+
+static const u8 dummy_ipv4_esp_pkt[] = {
+ 0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x08, 0x00,
+
+ 0x45, 0x00, 0x00, 0x1c, /* ICE_IPV4_IL 14 */
+ 0x00, 0x00, 0x40, 0x00,
+ 0x40, 0x32, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+
+ 0x00, 0x00, 0x00, 0x00, /* ICE_ESP 34 */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, /* 2 bytes for 4 bytes alignment */
+};
+
+static const struct ice_dummy_pkt_offsets dummy_ipv6_esp_packet_offsets[] = {
+ { ICE_MAC_OFOS, 0 },
+ { ICE_IPV6_OFOS, 14 },
+ { ICE_ESP, 54 },
+ { ICE_PROTOCOL_LAST, 0 },
+};
+
+static const u8 dummy_ipv6_esp_pkt[] = {
+ 0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x86, 0xDD,
+
+ 0x60, 0x00, 0x00, 0x00, /* ICE_IPV6_OFOS 14 */
+ 0x00, 0x08, 0x32, 0x00, /* Next header ESP */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+
+ 0x00, 0x00, 0x00, 0x00, /* ICE_ESP 54 */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, /* 2 bytes for 4 bytes alignment */
+};
+
+static const struct ice_dummy_pkt_offsets dummy_ipv4_ah_packet_offsets[] = {
+ { ICE_MAC_OFOS, 0 },
+ { ICE_IPV4_OFOS, 14 },
+ { ICE_AH, 34 },
+ { ICE_PROTOCOL_LAST, 0 },
+};
+
+static const u8 dummy_ipv4_ah_pkt[] = {
+ 0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x08, 0x00,
+
+ 0x45, 0x00, 0x00, 0x20, /* ICE_IPV4_IL 14 */
+ 0x00, 0x00, 0x40, 0x00,
+ 0x40, 0x33, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+
+ 0x00, 0x00, 0x00, 0x00, /* ICE_AH 34 */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, /* 2 bytes for 4 bytes alignment */
+};
+
+static const struct ice_dummy_pkt_offsets dummy_ipv6_ah_packet_offsets[] = {
+ { ICE_MAC_OFOS, 0 },
+ { ICE_IPV6_OFOS, 14 },
+ { ICE_AH, 54 },
+ { ICE_PROTOCOL_LAST, 0 },
+};
+
+static const u8 dummy_ipv6_ah_pkt[] = {
+ 0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x86, 0xDD,
+
+ 0x60, 0x00, 0x00, 0x00, /* ICE_IPV6_OFOS 14 */
+ 0x00, 0x0c, 0x33, 0x00, /* Next header AH */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+
+ 0x00, 0x00, 0x00, 0x00, /* ICE_AH 54 */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, /* 2 bytes for 4 bytes alignment */
+};
+
+static const struct ice_dummy_pkt_offsets dummy_ipv4_nat_packet_offsets[] = {
+ { ICE_MAC_OFOS, 0 },
+ { ICE_IPV4_OFOS, 14 },
+ { ICE_UDP_ILOS, 34 },
+ { ICE_NAT_T, 42 },
+ { ICE_PROTOCOL_LAST, 0 },
+};
+
+static const u8 dummy_ipv4_nat_pkt[] = {
+ 0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x08, 0x00,
+
+ 0x45, 0x00, 0x00, 0x24, /* ICE_IPV4_IL 14 */
+ 0x00, 0x00, 0x40, 0x00,
+ 0x40, 0x11, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+
+ 0x00, 0x00, 0x11, 0x94, /* ICE_NAT_T 34 */
+ 0x00, 0x00, 0x00, 0x00,
+
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, /* 2 bytes for 4 bytes alignment */
+};
+
+static const struct ice_dummy_pkt_offsets dummy_ipv6_nat_packet_offsets[] = {
+ { ICE_MAC_OFOS, 0 },
+ { ICE_IPV6_OFOS, 14 },
+ { ICE_UDP_ILOS, 54 },
+ { ICE_NAT_T, 62 },
+ { ICE_PROTOCOL_LAST, 0 },
+};
+
+static const u8 dummy_ipv6_nat_pkt[] = {
+ 0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x86, 0xDD,
+
+ 0x60, 0x00, 0x00, 0x00, /* ICE_IPV6_OFOS 14 */
+ 0x00, 0x10, 0x11, 0x00, /* Next header NAT_T */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+
+ 0x00, 0x00, 0x11, 0x94, /* ICE_NAT_T 54 */
+ 0x00, 0x00, 0x00, 0x00,
+
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, /* 2 bytes for 4 bytes alignment */
+
+};
+
/* this is a recipe to profile association bitmap */
static ice_declare_bitmap(recipe_to_profile[ICE_MAX_NUM_RECIPES],
ICE_MAX_NUM_PROFILES);
@@ -4947,6 +5117,11 @@ static const struct ice_prot_ext_tbl_entry ice_prot_ext[ICE_PROTOCOL_LAST] = {
{ ICE_NVGRE, { 0, 2, 4, 6 } },
{ ICE_GTP, { 8, 10, 12, 14, 16, 18, 20 } },
{ ICE_PPPOE, { 0, 2, 4, 6 } },
+ { ICE_PFCP, { 8, 10, 12, 14, 16, 18, 20, 22 } },
+ { ICE_L2TPV3, { 0, 2, 4, 6, 8, 10 } },
+ { ICE_ESP, { 0, 2, 4, 6 } },
+ { ICE_AH, { 0, 2, 4, 6, 8, 10 } },
+ { ICE_NAT_T, { 8, 10, 12, 14 } },
};
/* The following table describes preferred grouping of recipes.
@@ -4974,6 +5149,11 @@ static const struct ice_protocol_entry ice_prot_id_tbl[ICE_PROTOCOL_LAST] = {
{ ICE_NVGRE, ICE_GRE_OF_HW },
{ ICE_GTP, ICE_UDP_OF_HW },
{ ICE_PPPOE, ICE_PPPOE_HW },
+ { ICE_PFCP, ICE_UDP_ILOS_HW },
+ { ICE_L2TPV3, ICE_L2TPV3_HW },
+ { ICE_ESP, ICE_ESP_HW },
+ { ICE_AH, ICE_AH_HW },
+ { ICE_NAT_T, ICE_UDP_ILOS_HW },
};
/**
@@ -5762,6 +5942,7 @@ ice_get_compat_fv_bitmap(struct ice_hw *hw, struct ice_adv_rule_info *rinfo,
ice_set_bit(ICE_PROFID_MAC_IPV6_L2TPV3, bm);
return;
case ICE_SW_TUN_PROFID_IPV6_NAT_T:
+ case ICE_SW_TUN_IPV6_NAT_T:
ice_set_bit(ICE_PROFID_IPV6_NAT_T, bm);
return;
case ICE_SW_TUN_PROFID_IPV4_PFCP_NODE:
@@ -5776,6 +5957,9 @@ ice_get_compat_fv_bitmap(struct ice_hw *hw, struct ice_adv_rule_info *rinfo,
case ICE_SW_TUN_PROFID_IPV6_PFCP_SESSION:
ice_set_bit(ICE_PROFID_IPV6_PFCP_SESSION, bm);
return;
+ case ICE_SW_TUN_IPV4_NAT_T:
+ ice_set_bit(ICE_PROFID_IPV4_NAT_T, bm);
+ return;
case ICE_SW_TUN_AND_NON_TUN:
default:
prof_type = ICE_PROF_ALL;
@@ -6071,6 +6255,48 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
ipv6 = true;
}
+ if (tun_type == ICE_SW_TUN_IPV4_ESP) {
+ *pkt = dummy_ipv4_esp_pkt;
+ *pkt_len = sizeof(dummy_ipv4_esp_pkt);
+ *offsets = dummy_ipv4_esp_packet_offsets;
+ return;
+ }
+
+ if (tun_type == ICE_SW_TUN_IPV6_ESP) {
+ *pkt = dummy_ipv6_esp_pkt;
+ *pkt_len = sizeof(dummy_ipv6_esp_pkt);
+ *offsets = dummy_ipv6_esp_packet_offsets;
+ return;
+ }
+
+ if (tun_type == ICE_SW_TUN_IPV4_AH) {
+ *pkt = dummy_ipv4_ah_pkt;
+ *pkt_len = sizeof(dummy_ipv4_ah_pkt);
+ *offsets = dummy_ipv4_ah_packet_offsets;
+ return;
+ }
+
+ if (tun_type == ICE_SW_TUN_IPV6_AH) {
+ *pkt = dummy_ipv6_ah_pkt;
+ *pkt_len = sizeof(dummy_ipv6_ah_pkt);
+ *offsets = dummy_ipv6_ah_packet_offsets;
+ return;
+ }
+
+ if (tun_type == ICE_SW_TUN_IPV4_NAT_T) {
+ *pkt = dummy_ipv4_nat_pkt;
+ *pkt_len = sizeof(dummy_ipv4_nat_pkt);
+ *offsets = dummy_ipv4_nat_packet_offsets;
+ return;
+ }
+
+ if (tun_type == ICE_SW_TUN_IPV6_NAT_T) {
+ *pkt = dummy_ipv6_nat_pkt;
+ *pkt_len = sizeof(dummy_ipv6_nat_pkt);
+ *offsets = dummy_ipv6_nat_packet_offsets;
+ return;
+ }
+
if (tun_type == ICE_SW_TUN_GTP) {
*pkt = dummy_udp_gtp_packet;
*pkt_len = sizeof(dummy_udp_gtp_packet);
@@ -6260,6 +6486,15 @@ ice_fill_adv_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
case ICE_PPPOE:
len = sizeof(struct ice_pppoe_hdr);
break;
+ case ICE_ESP:
+ len = sizeof(struct ice_esp_hdr);
+ break;
+ case ICE_NAT_T:
+ len = sizeof(struct ice_nat_t_hdr);
+ break;
+ case ICE_AH:
+ len = sizeof(struct ice_ah_hdr);
+ break;
default:
return ICE_ERR_PARAM;
}
diff --git a/drivers/net/ice/base/ice_switch.h b/drivers/net/ice/base/ice_switch.h
index f7ae5c741..765ed0945 100644
--- a/drivers/net/ice/base/ice_switch.h
+++ b/drivers/net/ice/base/ice_switch.h
@@ -18,6 +18,7 @@
/* Switch Profile IDs for Profile related switch rules */
#define ICE_PROFID_IPV6_ESP 72
#define ICE_PROFID_IPV6_AH 74
+#define ICE_PROFID_IPV4_NAT_T 75
#define ICE_PROFID_IPV6_NAT_T 76
#define ICE_PROFID_MAC_IPV6_L2TPV3 78
#define ICE_PROFID_IPV4_PFCP_NODE 79
--
2.19.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [dpdk-dev] [PATCH v2 2/3] net/ice/base: add support for L2TP on switch
2020-04-20 5:18 ` [dpdk-dev] [PATCH v2 0/3] add support for L2TP AH ESP and NAT-T on switch Wei Zhao
2020-04-20 5:18 ` [dpdk-dev] [PATCH v2 1/3] net/ice/base: add support for " Wei Zhao
@ 2020-04-20 5:18 ` Wei Zhao
2020-04-20 5:18 ` [dpdk-dev] [PATCH v2 3/3] net/ice: add flow support for AH ESP and L2TP Wei Zhao
2020-04-20 7:26 ` [dpdk-dev] [PATCH v2 0/3] add support for L2TP AH ESP and NAT-T on switch Zhang, Qi Z
3 siblings, 0 replies; 12+ messages in thread
From: Wei Zhao @ 2020-04-20 5:18 UTC (permalink / raw)
To: dev; +Cc: qi.z.zhang, qi.fu, Wei Zhao
Add dummy packet and tunnel type to support
L2TP on switch, now we can use session id as
input set for swicth rule.
Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
---
drivers/net/ice/base/ice_protocol_type.h | 2 +
drivers/net/ice/base/ice_switch.c | 76 ++++++++++++++++++++++++
drivers/net/ice/base/ice_switch.h | 1 +
3 files changed, 79 insertions(+)
diff --git a/drivers/net/ice/base/ice_protocol_type.h b/drivers/net/ice/base/ice_protocol_type.h
index 2ca7cd8ac..46cd77e68 100644
--- a/drivers/net/ice/base/ice_protocol_type.h
+++ b/drivers/net/ice/base/ice_protocol_type.h
@@ -72,6 +72,8 @@ enum ice_sw_tunnel_type {
ICE_SW_TUN_IPV6_AH,
ICE_SW_TUN_IPV4_NAT_T,
ICE_SW_TUN_IPV6_NAT_T,
+ ICE_SW_TUN_IPV4_L2TPV3,
+ ICE_SW_TUN_IPV6_L2TPV3,
ICE_SW_TUN_PROFID_IPV6_ESP,
ICE_SW_TUN_PROFID_IPV6_AH,
ICE_SW_TUN_PROFID_MAC_IPV6_L2TPV3,
diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c
index 1da438f5e..28924085e 100644
--- a/drivers/net/ice/base/ice_switch.c
+++ b/drivers/net/ice/base/ice_switch.c
@@ -760,6 +760,61 @@ static const u8 dummy_ipv6_nat_pkt[] = {
};
+static const struct ice_dummy_pkt_offsets dummy_ipv4_l2tpv3_packet_offsets[] = {
+ { ICE_MAC_OFOS, 0 },
+ { ICE_IPV4_OFOS, 14 },
+ { ICE_L2TPV3, 34 },
+ { ICE_PROTOCOL_LAST, 0 },
+};
+
+static const u8 dummy_ipv4_l2tpv3_pkt[] = {
+ 0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x08, 0x00,
+
+ 0x45, 0x00, 0x00, 0x20, /* ICE_IPV4_IL 14 */
+ 0x00, 0x00, 0x40, 0x00,
+ 0x40, 0x73, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+
+ 0x00, 0x00, 0x00, 0x00, /* ICE_L2TPV3 34 */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, /* 2 bytes for 4 bytes alignment */
+};
+
+static const struct ice_dummy_pkt_offsets dummy_ipv6_l2tpv3_packet_offsets[] = {
+ { ICE_MAC_OFOS, 0 },
+ { ICE_IPV6_OFOS, 14 },
+ { ICE_L2TPV3, 54 },
+ { ICE_PROTOCOL_LAST, 0 },
+};
+
+static const u8 dummy_ipv6_l2tpv3_pkt[] = {
+ 0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x86, 0xDD,
+
+ 0x60, 0x00, 0x00, 0x00, /* ICE_IPV6_IL 14 */
+ 0x00, 0x0c, 0x73, 0x40,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+
+ 0x00, 0x00, 0x00, 0x00, /* ICE_L2TPV3 54 */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, /* 2 bytes for 4 bytes alignment */
+};
+
/* this is a recipe to profile association bitmap */
static ice_declare_bitmap(recipe_to_profile[ICE_MAX_NUM_RECIPES],
ICE_MAX_NUM_PROFILES);
@@ -5939,6 +5994,7 @@ ice_get_compat_fv_bitmap(struct ice_hw *hw, struct ice_adv_rule_info *rinfo,
ice_set_bit(ICE_PROFID_IPV6_AH, bm);
return;
case ICE_SW_TUN_PROFID_MAC_IPV6_L2TPV3:
+ case ICE_SW_TUN_IPV6_L2TPV3:
ice_set_bit(ICE_PROFID_MAC_IPV6_L2TPV3, bm);
return;
case ICE_SW_TUN_PROFID_IPV6_NAT_T:
@@ -5960,6 +6016,9 @@ ice_get_compat_fv_bitmap(struct ice_hw *hw, struct ice_adv_rule_info *rinfo,
case ICE_SW_TUN_IPV4_NAT_T:
ice_set_bit(ICE_PROFID_IPV4_NAT_T, bm);
return;
+ case ICE_SW_TUN_IPV4_L2TPV3:
+ ice_set_bit(ICE_PROFID_MAC_IPV4_L2TPV3, bm);
+ return;
case ICE_SW_TUN_AND_NON_TUN:
default:
prof_type = ICE_PROF_ALL;
@@ -6297,6 +6356,20 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
return;
}
+ if (tun_type == ICE_SW_TUN_IPV4_L2TPV3) {
+ *pkt = dummy_ipv4_l2tpv3_pkt;
+ *pkt_len = sizeof(dummy_ipv4_l2tpv3_pkt);
+ *offsets = dummy_ipv4_l2tpv3_packet_offsets;
+ return;
+ }
+
+ if (tun_type == ICE_SW_TUN_IPV6_L2TPV3) {
+ *pkt = dummy_ipv6_l2tpv3_pkt;
+ *pkt_len = sizeof(dummy_ipv6_l2tpv3_pkt);
+ *offsets = dummy_ipv6_l2tpv3_packet_offsets;
+ return;
+ }
+
if (tun_type == ICE_SW_TUN_GTP) {
*pkt = dummy_udp_gtp_packet;
*pkt_len = sizeof(dummy_udp_gtp_packet);
@@ -6495,6 +6568,9 @@ ice_fill_adv_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
case ICE_AH:
len = sizeof(struct ice_ah_hdr);
break;
+ case ICE_L2TPV3:
+ len = sizeof(struct ice_l2tpv3_sess_hdr);
+ break;
default:
return ICE_ERR_PARAM;
}
diff --git a/drivers/net/ice/base/ice_switch.h b/drivers/net/ice/base/ice_switch.h
index 765ed0945..8cbda4081 100644
--- a/drivers/net/ice/base/ice_switch.h
+++ b/drivers/net/ice/base/ice_switch.h
@@ -20,6 +20,7 @@
#define ICE_PROFID_IPV6_AH 74
#define ICE_PROFID_IPV4_NAT_T 75
#define ICE_PROFID_IPV6_NAT_T 76
+#define ICE_PROFID_MAC_IPV4_L2TPV3 77
#define ICE_PROFID_MAC_IPV6_L2TPV3 78
#define ICE_PROFID_IPV4_PFCP_NODE 79
#define ICE_PROFID_IPV4_PFCP_SESSION 80
--
2.19.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [dpdk-dev] [PATCH v2 3/3] net/ice: add flow support for AH ESP and L2TP
2020-04-20 5:18 ` [dpdk-dev] [PATCH v2 0/3] add support for L2TP AH ESP and NAT-T on switch Wei Zhao
2020-04-20 5:18 ` [dpdk-dev] [PATCH v2 1/3] net/ice/base: add support for " Wei Zhao
2020-04-20 5:18 ` [dpdk-dev] [PATCH v2 2/3] net/ice/base: add support for L2TP " Wei Zhao
@ 2020-04-20 5:18 ` Wei Zhao
2020-04-20 7:26 ` [dpdk-dev] [PATCH v2 0/3] add support for L2TP AH ESP and NAT-T on switch Zhang, Qi Z
3 siblings, 0 replies; 12+ messages in thread
From: Wei Zhao @ 2020-04-20 5:18 UTC (permalink / raw)
To: dev; +Cc: qi.z.zhang, qi.fu, Wei Zhao
Add switch filter support for AH ESP and L2TP protocol,
and use spi or session idas input set for switch rule.
Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
---
drivers/net/ice/ice_generic_flow.c | 25 ++++
drivers/net/ice/ice_generic_flow.h | 23 ++++
drivers/net/ice/ice_switch_filter.c | 198 +++++++++++++++++++++++-----
3 files changed, 216 insertions(+), 30 deletions(-)
diff --git a/drivers/net/ice/ice_generic_flow.c b/drivers/net/ice/ice_generic_flow.c
index 3365aeb86..ad103d0e8 100644
--- a/drivers/net/ice/ice_generic_flow.c
+++ b/drivers/net/ice/ice_generic_flow.c
@@ -1382,18 +1382,37 @@ enum rte_flow_item_type pattern_eth_qinq_pppoes_ipv6_icmp6[] = {
RTE_FLOW_ITEM_TYPE_ICMP6,
RTE_FLOW_ITEM_TYPE_END,
};
+enum rte_flow_item_type pattern_eth_ipv4_esp[] = {
+ RTE_FLOW_ITEM_TYPE_ETH,
+ RTE_FLOW_ITEM_TYPE_IPV4,
+ RTE_FLOW_ITEM_TYPE_ESP,
+ RTE_FLOW_ITEM_TYPE_END,
+};
enum rte_flow_item_type pattern_eth_ipv6_esp[] = {
RTE_FLOW_ITEM_TYPE_ETH,
RTE_FLOW_ITEM_TYPE_IPV6,
RTE_FLOW_ITEM_TYPE_ESP,
RTE_FLOW_ITEM_TYPE_END,
};
+enum rte_flow_item_type pattern_eth_ipv4_ah[] = {
+ RTE_FLOW_ITEM_TYPE_ETH,
+ RTE_FLOW_ITEM_TYPE_IPV4,
+ RTE_FLOW_ITEM_TYPE_AH,
+ RTE_FLOW_ITEM_TYPE_END,
+};
enum rte_flow_item_type pattern_eth_ipv6_ah[] = {
RTE_FLOW_ITEM_TYPE_ETH,
RTE_FLOW_ITEM_TYPE_IPV6,
RTE_FLOW_ITEM_TYPE_AH,
RTE_FLOW_ITEM_TYPE_END,
};
+enum rte_flow_item_type pattern_eth_ipv4_udp_esp[] = {
+ RTE_FLOW_ITEM_TYPE_ETH,
+ RTE_FLOW_ITEM_TYPE_IPV4,
+ RTE_FLOW_ITEM_TYPE_UDP,
+ RTE_FLOW_ITEM_TYPE_ESP,
+ RTE_FLOW_ITEM_TYPE_END,
+};
enum rte_flow_item_type pattern_eth_ipv6_udp_esp[] = {
RTE_FLOW_ITEM_TYPE_ETH,
RTE_FLOW_ITEM_TYPE_IPV6,
@@ -1408,6 +1427,12 @@ enum rte_flow_item_type pattern_eth_ipv6_udp_ah[] = {
RTE_FLOW_ITEM_TYPE_AH,
RTE_FLOW_ITEM_TYPE_END,
};
+enum rte_flow_item_type pattern_eth_ipv4_l2tp[] = {
+ RTE_FLOW_ITEM_TYPE_ETH,
+ RTE_FLOW_ITEM_TYPE_IPV4,
+ RTE_FLOW_ITEM_TYPE_L2TPV3OIP,
+ RTE_FLOW_ITEM_TYPE_END,
+};
enum rte_flow_item_type pattern_eth_ipv6_l2tp[] = {
RTE_FLOW_ITEM_TYPE_ETH,
RTE_FLOW_ITEM_TYPE_IPV6,
diff --git a/drivers/net/ice/ice_generic_flow.h b/drivers/net/ice/ice_generic_flow.h
index 9fe35df45..492a48cd9 100644
--- a/drivers/net/ice/ice_generic_flow.h
+++ b/drivers/net/ice/ice_generic_flow.h
@@ -31,6 +31,10 @@
#define ICE_PROT_NVGRE (1ULL << 20)
#define ICE_PROT_GTPU (1ULL << 21)
#define ICE_PROT_PPPOE_S (1ULL << 22)
+#define ICE_PROT_ESP (1ULL << 23)
+#define ICE_PROT_AH (1ULL << 24)
+#define ICE_PROT_L2TPV3OIP (1ULL << 25)
+#define ICE_PROT_PFCP (1ULL << 26)
/* field */
@@ -52,6 +56,11 @@
#define ICE_GTPU_QFI (1ULL << 48)
#define ICE_PPPOE_SESSION (1ULL << 47)
#define ICE_PPPOE_PROTO (1ULL << 46)
+#define ICE_ESP_SPI (1ULL << 45)
+#define ICE_AH_SPI (1ULL << 44)
+#define ICE_L2TPV3OIP_SESSION_ID (1ULL << 43)
+#define ICE_PFCP_SEID (1ULL << 42)
+#define ICE_PFCP_S_FIELD (1ULL << 41)
/* input set */
@@ -184,6 +193,16 @@
(ICE_PROT_PPPOE_S | ICE_PPPOE_SESSION)
#define ICE_INSET_PPPOE_PROTO \
(ICE_PROT_PPPOE_S | ICE_PPPOE_PROTO)
+#define ICE_INSET_ESP_SPI \
+ (ICE_PROT_ESP | ICE_ESP_SPI)
+#define ICE_INSET_AH_SPI \
+ (ICE_PROT_AH | ICE_AH_SPI)
+#define ICE_INSET_L2TPV3OIP_SESSION_ID \
+ (ICE_PROT_L2TPV3OIP | ICE_L2TPV3OIP_SESSION_ID)
+#define ICE_INSET_PFCP_S_FIELD \
+ (ICE_PROT_PFCP | ICE_PFCP_S_FIELD)
+#define ICE_INSET_PFCP_SEID \
+ (ICE_PROT_PFCP | ICE_PFCP_S_FIELD | ICE_PFCP_SEID)
/* empty pattern */
extern enum rte_flow_item_type pattern_empty[];
@@ -392,14 +411,18 @@ extern enum rte_flow_item_type pattern_eth_vlan_pppoes_ipv6_icmp6[];
extern enum rte_flow_item_type pattern_eth_qinq_pppoes_ipv6_icmp6[];
/* ESP */
+extern enum rte_flow_item_type pattern_eth_ipv4_esp[];
+extern enum rte_flow_item_type pattern_eth_ipv4_udp_esp[];
extern enum rte_flow_item_type pattern_eth_ipv6_esp[];
extern enum rte_flow_item_type pattern_eth_ipv6_udp_esp[];
/* AH */
+extern enum rte_flow_item_type pattern_eth_ipv4_ah[];
extern enum rte_flow_item_type pattern_eth_ipv6_ah[];
extern enum rte_flow_item_type pattern_eth_ipv6_udp_ah[];
/* L2TP */
+extern enum rte_flow_item_type pattern_eth_ipv4_l2tp[];
extern enum rte_flow_item_type pattern_eth_ipv6_l2tp[];
/* PFCP */
diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c
index 55a5618a7..179430136 100644
--- a/drivers/net/ice/ice_switch_filter.c
+++ b/drivers/net/ice/ice_switch_filter.c
@@ -95,6 +95,24 @@
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_IPV4_ESP ( \
+ ICE_SW_INSET_MAC_IPV4 | ICE_INSET_ESP_SPI)
+#define ICE_SW_INSET_MAC_IPV6_ESP ( \
+ ICE_SW_INSET_MAC_IPV6 | ICE_INSET_ESP_SPI)
+#define ICE_SW_INSET_MAC_IPV4_AH ( \
+ ICE_SW_INSET_MAC_IPV4 | ICE_INSET_AH_SPI)
+#define ICE_SW_INSET_MAC_IPV6_AH ( \
+ ICE_SW_INSET_MAC_IPV6 | ICE_INSET_AH_SPI)
+#define ICE_SW_INSET_MAC_IPV4_L2TP ( \
+ ICE_SW_INSET_MAC_IPV4 | ICE_INSET_L2TPV3OIP_SESSION_ID)
+#define ICE_SW_INSET_MAC_IPV6_L2TP ( \
+ ICE_SW_INSET_MAC_IPV6 | ICE_INSET_L2TPV3OIP_SESSION_ID)
+#define ICE_SW_INSET_MAC_IPV4_PFCP ( \
+ ICE_SW_INSET_MAC_IPV4 | \
+ ICE_INSET_PFCP_S_FIELD | ICE_INSET_PFCP_SEID)
+#define ICE_SW_INSET_MAC_IPV6_PFCP ( \
+ ICE_SW_INSET_MAC_IPV6 | \
+ ICE_INSET_PFCP_S_FIELD | ICE_INSET_PFCP_SEID)
struct sw_meta {
struct ice_adv_lkup_elem *list;
@@ -148,16 +166,24 @@ 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_ipv4_esp,
+ ICE_SW_INSET_MAC_IPV4_ESP, ICE_INSET_NONE},
+ {pattern_eth_ipv4_udp_esp,
+ ICE_SW_INSET_MAC_IPV4_ESP, ICE_INSET_NONE},
{pattern_eth_ipv6_esp,
- ICE_INSET_NONE, ICE_INSET_NONE},
+ ICE_SW_INSET_MAC_IPV6_ESP, ICE_INSET_NONE},
{pattern_eth_ipv6_udp_esp,
- ICE_INSET_NONE, ICE_INSET_NONE},
+ ICE_SW_INSET_MAC_IPV6_ESP, ICE_INSET_NONE},
+ {pattern_eth_ipv4_ah,
+ ICE_SW_INSET_MAC_IPV4_AH, ICE_INSET_NONE},
{pattern_eth_ipv6_ah,
- ICE_INSET_NONE, ICE_INSET_NONE},
+ ICE_SW_INSET_MAC_IPV6_AH, ICE_INSET_NONE},
{pattern_eth_ipv6_udp_ah,
ICE_INSET_NONE, ICE_INSET_NONE},
+ {pattern_eth_ipv4_l2tp,
+ ICE_SW_INSET_MAC_IPV4_L2TP, ICE_INSET_NONE},
{pattern_eth_ipv6_l2tp,
- ICE_INSET_NONE, ICE_INSET_NONE},
+ ICE_SW_INSET_MAC_IPV6_L2TP, ICE_INSET_NONE},
{pattern_eth_ipv4_pfcp,
ICE_INSET_NONE, ICE_INSET_NONE},
{pattern_eth_ipv6_pfcp,
@@ -240,16 +266,24 @@ 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_ipv4_esp,
+ ICE_SW_INSET_MAC_IPV4_ESP, ICE_INSET_NONE},
+ {pattern_eth_ipv4_udp_esp,
+ ICE_SW_INSET_MAC_IPV4_ESP, ICE_INSET_NONE},
{pattern_eth_ipv6_esp,
- ICE_INSET_NONE, ICE_INSET_NONE},
+ ICE_SW_INSET_MAC_IPV6_ESP, ICE_INSET_NONE},
{pattern_eth_ipv6_udp_esp,
- ICE_INSET_NONE, ICE_INSET_NONE},
+ ICE_SW_INSET_MAC_IPV6_ESP, ICE_INSET_NONE},
+ {pattern_eth_ipv4_ah,
+ ICE_SW_INSET_MAC_IPV4_AH, ICE_INSET_NONE},
{pattern_eth_ipv6_ah,
- ICE_INSET_NONE, ICE_INSET_NONE},
+ ICE_SW_INSET_MAC_IPV6_AH, ICE_INSET_NONE},
{pattern_eth_ipv6_udp_ah,
ICE_INSET_NONE, ICE_INSET_NONE},
+ {pattern_eth_ipv4_l2tp,
+ ICE_SW_INSET_MAC_IPV4_L2TP, ICE_INSET_NONE},
{pattern_eth_ipv6_l2tp,
- ICE_INSET_NONE, ICE_INSET_NONE},
+ ICE_SW_INSET_MAC_IPV6_L2TP, ICE_INSET_NONE},
{pattern_eth_ipv4_pfcp,
ICE_INSET_NONE, ICE_INSET_NONE},
{pattern_eth_ipv6_pfcp,
@@ -383,11 +417,12 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
const struct rte_flow_item_pfcp *pfcp_spec, *pfcp_mask;
uint64_t input_set = ICE_INSET_NONE;
uint16_t j, t = 0;
- uint16_t tunnel_valid = 0;
- uint16_t pppoe_valid = 0;
- uint16_t ipv6_valiad = 0;
- uint16_t udp_valiad = 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;
for (item = pattern; item->type !=
RTE_FLOW_ITEM_TYPE_END; item++) {
@@ -470,6 +505,7 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
case RTE_FLOW_ITEM_TYPE_IPV4:
ipv4_spec = item->spec;
ipv4_mask = item->mask;
+ ipv4_valiad = 1;
if (ipv4_spec && ipv4_mask) {
/* Check IPv4 mask and update input set */
if (ipv4_mask->hdr.version_ihl ||
@@ -991,48 +1027,151 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
case RTE_FLOW_ITEM_TYPE_ESP:
esp_spec = item->spec;
esp_mask = item->mask;
- if (esp_spec || esp_mask) {
+ if ((esp_spec && !esp_mask) ||
+ (!esp_spec && esp_mask)) {
rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ITEM,
item,
"Invalid esp item");
- return -ENOTSUP;
+ return 0;
+ }
+ /* Check esp mask and update input set */
+ if (esp_mask && esp_mask->hdr.seq) {
+ rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ITEM,
+ item,
+ "Invalid esp mask");
+ return 0;
+ }
+
+ if (!esp_spec && !esp_mask && !input_set) {
+ profile_rule = 1;
+ if (ipv6_valiad && udp_valiad)
+ *tun_type =
+ ICE_SW_TUN_PROFID_IPV6_NAT_T;
+ else if (ipv6_valiad)
+ *tun_type = ICE_SW_TUN_PROFID_IPV6_ESP;
+ else if (ipv4_valiad)
+ return 0;
+ } else if (esp_spec && esp_mask &&
+ esp_mask->hdr.spi){
+ if (udp_valiad)
+ list[t].type = ICE_NAT_T;
+ else
+ list[t].type = ICE_ESP;
+ list[t].h_u.esp_hdr.spi =
+ esp_spec->hdr.spi;
+ list[t].m_u.esp_hdr.spi =
+ esp_mask->hdr.spi;
+ input_set |= ICE_INSET_ESP_SPI;
+ t++;
+ }
+
+ if (!profile_rule) {
+ if (ipv6_valiad && udp_valiad)
+ *tun_type = ICE_SW_TUN_IPV6_NAT_T;
+ else if (ipv4_valiad && udp_valiad)
+ *tun_type = ICE_SW_TUN_IPV4_NAT_T;
+ else if (ipv6_valiad)
+ *tun_type = ICE_SW_TUN_IPV6_ESP;
+ else if (ipv4_valiad)
+ *tun_type = ICE_SW_TUN_IPV4_ESP;
}
- if (ipv6_valiad && udp_valiad)
- *tun_type = ICE_SW_TUN_PROFID_IPV6_NAT_T;
- else if (ipv6_valiad)
- *tun_type = ICE_SW_TUN_PROFID_IPV6_ESP;
break;
case RTE_FLOW_ITEM_TYPE_AH:
ah_spec = item->spec;
ah_mask = item->mask;
- if (ah_spec || ah_mask) {
+ if ((ah_spec && !ah_mask) ||
+ (!ah_spec && ah_mask)) {
rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ITEM,
item,
"Invalid ah item");
- return -ENOTSUP;
+ return 0;
+ }
+ /* Check ah mask and update input set */
+ if (ah_mask &&
+ (ah_mask->next_hdr ||
+ ah_mask->payload_len ||
+ ah_mask->seq_num ||
+ ah_mask->reserved)) {
+ rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ITEM,
+ item,
+ "Invalid ah mask");
+ return 0;
+ }
+
+ if (!ah_spec && !ah_mask && !input_set) {
+ profile_rule = 1;
+ if (ipv6_valiad && udp_valiad)
+ *tun_type =
+ ICE_SW_TUN_PROFID_IPV6_NAT_T;
+ else if (ipv6_valiad)
+ *tun_type = ICE_SW_TUN_PROFID_IPV6_AH;
+ else if (ipv4_valiad)
+ return 0;
+ } else if (ah_spec && ah_mask &&
+ ah_mask->spi){
+ list[t].type = ICE_AH;
+ list[t].h_u.ah_hdr.spi =
+ ah_spec->spi;
+ list[t].m_u.ah_hdr.spi =
+ ah_mask->spi;
+ input_set |= ICE_INSET_AH_SPI;
+ t++;
+ }
+
+ if (!profile_rule) {
+ if (udp_valiad)
+ return 0;
+ else if (ipv6_valiad)
+ *tun_type = ICE_SW_TUN_IPV6_AH;
+ else if (ipv4_valiad)
+ *tun_type = ICE_SW_TUN_IPV4_AH;
}
- if (ipv6_valiad && udp_valiad)
- *tun_type = ICE_SW_TUN_PROFID_IPV6_NAT_T;
- else if (ipv6_valiad)
- *tun_type = ICE_SW_TUN_PROFID_IPV6_AH;
break;
case RTE_FLOW_ITEM_TYPE_L2TPV3OIP:
l2tp_spec = item->spec;
l2tp_mask = item->mask;
- if (l2tp_spec || l2tp_mask) {
+ if ((l2tp_spec && !l2tp_mask) ||
+ (!l2tp_spec && l2tp_mask)) {
rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ITEM,
item,
"Invalid l2tp item");
- return -ENOTSUP;
+ return 0;
+ }
+
+ if (!l2tp_spec && !l2tp_mask && !input_set) {
+ if (ipv6_valiad)
+ *tun_type =
+ ICE_SW_TUN_PROFID_MAC_IPV6_L2TPV3;
+ else if (ipv4_valiad)
+ return 0;
+ } else if (l2tp_spec && l2tp_mask &&
+ l2tp_mask->session_id){
+ list[t].type = ICE_L2TPV3;
+ list[t].h_u.l2tpv3_sess_hdr.session_id =
+ l2tp_spec->session_id;
+ list[t].m_u.l2tpv3_sess_hdr.session_id =
+ l2tp_mask->session_id;
+ input_set |= ICE_INSET_L2TPV3OIP_SESSION_ID;
+ t++;
+ }
+
+ if (!profile_rule) {
+ if (ipv6_valiad)
+ *tun_type =
+ ICE_SW_TUN_IPV6_L2TPV3;
+ else if (ipv4_valiad)
+ *tun_type =
+ ICE_SW_TUN_IPV4_L2TPV3;
}
- if (ipv6_valiad)
- *tun_type = ICE_SW_TUN_PROFID_MAC_IPV6_L2TPV3;
break;
+
case RTE_FLOW_ITEM_TYPE_PFCP:
pfcp_spec = item->spec;
pfcp_mask = item->mask;
@@ -1082,7 +1221,6 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
}
break;
-
case RTE_FLOW_ITEM_TYPE_VOID:
break;
--
2.19.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [dpdk-dev] [PATCH v2 0/3] add support for L2TP AH ESP and NAT-T on switch
2020-04-20 5:18 ` [dpdk-dev] [PATCH v2 0/3] add support for L2TP AH ESP and NAT-T on switch Wei Zhao
` (2 preceding siblings ...)
2020-04-20 5:18 ` [dpdk-dev] [PATCH v2 3/3] net/ice: add flow support for AH ESP and L2TP Wei Zhao
@ 2020-04-20 7:26 ` Zhang, Qi Z
2020-04-22 6:38 ` Ye Xiaolong
3 siblings, 1 reply; 12+ messages in thread
From: Zhang, Qi Z @ 2020-04-20 7:26 UTC (permalink / raw)
To: Zhao1, Wei, dev; +Cc: Fu, Qi
> -----Original Message-----
> From: Zhao1, Wei <wei.zhao1@intel.com>
> Sent: Monday, April 20, 2020 1:19 PM
> To: dev@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Fu, Qi <qi.fu@intel.com>
> Subject: [PATCH v2 0/3] add support for L2TP AH ESP and NAT-T on switch
>
> This patch set add switch filter support for AH ESP NAT-T and L2TP protocol,
> and use spi or session idas input set for switch rule.
>
> v2:
> -fix bug for input set error.
>
> Wei Zhao (3):
> net/ice/base: add support for AH ESP and NAT-T on switch
> net/ice/base: add support for L2TP on switch
> net/ice: add flow support for AH ESP and L2TP
>
> drivers/net/ice/base/ice_protocol_type.h | 14 +
> drivers/net/ice/base/ice_switch.c | 311
> +++++++++++++++++++++++
> drivers/net/ice/base/ice_switch.h | 2 +
> drivers/net/ice/ice_generic_flow.c | 25 ++
> drivers/net/ice/ice_generic_flow.h | 23 ++
> drivers/net/ice/ice_switch_filter.c | 198 ++++++++++++---
> 6 files changed, 543 insertions(+), 30 deletions(-)
>
> --
> 2.19.1
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [dpdk-dev] [PATCH v2 0/3] add support for L2TP AH ESP and NAT-T on switch
2020-04-20 7:26 ` [dpdk-dev] [PATCH v2 0/3] add support for L2TP AH ESP and NAT-T on switch Zhang, Qi Z
@ 2020-04-22 6:38 ` Ye Xiaolong
0 siblings, 0 replies; 12+ messages in thread
From: Ye Xiaolong @ 2020-04-22 6:38 UTC (permalink / raw)
To: Zhang, Qi Z; +Cc: Zhao1, Wei, dev, Fu, Qi
On 04/20, Zhang, Qi Z wrote:
>
>
>> -----Original Message-----
>> From: Zhao1, Wei <wei.zhao1@intel.com>
>> Sent: Monday, April 20, 2020 1:19 PM
>> To: dev@dpdk.org
>> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Fu, Qi <qi.fu@intel.com>
>> Subject: [PATCH v2 0/3] add support for L2TP AH ESP and NAT-T on switch
>>
>> This patch set add switch filter support for AH ESP NAT-T and L2TP protocol,
>> and use spi or session idas input set for switch rule.
>>
>> v2:
>> -fix bug for input set error.
>>
>> Wei Zhao (3):
>> net/ice/base: add support for AH ESP and NAT-T on switch
>> net/ice/base: add support for L2TP on switch
>> net/ice: add flow support for AH ESP and L2TP
>>
>> drivers/net/ice/base/ice_protocol_type.h | 14 +
>> drivers/net/ice/base/ice_switch.c | 311
>> +++++++++++++++++++++++
>> drivers/net/ice/base/ice_switch.h | 2 +
>> drivers/net/ice/ice_generic_flow.c | 25 ++
>> drivers/net/ice/ice_generic_flow.h | 23 ++
>> drivers/net/ice/ice_switch_filter.c | 198 ++++++++++++---
>> 6 files changed, 543 insertions(+), 30 deletions(-)
>>
>> --
>> 2.19.1
>
>Acked-by: Qi Zhang <qi.z.zhang@intel.com>
>
Applied to dpdk-next-net-intel, Thanks.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2020-04-22 6:43 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-17 8:26 [dpdk-dev] [PATCH 0/3] add support for L2TP AH ESP and NAT-T on switch Wei Zhao
2020-04-17 8:26 ` [dpdk-dev] [PATCH 1/3] net/ice/base: add support for " Wei Zhao
2020-04-17 8:26 ` [dpdk-dev] [PATCH 2/3] net/ice/base: add support for L2TP " Wei Zhao
2020-04-17 8:26 ` [dpdk-dev] [PATCH 3/3] net/ice: add flow support for AH ESP and L2TP Wei Zhao
2020-04-20 5:16 ` Zhang, Qi Z
2020-04-20 5:18 ` Zhao1, Wei
2020-04-20 5:18 ` [dpdk-dev] [PATCH v2 0/3] add support for L2TP AH ESP and NAT-T on switch Wei Zhao
2020-04-20 5:18 ` [dpdk-dev] [PATCH v2 1/3] net/ice/base: add support for " Wei Zhao
2020-04-20 5:18 ` [dpdk-dev] [PATCH v2 2/3] net/ice/base: add support for L2TP " Wei Zhao
2020-04-20 5:18 ` [dpdk-dev] [PATCH v2 3/3] net/ice: add flow support for AH ESP and L2TP Wei Zhao
2020-04-20 7:26 ` [dpdk-dev] [PATCH v2 0/3] add support for L2TP AH ESP and NAT-T on switch Zhang, Qi Z
2020-04-22 6:38 ` Ye Xiaolong
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).