Skip to contentSkip to conversation

support FDIR inner/outer field for tunnel packet

PATCH In review Zhirun Yan 2 participants 5 messages Sep 28, 2020 – Nov 2, 2020 Network drivers

lore
Share & tools
lore

Zhirun Yan

author
#0 lore raw

cover support FDIR inner/outer field for tunnel packet

support FDIR inner/outer field for tunnel packet
Enable VXLAN inner/outer L2/L3 fields.

Zhirun Yan (2):
net/ice/base: add tunnel support for FDIR net/ice: support inner/outer L2/L3 field for FDIR

 drivers/net/ice/base/ice_fdir.c   |  7 ++++
 drivers/net/ice/base/ice_fdir.h   |  9 +++++
 drivers/net/ice/base/ice_flow.c   |  6 ++--
 drivers/net/ice/ice_fdir_filter.c | 59 +++++++++++++++++++++++++++++--
 4 files changed, 75 insertions(+), 6 deletions(-)
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH 1/2 net/ice/base: add tunnel support for FDIR

Add struct to store outer part for tunnel rule.
Add vxlan ptype in ipv4 mac bitmap. So when create a vxlan rule, the ptype group will be valid.

---
 drivers/net/ice/base/ice_fdir.c | 7 +++++++
 drivers/net/ice/base/ice_fdir.h | 9 +++++++++
 drivers/net/ice/base/ice_flow.c | 6 +++---
 3 files changed, 19 insertions(+), 3 deletions(-)
drivers/net/ice/base/ice_fdir.c +7 -0
index aea388f2a..c15b232db 100644
@@ -1057,6 +1057,13 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,
 			loc[20] = ICE_FDIR_IPV4_PKT_FLAG_DF;
 		break;
 	case ICE_FLTR_PTYPE_NONF_IPV4_UDP:
