[dpdk-stable] patch 'net/enic: fix VXLAN match' has been queued to LTS release 18.11.2

Kevin Traynor ktraynor at redhat.com
Wed Apr 10 18:44:06 CEST 2019


Hi,

FYI, your patch has been queued to LTS release 18.11.2

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 04/16/19. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Thanks.

Kevin Traynor

---
>From 1ed7874a2952ca605eb3449b383b27e5bf602802 Mon Sep 17 00:00:00 2001
From: Hyong Youb Kim <hyonkim at cisco.com>
Date: Sat, 2 Mar 2019 02:42:49 -0800
Subject: [PATCH] net/enic: fix VXLAN match

[ upstream commit d7316eae1a8ab1d8dfb7ac7f2c8804f1a98f2144 ]

The filter API does not have flags for "match VXLAN". Explicitly set
the UDP destination port and mask in the L4 pattern. Otherwise, UDP
packets with non-VXLAN ports may be falsely reported as VXLAN.

1400 series VIC adapters have hardware VXLAN parsing. The L5 buffer on
the NIC starts with the inner Ethernet header, and the VXLAN header is
now in the L4 buffer following the UDP header. So the VXLAN spec/mask
needs to be in the L4 pattern, not L5. Older models still expect the
VXLAN spec/mask in the L5 pattern. Fix up the L4/L5 patterns
accordingly.

Fixes: 6ced137607d0 ("net/enic: flow API for NICs with advanced filters enabled")

Signed-off-by: Hyong Youb Kim <hyonkim at cisco.com>
---
 drivers/net/enic/enic_flow.c | 46 +++++++++++++++++++++++++++++++++++-
 1 file changed, 45 insertions(+), 1 deletion(-)

diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c
index c60476c8c..4d4d4b315 100644
--- a/drivers/net/enic/enic_flow.c
+++ b/drivers/net/enic/enic_flow.c
@@ -886,4 +886,5 @@ enic_copy_item_vxlan_v2(const struct rte_flow_item *item,
 	const struct rte_flow_item_vxlan *mask = item->mask;
 	struct filter_generic_1 *gp = &enic_filter->u.generic_1;
+	struct udp_hdr *udp;
 
 	FLOW_TRACE();
@@ -892,4 +893,14 @@ enic_copy_item_vxlan_v2(const struct rte_flow_item *item,
 		return EINVAL;
 
+	/*
+	 * The NIC filter API has no flags for "match vxlan". Set UDP port to
+	 * avoid false positives.
+	 */
+	gp->mask_flags |= FILTER_GENERIC_1_UDP;
+	gp->val_flags |= FILTER_GENERIC_1_UDP;
+	udp = (struct udp_hdr *)gp->layer[FILTER_GENERIC_1_L4].mask;
+	udp->dst_port = 0xffff;
+	udp = (struct udp_hdr *)gp->layer[FILTER_GENERIC_1_L4].val;
+	udp->dst_port = RTE_BE16(4789);
 	/* Match all if no spec */
 	if (!spec)
@@ -939,4 +950,34 @@ item_stacking_valid(enum rte_flow_item_type prev_item,
 }
 
+/*
+ * Fix up the L5 layer.. HW vxlan parsing removes vxlan header from L5.
+ * Instead it is in L4 following the UDP header. Append the vxlan
+ * pattern to L4 (udp) and shift any inner packet pattern in L5.
+ */
+static void
+fixup_l5_layer(struct enic *enic, struct filter_generic_1 *gp,
+	       uint8_t inner_ofst)
+{
+	uint8_t layer[FILTER_GENERIC_1_KEY_LEN];
+	uint8_t inner;
+	uint8_t vxlan;
+
+	if (!(inner_ofst > 0 && enic->vxlan))
+		return;
+	FLOW_TRACE();
+	vxlan = sizeof(struct vxlan_hdr);
+	memcpy(gp->layer[FILTER_GENERIC_1_L4].mask + sizeof(struct udp_hdr),
+	       gp->layer[FILTER_GENERIC_1_L5].mask, vxlan);
+	memcpy(gp->layer[FILTER_GENERIC_1_L4].val + sizeof(struct udp_hdr),
+	       gp->layer[FILTER_GENERIC_1_L5].val, vxlan);
+	inner = inner_ofst - vxlan;
+	memset(layer, 0, sizeof(layer));
+	memcpy(layer, gp->layer[FILTER_GENERIC_1_L5].mask + vxlan, inner);
+	memcpy(gp->layer[FILTER_GENERIC_1_L5].mask, layer, sizeof(layer));
+	memset(layer, 0, sizeof(layer));
+	memcpy(layer, gp->layer[FILTER_GENERIC_1_L5].val + vxlan, inner);
+	memcpy(gp->layer[FILTER_GENERIC_1_L5].val, layer, sizeof(layer));
+}
+
 /**
  * Build the intenal enic filter structure from the provided pattern. The
@@ -953,4 +994,5 @@ static int
 enic_copy_filter(const struct rte_flow_item pattern[],
 		 const struct enic_filter_cap *cap,
+		 struct enic *enic,
 		 struct filter_v2 *enic_filter,
 		 struct rte_flow_error *error)
@@ -994,4 +1036,6 @@ enic_copy_filter(const struct rte_flow_item pattern[],
 		is_first_item = 0;
 	}
+	fixup_l5_layer(enic, &enic_filter->u.generic_1, inner_ofst);
+
 	return 0;
 
@@ -1436,5 +1480,5 @@ enic_flow_parse(struct rte_eth_dev *dev,
 	}
 	enic_filter->type = enic->flow_filter_mode;
-	ret = enic_copy_filter(pattern, enic_filter_cap,
+	ret = enic_copy_filter(pattern, enic_filter_cap, enic,
 				       enic_filter, error);
 	return ret;
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2019-04-10 14:06:12.310638188 +0100
+++ 0058-net-enic-fix-VXLAN-match.patch	2019-04-10 14:06:08.016290764 +0100
@@ -1,8 +1,10 @@
-From d7316eae1a8ab1d8dfb7ac7f2c8804f1a98f2144 Mon Sep 17 00:00:00 2001
+From 1ed7874a2952ca605eb3449b383b27e5bf602802 Mon Sep 17 00:00:00 2001
 From: Hyong Youb Kim <hyonkim at cisco.com>
 Date: Sat, 2 Mar 2019 02:42:49 -0800
 Subject: [PATCH] net/enic: fix VXLAN match
 
+[ upstream commit d7316eae1a8ab1d8dfb7ac7f2c8804f1a98f2144 ]
+
 The filter API does not have flags for "match VXLAN". Explicitly set
 the UDP destination port and mask in the L4 pattern. Otherwise, UDP
 packets with non-VXLAN ports may be falsely reported as VXLAN.
@@ -15,7 +17,6 @@
 accordingly.
 
 Fixes: 6ced137607d0 ("net/enic: flow API for NICs with advanced filters enabled")
-Cc: stable at dpdk.org
 
 Signed-off-by: Hyong Youb Kim <hyonkim at cisco.com>
 ---
@@ -23,16 +24,16 @@
  1 file changed, 45 insertions(+), 1 deletion(-)
 
 diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c
-index ffc6ce1da..da43b31dc 100644
+index c60476c8c..4d4d4b315 100644
 --- a/drivers/net/enic/enic_flow.c
 +++ b/drivers/net/enic/enic_flow.c
-@@ -831,4 +831,5 @@ enic_copy_item_vxlan_v2(struct copy_item_args *arg)
+@@ -886,4 +886,5 @@ enic_copy_item_vxlan_v2(const struct rte_flow_item *item,
  	const struct rte_flow_item_vxlan *mask = item->mask;
  	struct filter_generic_1 *gp = &enic_filter->u.generic_1;
 +	struct udp_hdr *udp;
  
  	FLOW_TRACE();
-@@ -837,4 +838,14 @@ enic_copy_item_vxlan_v2(struct copy_item_args *arg)
+@@ -892,4 +893,14 @@ enic_copy_item_vxlan_v2(const struct rte_flow_item *item,
  		return EINVAL;
  
 +	/*
@@ -47,7 +48,7 @@
 +	udp->dst_port = RTE_BE16(4789);
  	/* Match all if no spec */
  	if (!spec)
-@@ -932,4 +943,34 @@ item_stacking_valid(enum rte_flow_item_type prev_item,
+@@ -939,4 +950,34 @@ item_stacking_valid(enum rte_flow_item_type prev_item,
  }
  
 +/*
@@ -82,20 +83,20 @@
 +
  /**
   * Build the intenal enic filter structure from the provided pattern. The
-@@ -946,4 +987,5 @@ static int
+@@ -953,4 +994,5 @@ static int
  enic_copy_filter(const struct rte_flow_item pattern[],
  		 const struct enic_filter_cap *cap,
 +		 struct enic *enic,
  		 struct filter_v2 *enic_filter,
  		 struct rte_flow_error *error)
-@@ -990,4 +1032,6 @@ enic_copy_filter(const struct rte_flow_item pattern[],
+@@ -994,4 +1036,6 @@ enic_copy_filter(const struct rte_flow_item pattern[],
  		is_first_item = 0;
  	}
 +	fixup_l5_layer(enic, &enic_filter->u.generic_1, inner_ofst);
 +
  	return 0;
  
-@@ -1482,5 +1526,5 @@ enic_flow_parse(struct rte_eth_dev *dev,
+@@ -1436,5 +1480,5 @@ enic_flow_parse(struct rte_eth_dev *dev,
  	}
  	enic_filter->type = enic->flow_filter_mode;
 -	ret = enic_copy_filter(pattern, enic_filter_cap,


More information about the stable mailing list