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 359FBA0096 for ; Wed, 10 Apr 2019 18:45:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 28EBC1B144; Wed, 10 Apr 2019 18:45:56 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 22FE91B163 for ; Wed, 10 Apr 2019 18:45:55 +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 8757F308427D; Wed, 10 Apr 2019 16:45:54 +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 78B625D961; Wed, 10 Apr 2019 16:45:53 +0000 (UTC) From: Kevin Traynor To: Hyong Youb Kim Cc: John Daley , dpdk stable Date: Wed, 10 Apr 2019 17:44:01 +0100 Message-Id: <20190410164411.10546-53-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.40]); Wed, 10 Apr 2019 16:45:54 +0000 (UTC) Subject: [dpdk-stable] patch 'net/enic: fix flow director SCTP matching' 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 525f72852cd2aa4f8e582bf4fb2ac2c2d69b22b6 Mon Sep 17 00:00:00 2001 From: Hyong Youb Kim Date: Sat, 2 Mar 2019 02:42:40 -0800 Subject: [PATCH] net/enic: fix flow director SCTP matching [ upstream commit 4182ee7f0239563916b1f730d5a58f534769ee5e ] The firmware filter API does not have flags indicating "match SCTP packet". Instead, the driver needs to explicitly add an IP match and set the protocol number (132 for SCTP) in the IP header. The existing code (copy_fltr_v2) has two bugs. 1. It sets the protocol number (132) in the match value, but not the mask. The mask remains 0, so the match becomes a wildcard match. The NIC ends up matching all protocol numbers (i.e. thinks non-SCTP packets are SCTP). 2. It modifies the input argument (rte_eth_fdir_input). The driver tracks filters using rte_hash_{add,del}_key(input). So, addding (RTE_ETH_FILTER_ADD) and deleting (RTE_ETH_FILTER_DELETE) must use the same input argument for the same filter. But, overwriting the protocol number while adding the filter breaks this assumption, and causes delete operation to fail. So, set the mask as well as protocol value. Do not modify the input argument, and use const in function signatures to make the intention clear. Also move a couple function declarations to enic_clsf.c from enic.h as they are strictly local. Fixes: dfbd6a9cb504 ("net/enic: extend flow director support for 1300 series") Signed-off-by: Hyong Youb Kim Reviewed-by: John Daley --- drivers/net/enic/enic.h | 8 ++------ drivers/net/enic/enic_clsf.c | 38 ++++++++++++++++++++++++------------ 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h index 7bca3cad2..e57f90985 100644 --- a/drivers/net/enic/enic.h +++ b/drivers/net/enic/enic.h @@ -79,6 +79,6 @@ struct enic_fdir { u32 types_mask; void (*copy_fltr_fn)(struct filter_v2 *filt, - struct rte_eth_fdir_input *input, - struct rte_eth_fdir_masks *masks); + const struct rte_eth_fdir_input *input, + const struct rte_eth_fdir_masks *masks); }; @@ -341,8 +341,4 @@ bool enic_use_vector_rx_handler(struct enic *enic); void enic_fdir_info(struct enic *enic); void enic_fdir_info_get(struct enic *enic, struct rte_eth_fdir_info *stats); -void copy_fltr_v1(struct filter_v2 *fltr, struct rte_eth_fdir_input *input, - struct rte_eth_fdir_masks *masks); -void copy_fltr_v2(struct filter_v2 *fltr, struct rte_eth_fdir_input *input, - struct rte_eth_fdir_masks *masks); extern const struct rte_flow_ops enic_flow_ops; #endif /* _ENIC_H_ */ diff --git a/drivers/net/enic/enic_clsf.c b/drivers/net/enic/enic_clsf.c index 9e9e548c2..48c8e6264 100644 --- a/drivers/net/enic/enic_clsf.c +++ b/drivers/net/enic/enic_clsf.c @@ -37,4 +37,11 @@ #define ENICPMD_CLSF_HASH_ENTRIES ENICPMD_FDIR_MAX +static void copy_fltr_v1(struct filter_v2 *fltr, + const struct rte_eth_fdir_input *input, + const struct rte_eth_fdir_masks *masks); +static void copy_fltr_v2(struct filter_v2 *fltr, + const struct rte_eth_fdir_input *input, + const struct rte_eth_fdir_masks *masks); + void enic_fdir_stats_get(struct enic *enic, struct rte_eth_fdir_stats *stats) { @@ -80,7 +87,7 @@ enic_set_layer(struct filter_generic_1 *gp, unsigned int flag, * without advanced filter support. */ -void -copy_fltr_v1(struct filter_v2 *fltr, struct rte_eth_fdir_input *input, - __rte_unused struct rte_eth_fdir_masks *masks) +static void +copy_fltr_v1(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, + __rte_unused const struct rte_eth_fdir_masks *masks) { fltr->type = FILTER_IPV4_5TUPLE; @@ -105,7 +112,7 @@ copy_fltr_v1(struct filter_v2 *fltr, struct rte_eth_fdir_input *input, * filter support. */ -void -copy_fltr_v2(struct filter_v2 *fltr, struct rte_eth_fdir_input *input, - struct rte_eth_fdir_masks *masks) +static void +copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, + const struct rte_eth_fdir_masks *masks) { struct filter_generic_1 *gp = &fltr->u.generic_1; @@ -164,7 +171,9 @@ copy_fltr_v2(struct filter_v2 *fltr, struct rte_eth_fdir_input *input, } - /* v4 proto should be 132, override ip4_flow.proto */ - input->flow.ip4_flow.proto = 132; - + /* + * Unlike UDP/TCP (FILTER_GENERIC_1_{UDP,TCP}), the firmware + * has no "packet is SCTP" flag. Use flag=0 (generic L4) and + * manually set proto_id=sctp below. + */ enic_set_layer(gp, 0, FILTER_GENERIC_1_L4, &sctp_mask, &sctp_val, sizeof(struct sctp_hdr)); @@ -190,4 +199,8 @@ copy_fltr_v2(struct filter_v2 *fltr, struct rte_eth_fdir_input *input, ip4_mask.next_proto_id = masks->ipv4_mask.proto; ip4_val.next_proto_id = input->flow.ip4_flow.proto; + } else if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_SCTP) { + /* Explicitly match the SCTP protocol number */ + ip4_mask.next_proto_id = 0xff; + ip4_val.next_proto_id = IPPROTO_SCTP; } if (input->flow.ip4_flow.src_ip) { @@ -252,7 +265,4 @@ copy_fltr_v2(struct filter_v2 *fltr, struct rte_eth_fdir_input *input, } - /* v4 proto should be 132, override ipv6_flow.proto */ - input->flow.ipv6_flow.proto = 132; - enic_set_layer(gp, 0, FILTER_GENERIC_1_L4, &sctp_mask, &sctp_val, sizeof(struct sctp_hdr)); @@ -270,4 +280,8 @@ copy_fltr_v2(struct filter_v2 *fltr, struct rte_eth_fdir_input *input, ipv6_mask.proto = masks->ipv6_mask.proto; ipv6_val.proto = input->flow.ipv6_flow.proto; + } else if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_SCTP) { + /* See comments for IPv4 SCTP above. */ + ipv6_mask.proto = 0xff; + ipv6_val.proto = IPPROTO_SCTP; } memcpy(ipv6_mask.src_addr, masks->ipv6_mask.src_ip, -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2019-04-10 14:06:11.944925628 +0100 +++ 0053-net-enic-fix-flow-director-SCTP-matching.patch 2019-04-10 14:06:08.004291038 +0100 @@ -1,8 +1,10 @@ -From 4182ee7f0239563916b1f730d5a58f534769ee5e Mon Sep 17 00:00:00 2001 +From 525f72852cd2aa4f8e582bf4fb2ac2c2d69b22b6 Mon Sep 17 00:00:00 2001 From: Hyong Youb Kim Date: Sat, 2 Mar 2019 02:42:40 -0800 Subject: [PATCH] net/enic: fix flow director SCTP matching +[ upstream commit 4182ee7f0239563916b1f730d5a58f534769ee5e ] + The firmware filter API does not have flags indicating "match SCTP packet". Instead, the driver needs to explicitly add an IP match and set the protocol number (132 for SCTP) in the IP header. @@ -27,7 +29,6 @@ enic.h as they are strictly local. Fixes: dfbd6a9cb504 ("net/enic: extend flow director support for 1300 series") -Cc: stable@dpdk.org Signed-off-by: Hyong Youb Kim Reviewed-by: John Daley @@ -37,10 +38,10 @@ 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h -index 6c497e9a2..fa4d5590e 100644 +index 7bca3cad2..e57f90985 100644 --- a/drivers/net/enic/enic.h +++ b/drivers/net/enic/enic.h -@@ -77,6 +77,6 @@ struct enic_fdir { +@@ -79,6 +79,6 @@ struct enic_fdir { u32 types_mask; void (*copy_fltr_fn)(struct filter_v2 *filt, - struct rte_eth_fdir_input *input, @@ -49,7 +50,7 @@ + const struct rte_eth_fdir_masks *masks); }; -@@ -343,8 +343,4 @@ bool enic_use_vector_rx_handler(struct enic *enic); +@@ -341,8 +341,4 @@ bool enic_use_vector_rx_handler(struct enic *enic); void enic_fdir_info(struct enic *enic); void enic_fdir_info_get(struct enic *enic, struct rte_eth_fdir_info *stats); -void copy_fltr_v1(struct filter_v2 *fltr, struct rte_eth_fdir_input *input,