From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 37565A0613 for ; Tue, 23 Jul 2019 03:02:01 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 148901BEE8; Tue, 23 Jul 2019 03:02:01 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id E279C1BEDA for ; Tue, 23 Jul 2019 03:01:59 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE2 (envelope-from yskoh@mellanox.com) with ESMTPS (AES256-SHA encrypted); 23 Jul 2019 04:01:56 +0300 Received: from scfae-sc-2.mti.labs.mlnx (scfae-sc-2.mti.labs.mlnx [10.101.0.96]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x6N11Hf9026580; Tue, 23 Jul 2019 04:01:55 +0300 From: Yongseok Koh To: Hyong Youb Kim Cc: John Daley , dpdk stable Date: Mon, 22 Jul 2019 17:59:50 -0700 Message-Id: <20190723010115.6446-23-yskoh@mellanox.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190723010115.6446-1-yskoh@mellanox.com> References: <20190723010115.6446-1-yskoh@mellanox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/enic: fix SCTP match for flow API' has been queued to LTS release 17.11.7 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 17.11.7 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objection by 07/27/19. So please shout if anyone has objection. 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. Yongseok --- >From b1ed5dea5fa3b41fc32f4e8bbd8f92b70fed3f3d Mon Sep 17 00:00:00 2001 From: Hyong Youb Kim Date: Sat, 2 Mar 2019 02:42:41 -0800 Subject: [PATCH] net/enic: fix SCTP match for flow API [ upstream commit 3a1c3cd01b8bce9203e96520f2715b7fd8d93f02 ] The driver needs to explicitly set the protocol number (132) in the IP header pattern, as the current firmware filter API lacks "match SCTP packet" flag. Otherwise, the resulting NIC filter may lead to false positives (i.e. NIC reporting non-SCTP packets as SCTP packets). The flow director handler does the same (enic_clsf.c). Fixes: 6ced137607d0 ("net/enic: flow API for NICs with advanced filters enabled") Signed-off-by: Hyong Youb Kim Reviewed-by: John Daley --- drivers/net/enic/enic_flow.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c index 407b36e226..2eb68c985d 100644 --- a/drivers/net/enic/enic_flow.c +++ b/drivers/net/enic/enic_flow.c @@ -99,7 +99,6 @@ static enic_copy_item_fn enic_copy_item_ipv6_v2; static enic_copy_item_fn enic_copy_item_udp_v2; static enic_copy_item_fn enic_copy_item_tcp_v2; static enic_copy_item_fn enic_copy_item_sctp_v2; -static enic_copy_item_fn enic_copy_item_sctp_v2; static enic_copy_item_fn enic_copy_item_vxlan_v2; static copy_action_fn enic_copy_action_v1; static copy_action_fn enic_copy_action_v2; @@ -266,7 +265,7 @@ static const struct enic_items enic_items_v3[] = { }, [RTE_FLOW_ITEM_TYPE_SCTP] = { .copy_item = enic_copy_item_sctp_v2, - .valid_start_item = 1, + .valid_start_item = 0, .prev_items = (const enum rte_flow_item_type[]) { RTE_FLOW_ITEM_TYPE_IPV4, RTE_FLOW_ITEM_TYPE_IPV6, @@ -818,12 +817,37 @@ enic_copy_item_sctp_v2(const struct rte_flow_item *item, const struct rte_flow_item_sctp *spec = item->spec; const struct rte_flow_item_sctp *mask = item->mask; struct filter_generic_1 *gp = &enic_filter->u.generic_1; + uint8_t *ip_proto_mask = NULL; + uint8_t *ip_proto = NULL; FLOW_TRACE(); if (*inner_ofst) return ENOTSUP; + /* + * The NIC filter API has no flags for "match sctp", so explicitly set + * the protocol number in the IP pattern. + */ + if (gp->val_flags & FILTER_GENERIC_1_IPV4) { + struct ipv4_hdr *ip; + ip = (struct ipv4_hdr *)gp->layer[FILTER_GENERIC_1_L3].mask; + ip_proto_mask = &ip->next_proto_id; + ip = (struct ipv4_hdr *)gp->layer[FILTER_GENERIC_1_L3].val; + ip_proto = &ip->next_proto_id; + } else if (gp->val_flags & FILTER_GENERIC_1_IPV6) { + struct ipv6_hdr *ip; + ip = (struct ipv6_hdr *)gp->layer[FILTER_GENERIC_1_L3].mask; + ip_proto_mask = &ip->proto; + ip = (struct ipv6_hdr *)gp->layer[FILTER_GENERIC_1_L3].val; + ip_proto = &ip->proto; + } else { + /* Need IPv4/IPv6 pattern first */ + return EINVAL; + } + *ip_proto = IPPROTO_SCTP; + *ip_proto_mask = 0xff; + /* Match all if no spec */ if (!spec) return 0; -- 2.21.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2019-07-22 17:55:07.747159019 -0700 +++ 0023-net-enic-fix-SCTP-match-for-flow-API.patch 2019-07-22 17:55:05.884469000 -0700 @@ -1,8 +1,10 @@ -From 3a1c3cd01b8bce9203e96520f2715b7fd8d93f02 Mon Sep 17 00:00:00 2001 +From b1ed5dea5fa3b41fc32f4e8bbd8f92b70fed3f3d Mon Sep 17 00:00:00 2001 From: Hyong Youb Kim Date: Sat, 2 Mar 2019 02:42:41 -0800 Subject: [PATCH] net/enic: fix SCTP match for flow API +[ upstream commit 3a1c3cd01b8bce9203e96520f2715b7fd8d93f02 ] + The driver needs to explicitly set the protocol number (132) in the IP header pattern, as the current firmware filter API lacks "match SCTP packet" flag. Otherwise, the resulting NIC filter may lead to false @@ -10,7 +12,6 @@ flow director handler does the same (enic_clsf.c). Fixes: 6ced137607d0 ("net/enic: flow API for NICs with advanced filters enabled") -Cc: stable@dpdk.org Signed-off-by: Hyong Youb Kim Reviewed-by: John Daley @@ -19,10 +20,10 @@ 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c -index bb9ed037a5..55d8d50a11 100644 +index 407b36e226..2eb68c985d 100644 --- a/drivers/net/enic/enic_flow.c +++ b/drivers/net/enic/enic_flow.c -@@ -70,7 +70,6 @@ static enic_copy_item_fn enic_copy_item_ipv6_v2; +@@ -99,7 +99,6 @@ static enic_copy_item_fn enic_copy_item_ipv6_v2; static enic_copy_item_fn enic_copy_item_udp_v2; static enic_copy_item_fn enic_copy_item_tcp_v2; static enic_copy_item_fn enic_copy_item_sctp_v2; @@ -30,7 +31,7 @@ static enic_copy_item_fn enic_copy_item_vxlan_v2; static copy_action_fn enic_copy_action_v1; static copy_action_fn enic_copy_action_v2; -@@ -237,7 +236,7 @@ static const struct enic_items enic_items_v3[] = { +@@ -266,7 +265,7 @@ static const struct enic_items enic_items_v3[] = { }, [RTE_FLOW_ITEM_TYPE_SCTP] = { .copy_item = enic_copy_item_sctp_v2, @@ -39,7 +40,7 @@ .prev_items = (const enum rte_flow_item_type[]) { RTE_FLOW_ITEM_TYPE_IPV4, RTE_FLOW_ITEM_TYPE_IPV6, -@@ -819,12 +818,37 @@ enic_copy_item_sctp_v2(const struct rte_flow_item *item, +@@ -818,12 +817,37 @@ enic_copy_item_sctp_v2(const struct rte_flow_item *item, const struct rte_flow_item_sctp *spec = item->spec; const struct rte_flow_item_sctp *mask = item->mask; struct filter_generic_1 *gp = &enic_filter->u.generic_1;