+		ice_pkt_insert_mac_addr(pkt, input->ext_data_outer.dst_mac);
+		ice_pkt_insert_mac_addr(pkt + ETH_ALEN, input->ext_data_outer.src_mac);
+		ice_pkt_insert_u32(pkt, ICE_IPV4_SRC_ADDR_OFFSET,
+				   input->ip_outer.v4.dst_ip);
+		ice_pkt_insert_u32(pkt, ICE_IPV4_DST_ADDR_OFFSET,
+				   input->ip_outer.v4.src_ip);
+		ice_pkt_insert_u8(pkt, ICE_IPV4_TOS_OFFSET, input->ip_outer.v4.tos);
 		ice_pkt_insert_u32(loc, ICE_IPV4_DST_ADDR_OFFSET,
 				   input->ip.v4.src_ip);
 		ice_pkt_insert_u16(loc, ICE_IPV4_UDP_DST_PORT_OFFSET,
drivers/net/ice/base/ice_fdir.h +9 -0
index 7e00bb273..d363de385 100644
@@ -181,6 +181,15 @@ struct ice_fdir_fltr {
 		struct ice_fdir_v6 v6;
 	} ip, mask;
 
+	/* for tunnel outer part */
+	union {
+		struct ice_fdir_v4 v4;
+		struct ice_fdir_v6 v6;
+	} ip_outer, mask_outer;
+
+	struct ice_fdir_extra ext_data_outer;
+	struct ice_fdir_extra ext_mask_outer;
+
 	struct ice_fdir_udp_gtp gtpu_data;
 	struct ice_fdir_udp_gtp gtpu_mask;
 
drivers/net/ice/base/ice_flow.c +3 -3
index de5dfb228..35e8c59f6 100644
@@ -222,7 +222,7 @@ static const u32 ice_ptypes_macvlan_il[] = {
  * include IPV4 other PTYPEs
  */
 static const u32 ice_ptypes_ipv4_ofos[] = {
-	0x1DC00000, 0x04000800, 0x00000000, 0x00000000,
+	0x1DC00000, 0x24000800, 0x00000000, 0x00000000,
 	0x00000000, 0x00000155, 0x00000000, 0x00000000,
 	0x00000000, 0x000FC000, 0x000002A0, 0x00000000,
 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
@@ -236,7 +236,7 @@ static const u32 ice_ptypes_ipv4_ofos[] = {
  * IPV4 other PTYPEs
  */
 static const u32 ice_ptypes_ipv4_ofos_all[] = {
-	0x1DC00000, 0x04000800, 0x00000000, 0x00000000,
+	0x1DC00000, 0x24000800, 0x00000000, 0x00000000,
 	0x00000000, 0x00000155, 0x00000000, 0x00000000,
 	0x00000000, 0x000FC000, 0x83E0FAA0, 0x00000101,
 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
@@ -434,7 +434,7 @@ static const u32 ice_ptypes_gre_of[] = {
 
 /* Packet types for packets with an Innermost/Last MAC header */
 static const u32 ice_ptypes_mac_il[] = {
-	0x00000000, 0x00000000, 0x00000000, 0x00000000,
+	0x00000000, 0x20000000, 0x00000000, 0x00000000,
 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
Signature · 1 line
2.25.1
author
#2 lore raw

PATCH 2/2 net/ice: support inner/outer L2/L3 field for FDIR

In reply to Zhirun Yan

Distinguish inner/outer fields for parse pattern. So FDIR for tunnel can be more flexible. Enable VXLAN inner/outer L3/L4 different fields for FDIR.

---
 drivers/net/ice/ice_fdir_filter.c | 59 +++++++++++++++++++++++++++++--
 1 file changed, 56 insertions(+), 3 deletions(-)
drivers/net/ice/ice_fdir_filter.c +56 -3
index 175abcdd5..961528d17 100644
@@ -56,6 +56,11 @@
 	ICE_INSET_SCTP_SRC_PORT | ICE_INSET_SCTP_DST_PORT)
 
 #define ICE_FDIR_INSET_VXLAN_IPV4 (\
+	ICE_FDIR_INSET_ETH | \
+	ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST | \
+	ICE_INSET_IPV4_TOS | \
+	ICE_INSET_UDP_DST_PORT | \
+	ICE_INSET_TUN_DMAC | ICE_INSET_TUN_SMAC | \
 	ICE_INSET_TUN_IPV4_SRC | ICE_INSET_TUN_IPV4_DST)
 
 #define ICE_FDIR_INSET_VXLAN_IPV4_TCP (\
@@ -907,6 +912,7 @@ ice_fdir_input_set_parse(uint64_t inset, enum ice_flow_field *field)
 	};
 	static const struct ice_inset_map ice_inset_map[] = {
 		{ICE_INSET_DMAC, ICE_FLOW_FIELD_IDX_ETH_DA},
+		{ICE_INSET_SMAC, ICE_FLOW_FIELD_IDX_ETH_SA},
 		{ICE_INSET_ETHERTYPE, ICE_FLOW_FIELD_IDX_ETH_TYPE},
 		{ICE_INSET_IPV4_SRC, ICE_FLOW_FIELD_IDX_IPV4_SA},
 		{ICE_INSET_IPV4_DST, ICE_FLOW_FIELD_IDX_IPV4_DA},
@@ -1655,6 +1661,14 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 	uint32_t vtc_flow_cpu;
 	uint16_t ether_type;
 	enum rte_flow_item_type next_type;
+	bool is_outer_part = true;
+
+	for (item = pattern; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
+		if (item->type == RTE_FLOW_ITEM_TYPE_VXLAN) {
+			tunnel_type = ICE_FDIR_TUNNEL_TYPE_VXLAN;
+			break;
+		}
+	}
 
 	for (item = pattern; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
 		if (item->last) {
@@ -1672,7 +1686,25 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 			eth_mask = item->mask;
 			next_type = (item + 1)->type;
 
-			if (eth_spec && eth_mask) {
+			if (!(eth_spec && eth_mask))
+				break;
+
+			/* handle outer L2 fields */
+			if (is_outer_part && tunnel_type == ICE_FDIR_TUNNEL_TYPE_VXLAN) {
+				if (!rte_is_zero_ether_addr(&eth_mask->dst)) {
+					filter->outer_input_set |= ICE_INSET_DMAC;
+					rte_memcpy(&filter->input.ext_data_outer.dst_mac,
+						   &eth_spec->dst,
+						   RTE_ETHER_ADDR_LEN);
+				}
+
+				if (!rte_is_zero_ether_addr(&eth_mask->src)) {
+					filter->outer_input_set |= ICE_INSET_SMAC;
+					rte_memcpy(&filter->input.ext_data_outer.src_mac,
+						   &eth_spec->src,
+						   RTE_ETHER_ADDR_LEN);
+				}
+			} else {
 				if (!rte_is_zero_ether_addr(&eth_mask->dst)) {
 					input_set |= ICE_INSET_DMAC;
 					rte_memcpy(&filter->input.ext_data.dst_mac,
@@ -1714,7 +1746,27 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 			ipv4_spec = item->spec;
 			ipv4_mask = item->mask;
 
-			if (ipv4_spec && ipv4_mask) {
+			if (!(ipv4_spec && ipv4_mask))
+				break;
+
+			/* handle outer L3 fields */
+			if (is_outer_part && tunnel_type == ICE_FDIR_TUNNEL_TYPE_VXLAN) {
+				if (ipv4_mask->hdr.dst_addr == UINT32_MAX) {
+					filter->outer_input_set |= ICE_INSET_IPV4_DST;
+					filter->input.ip_outer.v4.dst_ip =
+						ipv4_spec->hdr.dst_addr;
+				}
+				if (ipv4_mask->hdr.src_addr == UINT32_MAX) {
+					filter->outer_input_set |= ICE_INSET_IPV4_SRC;
+					filter->input.ip_outer.v4.src_ip =
+						ipv4_spec->hdr.src_addr;
+				}
+				if (ipv4_mask->hdr.type_of_service == UINT8_MAX) {
+					input_set |= ICE_INSET_IPV4_TOS;
+					filter->input.ip_outer.v4.tos =
+						ipv4_spec->hdr.type_of_service;
+				}
+			} else {
 				/* Check IPv4 mask and update input set */
 				if (ipv4_mask->hdr.version_ihl ||
 				    ipv4_mask->hdr.total_length ||
@@ -1944,6 +1996,8 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 			break;
 		case RTE_FLOW_ITEM_TYPE_VXLAN:
 			l3 = RTE_FLOW_ITEM_TYPE_END;
+			is_outer_part = false;
+
 			vxlan_spec = item->spec;
 			vxlan_mask = item->mask;
 
@@ -1955,7 +2009,6 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 				return -rte_errno;
 			}
 
-			tunnel_type = ICE_FDIR_TUNNEL_TYPE_VXLAN;
 			break;
 		case RTE_FLOW_ITEM_TYPE_GTPU:
 			l3 = RTE_FLOW_ITEM_TYPE_END;
Signature · 1 line
2.25.1
#3 lore raw

Re: [dpdk-dev] [PATCH v1 2/2] net/ice: support inner/outer L2/L3 field for FDIR

Quoted 92 lines

-----Original Message-----
From: Yan, Zhirun <[email protected]>
Sent: Monday, September 28, 2020 2:32 PM
To: Zhang, Qi Z <[email protected]>; [email protected]
Cc: Cao, Yahui <[email protected]>; Wang, Xiao W <[email protected]>; Su, Simei <[email protected]>; Guo, Junfeng <[email protected]>; Yan, Zhirun <[email protected]>
Subject: [PATCH v1 2/2] net/ice: support inner/outer L2/L3 field for FDIR

Distinguish inner/outer fields for parse pattern. So FDIR for tunnel can be more flexible. Enable VXLAN inner/outer L3/L4 different fields for FDIR.

---
 drivers/net/ice/ice_fdir_filter.c | 59 +++++++++++++++++++++++++++++--
 1 file changed, 56 insertions(+), 3 deletions(-)
drivers/net/ice/ice_fdir_filter.c +6 -0
index 175abcdd5..961528d17 100644
@@ -56,6 +56,11 @@
 	ICE_INSET_SCTP_SRC_PORT | ICE_INSET_SCTP_DST_PORT)
 
 #define ICE_FDIR_INSET_VXLAN_IPV4 (\
+	ICE_FDIR_INSET_ETH | \
+	ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST | \
+	ICE_INSET_IPV4_TOS | \
+	ICE_INSET_UDP_DST_PORT | \
+	ICE_INSET_TUN_DMAC | ICE_INSET_TUN_SMAC | \
 	ICE_INSET_TUN_IPV4_SRC | ICE_INSET_TUN_IPV4_DST)
 
 #define ICE_FDIR_INSET_VXLAN_IPV4_TCP (\
@@ -907,6 +912,7 @@ ice_fdir_input_set_parse(uint64_t inset, enum
 ice_flow_field *field)
 	};
 	static const struct ice_inset_map ice_inset_map[] = {
 		{ICE_INSET_DMAC, ICE_FLOW_FIELD_IDX_ETH_DA},
+		{ICE_INSET_SMAC, ICE_FLOW_FIELD_IDX_ETH_SA},
 		{ICE_INSET_ETHERTYPE, ICE_FLOW_FIELD_IDX_ETH_TYPE},
 		{ICE_INSET_IPV4_SRC, ICE_FLOW_FIELD_IDX_IPV4_SA},
drivers/net/ice/ice_fdir_filter.c +8 -0
 		{ICE_INSET_IPV4_DST, ICE_FLOW_FIELD_IDX_IPV4_DA},
@@ -1655,6 +1661,14 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 	uint32_t vtc_flow_cpu;
 	uint16_t ether_type;
 	enum rte_flow_item_type next_type;
+	bool is_outer_part = true;
+
+	for (item = pattern; item->type != RTE_FLOW_ITEM_TYPE_END; item++)
 {
+		if (item->type == RTE_FLOW_ITEM_TYPE_VXLAN) {
+			tunnel_type = ICE_FDIR_TUNNEL_TYPE_VXLAN;
+			break;
+		}
+	}
 
 	for (item = pattern; item->type != RTE_FLOW_ITEM_TYPE_END; item++)

{

drivers/net/ice/ice_fdir_filter.c +19 -1
 		if (item->last) {
@@ -1672,7 +1686,25 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 			eth_mask = item->mask;
 			next_type = (item + 1)->type;
 
-			if (eth_spec && eth_mask) {
+			if (!(eth_spec && eth_mask))
+				break;
+
+			/* handle outer L2 fields */
+			if (is_outer_part && tunnel_type == ICE_FDIR_TUNNEL_TYPE_VXLAN) {
+				if (!rte_is_zero_ether_addr(&eth_mask->dst))
 {
+					filter->outer_input_set |= ICE_INSET_DMAC;
+					rte_memcpy(&filter->input.ext_data_outer.dst_mac,
+						   &eth_spec->dst,
+						   RTE_ETHER_ADDR_LEN);
+				}
+
+				if (!rte_is_zero_ether_addr(&eth_mask->src)) {
+					filter->outer_input_set |=ICE_INSET_SMAC;
+					rte_memcpy(&filter->input.ext_data_outer.src_mac,
+						   &eth_spec->src,
+						   RTE_ETHER_ADDR_LEN);
+				}
+			} else {
 				if (!rte_is_zero_ether_addr(&eth_mask->dst))
 {
drivers/net/ice/ice_fdir_filter.c +0 -0
 					input_set |= ICE_INSET_DMAC;
 					rte_memcpy(&filter->input.ext_data.dst_mac,

drivers/net/ice/ice_fdir_filter.c ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, · line 1751

Quoted 7 lines
drivers/net/ice/ice_fdir_filter.c +3 -1
@@ -1714,7 +1746,27 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 			ipv4_spec = item->spec;
 			ipv4_mask = item->mask;
 
-			if (ipv4_spec && ipv4_mask) {
+			if (!(ipv4_spec && ipv4_mask))
+				break;
+

[Cao, Yahui]
It seems below code has quite some duplication with code within the else condition
Can you use a pointer *input_set and *ip to point to the different input_set bits and input_set value,
So that existing code can be reused.

Quoted 4 lines
drivers/net/ice/ice_fdir_filter.c +4 -0
+			/* handle outer L3 fields */
+			if (is_outer_part && tunnel_type == ICE_FDIR_TUNNEL_TYPE_VXLAN) {
+				if (ipv4_mask->hdr.dst_addr == UINT32_MAX) {
+					filter->outer_input_set |= ICE_INSET_IPV4_DST;

drivers/net/ice/ice_fdir_filter.c ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, · line 1765

Quoted 10 lines
drivers/net/ice/ice_fdir_filter.c +10 -0
+					filter->input.ip_outer.v4.dst_ip =
+						ipv4_spec->hdr.dst_addr;
+				}
+				if (ipv4_mask->hdr.src_addr == UINT32_MAX) {
+					filter->outer_input_set |= ICE_INSET_IPV4_SRC;
+					filter->input.ip_outer.v4.src_ip =
+						ipv4_spec->hdr.src_addr;
+				}
+				if (ipv4_mask->hdr.type_of_service == UINT8_MAX) {
+					input_set |= ICE_INSET_IPV4_TOS;

[Cao, Yahui]
Why use input_set instead of filter->outer_input_set in the VXLAN outer section ?

Quoted 26 lines
drivers/net/ice/ice_fdir_filter.c +6 -2
+					filter->input.ip_outer.v4.tos =
+						ipv4_spec->hdr.type_of_service;
+				}
+			} else {
 				/* Check IPv4 mask and update input set */
 				if (ipv4_mask->hdr.version_ihl ||
 				    ipv4_mask->hdr.total_length ||
@@ -1944,6 +1996,8 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 			break;
 		case RTE_FLOW_ITEM_TYPE_VXLAN:
 			l3 = RTE_FLOW_ITEM_TYPE_END;
+			is_outer_part = false;
+
 			vxlan_spec = item->spec;
 			vxlan_mask = item->mask;
 
@@ -1955,7 +2009,6 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 				return -rte_errno;
 			}
 
-			tunnel_type = ICE_FDIR_TUNNEL_TYPE_VXLAN;
 			break;
 		case RTE_FLOW_ITEM_TYPE_GTPU:
 			l3 = RTE_FLOW_ITEM_TYPE_END;
--

2.25.1

#4 lore raw

Re: [dpdk-dev] [PATCH v1 2/2] net/ice: support inner/outer L2/L3 field for FDIR

Quoted 122 lines

-----Original Message-----
From: Cao, Yahui
Sent: Thursday, October 15, 2020 5:29 PM
To: Yan, Zhirun <[email protected]>; Zhang, Qi Z <[email protected]>; [email protected]
Cc: Wang, Xiao W <[email protected]>; Su, Simei <[email protected]>; Guo, Junfeng <[email protected]>
Subject: RE: [PATCH v1 2/2] net/ice: support inner/outer L2/L3 field for FDIR

Quoted 38 lines

-----Original Message-----
From: Yan, Zhirun <[email protected]>
Sent: Monday, September 28, 2020 2:32 PM
To: Zhang, Qi Z <[email protected]>; [email protected]
Cc: Cao, Yahui <[email protected]>; Wang, Xiao W <[email protected]>; Su, Simei <[email protected]>; Guo, Junfeng <[email protected]>; Yan, Zhirun <[email protected]>
Subject: [PATCH v1 2/2] net/ice: support inner/outer L2/L3 field for FDIR

Distinguish inner/outer fields for parse pattern. So FDIR for tunnel can be more flexible. Enable VXLAN inner/outer L3/L4 different fields for FDIR.

---
 drivers/net/ice/ice_fdir_filter.c | 59
+++++++++++++++++++++++++++++--
 1 file changed, 56 insertions(+), 3 deletions(-)
drivers/net/ice/ice_fdir_filter.c +5 -0
index 175abcdd5..961528d17 100644
@@ -56,6 +56,11 @@
 	ICE_INSET_SCTP_SRC_PORT | ICE_INSET_SCTP_DST_PORT)
 
 #define ICE_FDIR_INSET_VXLAN_IPV4 (\
+	ICE_FDIR_INSET_ETH | \
+	ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST | \
+	ICE_INSET_IPV4_TOS | \
+	ICE_INSET_UDP_DST_PORT | \
+	ICE_INSET_TUN_DMAC | ICE_INSET_TUN_SMAC | \
 	ICE_INSET_TUN_IPV4_SRC | ICE_INSET_TUN_IPV4_DST)
 
 #define ICE_FDIR_INSET_VXLAN_IPV4_TCP (\ @@ -907,6 +912,7 @@

ice_fdir_input_set_parse(uint64_t inset, enum ice_flow_field *field)

drivers/net/ice/ice_fdir_filter.c ice_fdir_input_set_parse(uint64_t inset, enum ice_flow_field *field)

Quoted 7 lines
drivers/net/ice/ice_fdir_filter.c +1 -0
 	};
 	static const struct ice_inset_map ice_inset_map[] = {
 		{ICE_INSET_DMAC, ICE_FLOW_FIELD_IDX_ETH_DA},
+		{ICE_INSET_SMAC, ICE_FLOW_FIELD_IDX_ETH_SA},
 		{ICE_INSET_ETHERTYPE, ICE_FLOW_FIELD_IDX_ETH_TYPE},
 		{ICE_INSET_IPV4_SRC, ICE_FLOW_FIELD_IDX_IPV4_SA},
 		{ICE_INSET_IPV4_DST, ICE_FLOW_FIELD_IDX_IPV4_DA}, @@

-1655,6

Quoted 1 line

+1661,14 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter

*ad,

drivers/net/ice/ice_fdir_filter.c ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,

Quoted 6 lines
drivers/net/ice/ice_fdir_filter.c +3 -0
 	uint32_t vtc_flow_cpu;
 	uint16_t ether_type;
 	enum rte_flow_item_type next_type;
+	bool is_outer_part = true;
+
+	for (item = pattern; item->type != RTE_FLOW_ITEM_TYPE_END;

item++)

drivers/net/ice/ice_fdir_filter.c ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,

Quoted 8 lines

{

drivers/net/ice/ice_fdir_filter.c +5 -0
+		if (item->type == RTE_FLOW_ITEM_TYPE_VXLAN) {
+			tunnel_type = ICE_FDIR_TUNNEL_TYPE_VXLAN;
+			break;
+		}
+	}
 
 	for (item = pattern; item->type != RTE_FLOW_ITEM_TYPE_END;

item++) {

drivers/net/ice/ice_fdir_filter.c ice_fdir_parse_pattern(__rte_unused struct

Quoted 2 lines
drivers/net/ice/ice_fdir_filter.c +0 -0
 		if (item->last) {
@@ -1672,7 +1686,25 @@ ice_fdir_parse_pattern(__rte_unused struct

ice_adapter *ad,

drivers/net/ice/ice_fdir_filter.c ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,

Quoted 9 lines
drivers/net/ice/ice_fdir_filter.c +5 -1
 			eth_mask = item->mask;
 			next_type = (item + 1)->type;
 
-			if (eth_spec && eth_mask) {
+			if (!(eth_spec && eth_mask))
+				break;
+
+			/* handle outer L2 fields */
+			if (is_outer_part && tunnel_type ==

ICE_FDIR_TUNNEL_TYPE_VXLAN) {

drivers/net/ice/ice_fdir_filter.c ice_fdir_parse_pattern(__rte_unused struct · line 1697

Quoted 4 lines
drivers/net/ice/ice_fdir_filter.c +2 -0
+				if (!rte_is_zero_ether_addr(&eth_mask-
 dst))
 {
+					filter->outer_input_set |=

ICE_INSET_DMAC;

drivers/net/ice/ice_fdir_filter.c

Quoted 9 lines
drivers/net/ice/ice_fdir_filter.c +6 -0
+					rte_memcpy(&filter-
 input.ext_data_outer.dst_mac,
+						   &eth_spec->dst,
+						   RTE_ETHER_ADDR_LEN);
+				}
+
+				if (!rte_is_zero_ether_addr(&eth_mask-

src)) {

drivers/net/ice/ice_fdir_filter.c +1 -0
+					filter->outer_input_set

|=ICE_INSET_SMAC;

drivers/net/ice/ice_fdir_filter.c ice_fdir_parse_pattern(__rte_unused struct

Quoted 13 lines
drivers/net/ice/ice_fdir_filter.c +1 -0
+					rte_memcpy(&filter-

input.ext_data_outer.src_mac,

drivers/net/ice/ice_fdir_filter.c +4 -0
+						   &eth_spec->src,
+						   RTE_ETHER_ADDR_LEN);
+				}
+			} else {
 				if (!rte_is_zero_ether_addr(&eth_mask-

dst))
{

drivers/net/ice/ice_fdir_filter.c +0 -0
 					input_set |= ICE_INSET_DMAC;
 					rte_memcpy(&filter-

input.ext_data.dst_mac,

drivers/net/ice/ice_fdir_filter.c +0 -0
@@ -1714,7 +1746,27 @@ ice_fdir_parse_pattern(__rte_unused struct

ice_adapter *ad,

Quoted 3 lines
drivers/net/ice/ice_fdir_filter.c +0 -0
 			ipv4_spec = item->spec;
 			ipv4_mask = item->mask;
 
Quoted 8 lines

drivers/net/ice/ice_fdir_filter.c ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, · line 1751

Quoted 4 lines
drivers/net/ice/ice_fdir_filter.c +3 -1
-			if (ipv4_spec && ipv4_mask) {
+			if (!(ipv4_spec && ipv4_mask))
+				break;
+

[Cao, Yahui]
It seems below code has quite some duplication with code within the else condition Can you use a pointer *input_set and *ip to point to the different input_set bits and input_set value, So that existing code can be reused.

Yes, you are right. And I will refactor this part in V2. Thanks.

Quoted 19 lines

drivers/net/ice/ice_fdir_filter.c ice_fdir_parse_pattern(__rte_unused struct · line 1753

Quoted 2 lines
drivers/net/ice/ice_fdir_filter.c +2 -0
+			/* handle outer L3 fields */
+			if (is_outer_part && tunnel_type ==

ICE_FDIR_TUNNEL_TYPE_VXLAN) {

drivers/net/ice/ice_fdir_filter.c ice_fdir_parse_pattern(__rte_unused struct · line 1754

Quoted 1 line
drivers/net/ice/ice_fdir_filter.c +1 -0
+				if (ipv4_mask->hdr.dst_addr ==

UINT32_MAX) {

drivers/net/ice/ice_fdir_filter.c ice_fdir_parse_pattern(__rte_unused struct · line 1755

Quoted 1 line
drivers/net/ice/ice_fdir_filter.c +1 -0
+					filter->outer_input_set |=

ICE_INSET_IPV4_DST;

drivers/net/ice/ice_fdir_filter.c ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,

Quoted 4 lines
drivers/net/ice/ice_fdir_filter.c +4 -0
+					filter->input.ip_outer.v4.dst_ip =
+						ipv4_spec->hdr.dst_addr;
+				}
+				if (ipv4_mask->hdr.src_addr == UINT32_MAX)

{

drivers/net/ice/ice_fdir_filter.c ice_fdir_parse_pattern(__rte_unused struct · line 1760

Quoted 1 line
drivers/net/ice/ice_fdir_filter.c +1 -0
+					filter->outer_input_set |=

ICE_INSET_IPV4_SRC;

drivers/net/ice/ice_fdir_filter.c ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,

Quoted 4 lines
drivers/net/ice/ice_fdir_filter.c +4 -0
+					filter->input.ip_outer.v4.src_ip =
+						ipv4_spec->hdr.src_addr;
+				}
+				if (ipv4_mask->hdr.type_of_service ==

UINT8_MAX) {

Quoted 5 lines

drivers/net/ice/ice_fdir_filter.c ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, · line 1765

Quoted 1 line
drivers/net/ice/ice_fdir_filter.c +1 -0
+					input_set |= ICE_INSET_IPV4_TOS;

[Cao, Yahui]
Why use input_set instead of filter->outer_input_set in the VXLAN outer section ?

Typo, will fix it in V2. Thanks.

Quoted 29 lines
Quoted 8 lines
drivers/net/ice/ice_fdir_filter.c +4 -0
+					filter->input.ip_outer.v4.tos =
+						ipv4_spec-
 hdr.type_of_service;
+				}
+			} else {
 				/* Check IPv4 mask and update input set */
 				if (ipv4_mask->hdr.version_ihl ||

ipv4_mask->hdr.total_length || @@ -

1944,6 +1996,8 @@

drivers/net/ice/ice_fdir_filter.c ice_fdir_parse_pattern(__rte_unused struct

Quoted 10 lines

ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,

drivers/net/ice/ice_fdir_filter.c +2 -0
 			break;
 		case RTE_FLOW_ITEM_TYPE_VXLAN:
 			l3 = RTE_FLOW_ITEM_TYPE_END;
+			is_outer_part = false;
+
 			vxlan_spec = item->spec;
 			vxlan_mask = item->mask;
@@ -1955,7 +2009,6 @@ ice_fdir_parse_pattern(__rte_unused struct

ice_adapter *ad,

Quoted 9 lines
drivers/net/ice/ice_fdir_filter.c +0 -2
 				return -rte_errno;
 			}
 
-			tunnel_type = ICE_FDIR_TUNNEL_TYPE_VXLAN;
 			break;
 		case RTE_FLOW_ITEM_TYPE_GTPU:
 			l3 = RTE_FLOW_ITEM_TYPE_END;
--

2.25.1