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 827F0A04C8 for ; Wed, 2 Sep 2020 19:09:13 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5D1101C0AD; Wed, 2 Sep 2020 19:09:13 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id B9FB3137D; Wed, 2 Sep 2020 19:09:09 +0200 (CEST) IronPort-SDR: pErLR1xDEerMcpT7Z5Y/831h79by+ugkYy3Qjfte/oOVY4b0m0E2HtF+bQqtvYzje3TUwlRcUU 8UpHEFqlyauQ== X-IronPort-AV: E=McAfee;i="6000,8403,9732"; a="136955817" X-IronPort-AV: E=Sophos;i="5.76,383,1592895600"; d="scan'208";a="136955817" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Sep 2020 10:09:08 -0700 IronPort-SDR: N/PPNSYT7WNFjqEj0ohpMxQgcKfEXFlAns6vuNQrdmuDbZLwvCZvNN2yyJfzEvFXm4iYohazg3 ZPqnZRiKSUiw== X-IronPort-AV: E=Sophos;i="5.76,383,1592895600"; d="scan'208";a="477718094" Received: from fyigit-mobl.ger.corp.intel.com (HELO [10.213.213.38]) ([10.213.213.38]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Sep 2020 10:09:06 -0700 To: Dekel Peled , matan@mellanox.com, viacheslavo@mellanox.com, rasland@mellanox.com Cc: dev@dpdk.org, stable@dpdk.org, Andrew Rybchenko , Thomas Monjalon , Qi Zhang References: From: Ferruh Yigit Autocrypt: addr=ferruh.yigit@intel.com; prefer-encrypt=mutual; keydata= mQINBFXZCFABEAD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EtPG/rA1lxz8ctdFB VOQOxCvwRG2QCgcJ/UTn5vlivul+cThi6ERPvjqjblLncQtRg8izj2qgmwQkvfj+h7Ex88bI 8iWtu5+I3K3LmNz/UxHBSWEmUnkg4fJlRr7oItHsZ0ia6wWQ8lQnABEBAAGJAjwEGAEKACYC GwwWIQTSNlOHQi7ChOOZgcf5M+tD3xNhHwUCXqFrngUJCKxSYAAKCRD5M+tD3xNhH3YWD/9b cUiWaHJasX+OpiuZ1Li5GG3m9aw4lR/k2lET0UPRer2Jy1JsL+uqzdkxGvPqzFTBXgx/6Byz EMa2mt6R9BCyR286s3lxVS5Bgr5JGB3EkpPcoJT3A7QOYMV95jBiiJTy78Qdzi5LrIu4tW6H o0MWUjpjdbR01cnj6EagKrDx9kAsqQTfvz4ff5JIFyKSKEHQMaz1YGHyCWhsTwqONhs0G7V2 0taQS1bGiaWND0dIBJ/u0pU998XZhmMzn765H+/MqXsyDXwoHv1rcaX/kcZIcN3sLUVcbdxA WHXOktGTQemQfEpCNuf2jeeJlp8sHmAQmV3dLS1R49h0q7hH4qOPEIvXjQebJGs5W7s2vxbA 5u5nLujmMkkfg1XHsds0u7Zdp2n200VC4GQf8vsUp6CSMgjedHeF9zKv1W4lYXpHp576ZV7T GgsEsvveAE1xvHnpV9d7ZehPuZfYlP4qgo2iutA1c0AXZLn5LPcDBgZ+KQZTzm05RU1gkx7n gL9CdTzVrYFy7Y5R+TrE9HFUnsaXaGsJwOB/emByGPQEKrupz8CZFi9pkqPuAPwjN6Wonokv ChAewHXPUadcJmCTj78Oeg9uXR6yjpxyFjx3vdijQIYgi5TEGpeTQBymLANOYxYWYOjXk+ae dYuOYKR9nbPv+2zK9pwwQ2NXbUBystaGyQ== Message-ID: Date: Wed, 2 Sep 2020 18:09:02 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH] ethdev: fix RSS flow expansion in case of mismatch 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" On 7/27/2020 1:57 PM, Dekel Peled wrote: > 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. better to add the "actions rss types udp" part of the rule to clarify why the original rule will be completed with 'udp'. > This function returns "void" item in two cases: Can you please clarify what does function returning 'void' mean, so people won't need to dig the code to find out. > 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. OK, got the problem. > > 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. But there is only limited number of check in 'rte_flow_expand_rss_item_complete()', like for ipv4 it checks the proto udp/tcp/ip. What if other proto is part of rule, won't sending END cause the initial problem of missing pattern. I mean, for following rule, ... pattern eth / ipv4 proto is 47 / end actions rss type gre end ... With your update, rule is not expanded and the 'gre' pattern is not added, won't this cause not matching the rule for rss? I may be missing something here, or if not I am sure you can fix it, BUT I am not sure if this is right way to proceed. This expansion operation is complex, it is hard to verify it without debugging, and I can see it has been fixed a few times already. It is trying to construct the correct pattern by trying to understand the user's intention. Overall it has two problems I think, 1) It is hard to make it correct, and not sure if we can rely on the user input to create *correct* patterns. 2) Only mlx is using this function (and mlx developed and acked it), so other vendors doesn't try to expand the rules, so same rule may work different for different PMDs (assuming with same HW capabilities). Like just giving 'ip' pattern and request 'udp' rss will fail on Intel but will work on mlx because of this expansion. What about other two alternatives: a) If the rule doesn't work, return error. stop. user should fix it. Don't try to expand or fix the rule implicitly. b) If mlx is strong on having the expansion, what about moving it to the PMD. It won't cause more defects for others, cleans the common code and highlights that this behavior is unique to a vendor. Unless there are any other vendor willing to use it. Or is it part of the rte_flow contract already, @Ori, do you know if this expansion behavior documented anywhere? Thanks, ferruh > 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") > Cc: stable@dpdk.org > > Signed-off-by: Dekel Peled > Acked-by: Xiaoyu Min > Acked-by: Viacheslav Ovsiienko > --- > 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 f8fdd68..59a386d 100644 > --- a/lib/librte_ethdev/rte_flow.c > +++ b/lib/librte_ethdev/rte_flow.c > @@ -247,6 +247,8 @@ struct rte_flow_desc_data { > 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) > @@ -264,6 +266,8 @@ struct rte_flow_desc_data { > 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) > @@ -284,6 +288,8 @@ struct rte_flow_desc_data { > 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) > @@ -304,6 +310,8 @@ struct rte_flow_desc_data { > 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; > @@ -1110,10 +1118,14 @@ enum rte_flow_conv_item_spec_type { > 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; >