From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id BF922A0096 for ; Wed, 10 Apr 2019 18:46:03 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 943B71B130; Wed, 10 Apr 2019 18:46:03 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 49D6D1B130 for ; Wed, 10 Apr 2019 18:46:02 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B2256308CF85; Wed, 10 Apr 2019 16:46:01 +0000 (UTC) Received: from rh.redhat.com (ovpn-117-94.ams2.redhat.com [10.36.117.94]) by smtp.corp.redhat.com (Postfix) with ESMTP id BAF425D961; Wed, 10 Apr 2019 16:46:00 +0000 (UTC) From: Kevin Traynor To: Hyong Youb Kim Cc: dpdk stable Date: Wed, 10 Apr 2019 17:44:06 +0100 Message-Id: <20190410164411.10546-58-ktraynor@redhat.com> In-Reply-To: <20190410164411.10546-1-ktraynor@redhat.com> References: <20190410164411.10546-1-ktraynor@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Wed, 10 Apr 2019 16:46:01 +0000 (UTC) Subject: [dpdk-stable] patch 'net/enic: fix VXLAN match' has been queued to LTS release 18.11.2 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" 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 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 --- 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 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@dpdk.org Signed-off-by: Hyong Youb Kim --- @@ -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,