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 ADEF1A04DD for ; Wed, 28 Oct 2020 11:52:46 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id F2814CA10; Wed, 28 Oct 2020 11:52:44 +0100 (CET) Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) by dpdk.org (Postfix) with ESMTP id 28B1DCA34 for ; Wed, 28 Oct 2020 11:52:44 +0100 (CET) Received: by mail-wm1-f48.google.com with SMTP id v5so4111733wmh.1 for ; Wed, 28 Oct 2020 03:52:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EYow5O3EdvtW42bMoNJBYmThUxfCsBL20UyaxbOMTAs=; b=SgH7J1HjBWhA9m02HUabFXovbW8CT1ZutpyppMLeWs8raruzDQEvHvHDoPuifVgu3Y IooAgZrBYm+OVh0o5IX3bbxA7APIUN5RLVFdrDcl4Q9zesbhEwnD8Yq6zD1gWoitAA94 VUj0D0NfId9hU5QJudGud4plYpiQKB3WX84t+a9R9bN1eYOqUfQK7zLNWl28XPMspa53 QI9urzyz8GyHhydZ+lN5jkuUbCCySXHazHJSswIczIgJGJiIpOWDrP2M9xpUUBTLnCqH lFn1UjyDM7l/Epfl7xCS8CD2I6exWA/6lyrEskh4+NizTaa4X5vhqdQNGgR2RDqf1A71 NYIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EYow5O3EdvtW42bMoNJBYmThUxfCsBL20UyaxbOMTAs=; b=L4Q6mR8olFkQjQ50m0jb45E4jnyIhbrhaQ4rMPJt2MNVpOHmdM3g8BhEv2cQ5uQL7S yS+Ub1zUkAyXfYOHtEbvYhNmY/g3V1pYazt6R982DtQtLdNstwO9KsXGWf9qu2fboNr/ 8AX5/4mc2kagAXy2gaQdZKWI6diaJdmS/vxLpB01fh4M0IXyHZDOif6D348rNHRRAv2B tQMfQeD+aQI4/iIrubZo5tcJk7Wle5VkH0woeTONMaWAGQ0o7p2jts8CQPQQ3GQJGdcx hY0DmeQXXldA0WfzN9muUj3kbXqoolraggauwaqYijbpOJKZggcAX+YCdFvO8Ruq0PSb pa3w== X-Gm-Message-State: AOAM533InqfK31CDuk1ZUX0i6G59it5IamfHNcQqvaUTSBsZ/Jjdr4Ys AdSTBSb/g6br3BeqRMyNW6J+KQOUIVHJdJaX X-Google-Smtp-Source: ABdhPJzcTRScKIR/0Vyt30E4RwOkt7JZjid+WngsYLuyiFHe/JcpgVjXnHS55Mu/5TEKLGiPA1ikBA== X-Received: by 2002:a7b:c085:: with SMTP id r5mr7274231wmh.17.1603882362911; Wed, 28 Oct 2020 03:52:42 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id y7sm5862154wmg.40.2020.10.28.03.52.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2020 03:52:42 -0700 (PDT) From: luca.boccassi@gmail.com To: Dekel Peled Cc: Xiaoyu Min , Viacheslav Ovsiienko , Ori Kam , dpdk stable Date: Wed, 28 Oct 2020 10:44:44 +0000 Message-Id: <20201028104606.3504127-125-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201028104606.3504127-1-luca.boccassi@gmail.com> References: <20201028104606.3504127-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'ethdev: fix RSS flow expansion in case of mismatch' has been queued to stable release 19.11.6 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 stable release 19.11.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 10/30/20. 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. Luca Boccassi --- >From 311ef43d620d0a907130d7856b2c991be32c71d1 Mon Sep 17 00:00:00 2001 From: Dekel Peled Date: Thu, 24 Sep 2020 17:52:13 +0300 Subject: [PATCH] ethdev: fix RSS flow expansion in case of mismatch [ upstream commit 7f6a3168edc38d4caf353ee150071c827fe01b95 ] Function rte_flow_expand_rss() is used to expand a flow rule with partial pattern into several rules, to ensure all relevant packets are matched. It uses utility function rte_flow_expand_rss_item_complete(), to check if the last valid item in the flow rule pattern needs to be completed. For example the pattern "eth / ipv4 proto is 17 / end" will be completed with a "udp" item. This function returns "void" item in two cases: 1) The last item has empty spec, for example "eth / ipv4 / end". 2) The last itme has spec that can't be expanded for RSS. For example the pattern "eth / ipv4 proto is 47 / end" ends with IPv4 item that has next protocol GRE. In both cases the flow rule may be expanded, but in the second case such expansion may create rules with invalid pattern. For example "eth / ipv4 proto is 47 / udp / end". In such a case the flow rule should not be expanded. This patch updates function rte_flow_expand_rss_item_complete(). Return value RTE_FLOW_ITEM_TYPE_END is used to indicate the flow rule should not be expanded. In such a case, rte_flow_expand_rss() will return with the original flow rule only, without any expansion. Fixes: fc2dd8dd492f ("ethdev: fix expand RSS flows") Signed-off-by: Dekel Peled Acked-by: Xiaoyu Min Acked-by: Viacheslav Ovsiienko Acked-by: Ori Kam --- lib/librte_ethdev/rte_flow.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c index 391165646a..7171c11499 100644 --- a/lib/librte_ethdev/rte_flow.c +++ b/lib/librte_ethdev/rte_flow.c @@ -241,6 +241,8 @@ rte_flow_expand_rss_item_complete(const struct rte_flow_item *item) ret = RTE_FLOW_ITEM_TYPE_IPV6; else if (rte_be_to_cpu_16(ether_type) == RTE_ETHER_TYPE_VLAN) ret = RTE_FLOW_ITEM_TYPE_VLAN; + else + ret = RTE_FLOW_ITEM_TYPE_END; break; case RTE_FLOW_ITEM_TYPE_VLAN: if (item->mask) @@ -258,6 +260,8 @@ rte_flow_expand_rss_item_complete(const struct rte_flow_item *item) ret = RTE_FLOW_ITEM_TYPE_IPV6; else if (rte_be_to_cpu_16(ether_type) == RTE_ETHER_TYPE_VLAN) ret = RTE_FLOW_ITEM_TYPE_VLAN; + else + ret = RTE_FLOW_ITEM_TYPE_END; break; case RTE_FLOW_ITEM_TYPE_IPV4: if (item->mask) @@ -278,6 +282,8 @@ rte_flow_expand_rss_item_complete(const struct rte_flow_item *item) ret = RTE_FLOW_ITEM_TYPE_IPV4; else if (ip_next_proto == IPPROTO_IPV6) ret = RTE_FLOW_ITEM_TYPE_IPV6; + else + ret = RTE_FLOW_ITEM_TYPE_END; break; case RTE_FLOW_ITEM_TYPE_IPV6: if (item->mask) @@ -298,6 +304,8 @@ rte_flow_expand_rss_item_complete(const struct rte_flow_item *item) ret = RTE_FLOW_ITEM_TYPE_IPV4; else if (ip_next_proto == IPPROTO_IPV6) ret = RTE_FLOW_ITEM_TYPE_IPV6; + else + ret = RTE_FLOW_ITEM_TYPE_END; break; default: ret = RTE_FLOW_ITEM_TYPE_VOID; @@ -1104,10 +1112,14 @@ rte_flow_expand_rss(struct rte_flow_expand_rss *buf, size_t size, memset(flow_items, 0, sizeof(flow_items)); user_pattern_size -= sizeof(*item); /* - * Check if the last valid item has spec set - * and need complete pattern. + * Check if the last valid item has spec set, need complete pattern, + * and the pattern can be used for expansion. */ missed_item.type = rte_flow_expand_rss_item_complete(last_item); + if (missed_item.type == RTE_FLOW_ITEM_TYPE_END) { + /* Item type END indicates expansion is not required. */ + return lsize; + } if (missed_item.type != RTE_FLOW_ITEM_TYPE_VOID) { next = NULL; missed = 1; -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-10-28 10:35:15.629398450 +0000 +++ 0125-ethdev-fix-RSS-flow-expansion-in-case-of-mismatch.patch 2020-10-28 10:35:11.688832733 +0000 @@ -1,8 +1,10 @@ -From 7f6a3168edc38d4caf353ee150071c827fe01b95 Mon Sep 17 00:00:00 2001 +From 311ef43d620d0a907130d7856b2c991be32c71d1 Mon Sep 17 00:00:00 2001 From: Dekel Peled Date: Thu, 24 Sep 2020 17:52:13 +0300 Subject: [PATCH] ethdev: fix RSS flow expansion in case of mismatch +[ upstream commit 7f6a3168edc38d4caf353ee150071c827fe01b95 ] + Function rte_flow_expand_rss() is used to expand a flow rule with partial pattern into several rules, to ensure all relevant packets are matched. @@ -28,7 +30,6 @@ rule only, without any expansion. Fixes: fc2dd8dd492f ("ethdev: fix expand RSS flows") -Cc: stable@dpdk.org Signed-off-by: Dekel Peled Acked-by: Xiaoyu Min @@ -39,10 +40,10 @@ 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c -index f8fdd68fe9..59a386d074 100644 +index 391165646a..7171c11499 100644 --- a/lib/librte_ethdev/rte_flow.c +++ b/lib/librte_ethdev/rte_flow.c -@@ -247,6 +247,8 @@ rte_flow_expand_rss_item_complete(const struct rte_flow_item *item) +@@ -241,6 +241,8 @@ rte_flow_expand_rss_item_complete(const struct rte_flow_item *item) ret = RTE_FLOW_ITEM_TYPE_IPV6; else if (rte_be_to_cpu_16(ether_type) == RTE_ETHER_TYPE_VLAN) ret = RTE_FLOW_ITEM_TYPE_VLAN; @@ -51,7 +52,7 @@ break; case RTE_FLOW_ITEM_TYPE_VLAN: if (item->mask) -@@ -264,6 +266,8 @@ rte_flow_expand_rss_item_complete(const struct rte_flow_item *item) +@@ -258,6 +260,8 @@ rte_flow_expand_rss_item_complete(const struct rte_flow_item *item) ret = RTE_FLOW_ITEM_TYPE_IPV6; else if (rte_be_to_cpu_16(ether_type) == RTE_ETHER_TYPE_VLAN) ret = RTE_FLOW_ITEM_TYPE_VLAN; @@ -60,7 +61,7 @@ break; case RTE_FLOW_ITEM_TYPE_IPV4: if (item->mask) -@@ -284,6 +288,8 @@ rte_flow_expand_rss_item_complete(const struct rte_flow_item *item) +@@ -278,6 +282,8 @@ rte_flow_expand_rss_item_complete(const struct rte_flow_item *item) ret = RTE_FLOW_ITEM_TYPE_IPV4; else if (ip_next_proto == IPPROTO_IPV6) ret = RTE_FLOW_ITEM_TYPE_IPV6; @@ -69,7 +70,7 @@ break; case RTE_FLOW_ITEM_TYPE_IPV6: if (item->mask) -@@ -304,6 +310,8 @@ rte_flow_expand_rss_item_complete(const struct rte_flow_item *item) +@@ -298,6 +304,8 @@ rte_flow_expand_rss_item_complete(const struct rte_flow_item *item) ret = RTE_FLOW_ITEM_TYPE_IPV4; else if (ip_next_proto == IPPROTO_IPV6) ret = RTE_FLOW_ITEM_TYPE_IPV6; @@ -78,7 +79,7 @@ break; default: ret = RTE_FLOW_ITEM_TYPE_VOID; -@@ -1110,10 +1118,14 @@ rte_flow_expand_rss(struct rte_flow_expand_rss *buf, size_t size, +@@ -1104,10 +1112,14 @@ rte_flow_expand_rss(struct rte_flow_expand_rss *buf, size_t size, memset(flow_items, 0, sizeof(flow_items)); user_pattern_size -= sizeof(*item); /*