From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9971241D4F for ; Thu, 23 Feb 2023 10:39:47 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 944CC43150; Thu, 23 Feb 2023 10:39:47 +0100 (CET) Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) by mails.dpdk.org (Postfix) with ESMTP id F1C07427E9 for ; Thu, 23 Feb 2023 10:39:45 +0100 (CET) Received: by mail-wr1-f44.google.com with SMTP id i11so3971256wrp.5 for ; Thu, 23 Feb 2023 01:39:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Z5RDsh/h/7f8eQSUEu4KHx+NhQ66BGOkbtRY2ps2UhI=; b=jmEv7O4V4L1nVULdgE6VhGHoNc7HRRjBDj76sKKYRw52mN3v0/cEtk0b0oYLoWz7wx +xZ9A5pTYRZcH1I3MVCgmyQkKuIEno3YO7ZZzxa++xYpc6ug8i7G5uPVOujgJeXzY/6p H+dsVr8VgJZDPfzEwVRV27y/MBaZLFX3CyvKPle50vUK9Qj1VgW76tM0pGbLJJ7Wn+5Y b0SXykCcy80/oPw3zyZCwvdm7r1Shtp4PPauS3HfFnZHrbEwHFVaKx9wZLFpPHZ3kI36 3zjUmROXu0VcrNJXs0UkLWeGJEvUGRkCVVvnnNiBR1cpXfYAH/vKbgIU7df0/XSU+16i NlLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z5RDsh/h/7f8eQSUEu4KHx+NhQ66BGOkbtRY2ps2UhI=; b=ubnasIs+9ibR/AY5n398Rb6u6JMDKdqq68JLi3ny66YIp8H+BYngi9ViCwFOwv8qkq u3BBm0a1DhP0j2SEtj4wm1WATZIhb4hCaMylNqFkIWGa3Pdam178vt68kW3skcbYJTEN bqKq469u8vLR2p1DtafPsD0sG1GZ9kDixfrn8dDkMY1K9JJHz9AcodC9+XxQwrNk8KlK yqJ+sfHqneQZnUHZan5/23U79czuZgn4PdGlxy0qu1sw7jsnS4QY5tcTY1wHurl/UlDc garuAZY024dfVpN5ccMAsIB3nIpoIv6kTRz+mwNCs6EZJYiCRLJ/4xoUMJHUCI8pVPRX uFCA== X-Gm-Message-State: AO0yUKV2S9/jSR+cHHR5PDSHU2PX581y0Joq6Vr3unue6cSgrIXciSkZ v0CvNiaxqBtWVpddhwzGqbeEv97rQfQVvg== X-Google-Smtp-Source: AK7set9XykSAxqyogAoD9rGLeg/BqqjYM5vF9iFkDda8Eff4hwFjMEgAnI9Un6Gw+EaXEixjkReDjQ== X-Received: by 2002:a5d:65c5:0:b0:2c5:5a65:799f with SMTP id e5-20020a5d65c5000000b002c55a65799fmr10158061wrw.34.1677145185643; Thu, 23 Feb 2023 01:39:45 -0800 (PST) Received: from localhost ([2a01:4b00:d307:1000:f1d3:eb5e:11f4:a7d9]) by smtp.gmail.com with ESMTPSA id v15-20020adfedcf000000b002c70ce264bfsm3451058wro.76.2023.02.23.01.39.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Feb 2023 01:39:45 -0800 (PST) From: luca.boccassi@gmail.com To: Huisong Li Cc: Dongdong Liu , dpdk stable Subject: patch 'net/hns3: fix duplicate RSS rule check' has been queued to stable release 20.11.8 Date: Thu, 23 Feb 2023 09:36:51 +0000 Message-Id: <20230223093715.3926893-47-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230223093715.3926893-1-luca.boccassi@gmail.com> References: <20230223093715.3926893-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 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 Hi, FYI, your patch has been queued to stable release 20.11.8 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/25/23. 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. Queued patches are on a temporary branch at: https://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/52655240fdacc2d41cdd820da291509bceb411f1 Thanks. Luca Boccassi --- >From 52655240fdacc2d41cdd820da291509bceb411f1 Mon Sep 17 00:00:00 2001 From: Huisong Li Date: Tue, 31 Jan 2023 21:03:00 +0800 Subject: [PATCH] net/hns3: fix duplicate RSS rule check [ upstream commit 150fd8f839e332d68aa7b60646c2033084544cb7 ] Currently, the interface for verifying duplicate RSS rules has some problems: 1) If the value of 'func' in configuring RSS rule is default value, this rule is mistakenly considered as a duplicate rule. 2) If key length is zero or 'key' is NULL in configuring RSS rule this rule is also mistakenly considered as a duplicate rule. 3) If 'key' or 'queue' in struct rte_flow_action_rss being NULL is used to memcpy, which may cause segment fault. Fixes: c37ca66f2b27 ("net/hns3: support RSS") Signed-off-by: Huisong Li Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_flow.c | 63 +++++++++++++++++++++++++++--------- 1 file changed, 47 insertions(+), 16 deletions(-) diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c index a0d292db00..400054a9a2 100644 --- a/drivers/net/hns3/hns3_flow.c +++ b/drivers/net/hns3/hns3_flow.c @@ -1251,28 +1251,59 @@ hns3_filterlist_flush(struct rte_eth_dev *dev) } } +static bool +hns3_flow_rule_key_same(const struct rte_flow_action_rss *comp, + const struct rte_flow_action_rss *with) +{ + if (comp->key_len != with->key_len) + return false; + + if (with->key_len == 0) + return true; + + if (comp->key == NULL && with->key == NULL) + return true; + + if (!(comp->key != NULL && with->key != NULL)) + return false; + + return !memcmp(comp->key, with->key, with->key_len); +} + +static bool +hns3_flow_rule_queues_same(const struct rte_flow_action_rss *comp, + const struct rte_flow_action_rss *with) +{ + if (comp->queue_num != with->queue_num) + return false; + + if (with->queue_num == 0) + return true; + + if (comp->queue == NULL && with->queue == NULL) + return true; + + if (!(comp->queue != NULL && with->queue != NULL)) + return false; + + return !memcmp(comp->queue, with->queue, with->queue_num); +} + static bool hns3_action_rss_same(const struct rte_flow_action_rss *comp, const struct rte_flow_action_rss *with) { - bool rss_key_is_same; - bool func_is_same; + bool same_level; + bool same_types; + bool same_func; - func_is_same = (with->func != RTE_ETH_HASH_FUNCTION_DEFAULT) ? - (comp->func == with->func) : true; + same_level = (comp->level == with->level); + same_types = (comp->types == with->types); + same_func = (comp->func == with->func); - if (with->key_len == 0 || with->key == NULL) - rss_key_is_same = 1; - else - rss_key_is_same = comp->key_len == with->key_len && - !memcmp(comp->key, with->key, with->key_len); - - return (func_is_same && rss_key_is_same && - comp->types == with->types && - comp->level == with->level && - comp->queue_num == with->queue_num && - !memcmp(comp->queue, with->queue, - sizeof(*with->queue) * with->queue_num)); + return same_level && same_types && same_func && + hns3_flow_rule_key_same(comp, with) && + hns3_flow_rule_queues_same(comp, with); } /* -- 2.39.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2023-02-23 09:36:30.104099588 +0000 +++ 0047-net-hns3-fix-duplicate-RSS-rule-check.patch 2023-02-23 09:36:28.278170898 +0000 @@ -1 +1 @@ -From 150fd8f839e332d68aa7b60646c2033084544cb7 Mon Sep 17 00:00:00 2001 +From 52655240fdacc2d41cdd820da291509bceb411f1 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 150fd8f839e332d68aa7b60646c2033084544cb7 ] + @@ -16 +17,0 @@ -Cc: stable@dpdk.org @@ -25 +26 @@ -index dd762c02cb..881d70613c 100644 +index a0d292db00..400054a9a2 100644 @@ -28 +29 @@ -@@ -1272,28 +1272,59 @@ hns3_filterlist_flush(struct rte_eth_dev *dev) +@@ -1251,28 +1251,59 @@ hns3_filterlist_flush(struct rte_eth_dev *dev) @@ -103 +104 @@ - static bool + /*