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 551DFA00C2 for ; Thu, 3 Nov 2022 10:32:27 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5075941181; Thu, 3 Nov 2022 10:32:27 +0100 (CET) Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) by mails.dpdk.org (Postfix) with ESMTP id 08F914069B for ; Thu, 3 Nov 2022 10:32:26 +0100 (CET) Received: by mail-wr1-f43.google.com with SMTP id bk15so1678652wrb.13 for ; Thu, 03 Nov 2022 02:32:26 -0700 (PDT) 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=gmoLflZLq89LMPWOTvD1VQY7N0WeRv4/Yd9PR1gbvY4=; b=P9Z4dStXXkR2RA+CD/g9PaTqX4LAvhevthIsdgc5LzgD5EJvBfiFoKEmOWzhIe3pZI q7LCTQgNX3EvB1UvVtjCW95OERrsDa7WItDhDqkGKVAWW8/FeSWkWrkDfAugxjpo1LJl f6wKZp6EnHbNeKLPZDauDyqKobWLyyuL2Ad3fJZR85F7iFbnY4zORpFhnX3aZBw9JefD 6fehFsFk0w6OvqnbkQmpbt0qC2pJ6V9NswRKCVCBA2yR07cCqblQGCyHK4V//AYgkVEa KG/HwC0eJstSCDm2NII/FX/Tb1LMn1IvKBZatyZaWw+nfJua/2oTTZPyHxMZoMk+ly80 g6Dw== 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=gmoLflZLq89LMPWOTvD1VQY7N0WeRv4/Yd9PR1gbvY4=; b=5jyw+M4yuyg+JINpN5lNDf5YwdXrQ7F3/MaDuIxIsUineHPXFvCf7L1Z24FS4cFFnL aLf03Z5N4WjmYcV8r443poxIGv3wJPfJN52j1HBjp8UHy0Xs4WMyp24KJU+8PcLkgggn lHdFoVNyhKnr1AYv77iJdgr91AEt+AGPz+I79a3Z2f/93sfq8hlPO5AYST9FjLqdAS+C Y9JuGIlpnsu0UGYvOmMWgySo7CgluERt7Hfp2wY9aDcZ6eGxDm8JST4v6xY0xa4bMkq5 yKqUOEcZV+BRaaq+pvEyDsyaNLsI3LPcDFOuvyxRQ451GWILfeIM3SEs+zrasMsLWkkt B7nA== X-Gm-Message-State: ACrzQf1h+1aZXfJHah3CJuVyBp9cXpzMzkmjUzD0Ny+gGOxnIZqElgl+ d5TuVKZOukxMaPCvcn90IXZZu6yTWyOcFUxC X-Google-Smtp-Source: AMsMyM5loC04XxveUNfc8hDVHWHUyJdPz64QpnuHBrzHaYNNLCk12ElCKX5hNIho7j9c8TgPVEBVsQ== X-Received: by 2002:a5d:5186:0:b0:236:79a2:af1 with SMTP id k6-20020a5d5186000000b0023679a20af1mr18080821wrv.648.1667467945689; Thu, 03 Nov 2022 02:32:25 -0700 (PDT) Received: from localhost ([137.220.119.58]) by smtp.gmail.com with ESMTPSA id i2-20020a05600c354200b003a5f3f5883dsm5080244wmq.17.2022.11.03.02.32.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Nov 2022 02:32:25 -0700 (PDT) From: luca.boccassi@gmail.com To: Huisong Li Cc: Dongdong Liu , dpdk stable Subject: patch 'net/hns3: fix lock protection of RSS flow rule' has been queued to stable release 20.11.7 Date: Thu, 3 Nov 2022 09:27:36 +0000 Message-Id: <20221103092758.1099402-78-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221103092758.1099402-1-luca.boccassi@gmail.com> References: <20221103092758.1099402-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.7 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/05/22. 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/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/3b9e0dd592b126d3939ef636ae7277e0d5f7f352 Thanks. Luca Boccassi --- >From 3b9e0dd592b126d3939ef636ae7277e0d5f7f352 Mon Sep 17 00:00:00 2001 From: Huisong Li Date: Fri, 30 Sep 2022 15:22:04 +0800 Subject: [PATCH] net/hns3: fix lock protection of RSS flow rule [ upstream commit a35799625e6849151f7d7bae312e300f8d5c2675 ] RSS flow rules are saved in RSS filter linked list. The linked list is modified by rte_flow API and is used to restore RSS rules during reset process. So this patch uses 'hw->flows_lock' to protect the configuration and recovery of RSS rule. Fixes: c37ca66f2b27 ("net/hns3: support RSS") Signed-off-by: Huisong Li Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_flow.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c index d1486175cc..6cb935cf0b 100644 --- a/drivers/net/hns3/hns3_flow.c +++ b/drivers/net/hns3/hns3_flow.c @@ -1565,24 +1565,20 @@ hns3_config_rss_filter(struct rte_eth_dev *dev, hns3_warn(hw, "Config queue numbers %u are beyond the scope of truncated", rss_flow_conf.queue_num); hns3_info(hw, "Max of contiguous %u PF queues are configured", num); - - rte_spinlock_lock(&hw->lock); if (num) { ret = hns3_update_indir_table(dev, &rss_flow_conf, num); if (ret) - goto rss_config_err; + return ret; } /* Set hash algorithm and flow types by the user's config */ ret = hns3_hw_rss_hash_set(hw, &rss_flow_conf); if (ret) - goto rss_config_err; + return ret; ret = hns3_rss_conf_copy(rss_info, &rss_flow_conf); - if (ret) { + if (ret) hns3_err(hw, "RSS config init fail(%d)", ret); - goto rss_config_err; - } /* * When create a new RSS rule, the old rule will be overlaid and set @@ -1591,9 +1587,6 @@ hns3_config_rss_filter(struct rte_eth_dev *dev, TAILQ_FOREACH(rss_filter_ptr, &hw->flow_rss_list, entries) rss_filter_ptr->filter_info.valid = false; -rss_config_err: - rte_spinlock_unlock(&hw->lock); - return ret; } @@ -1638,6 +1631,7 @@ hns3_restore_rss_filter(struct rte_eth_dev *dev) struct hns3_hw *hw = &hns->hw; int ret = 0; + pthread_mutex_lock(&hw->flows_lock); TAILQ_FOREACH(filter, &hw->flow_rss_list, entries) { if (!filter->filter_info.valid) continue; @@ -1650,6 +1644,8 @@ hns3_restore_rss_filter(struct rte_eth_dev *dev) } out: + pthread_mutex_unlock(&hw->flows_lock); + return ret; } -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-11-03 09:27:30.070406727 +0000 +++ 0078-net-hns3-fix-lock-protection-of-RSS-flow-rule.patch 2022-11-03 09:27:25.517425228 +0000 @@ -1 +1 @@ -From a35799625e6849151f7d7bae312e300f8d5c2675 Mon Sep 17 00:00:00 2001 +From 3b9e0dd592b126d3939ef636ae7277e0d5f7f352 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit a35799625e6849151f7d7bae312e300f8d5c2675 ] + @@ -12 +13,0 @@ -Cc: stable@dpdk.org @@ -21 +22 @@ -index 2fb83f756a..162a48e590 100644 +index d1486175cc..6cb935cf0b 100644 @@ -24 +25 @@ -@@ -1596,27 +1596,20 @@ hns3_config_rss_filter(struct rte_eth_dev *dev, +@@ -1565,24 +1565,20 @@ hns3_config_rss_filter(struct rte_eth_dev *dev, @@ -49 +50,7 @@ -- + + /* + * When create a new RSS rule, the old rule will be overlaid and set +@@ -1591,9 +1587,6 @@ hns3_config_rss_filter(struct rte_eth_dev *dev, + TAILQ_FOREACH(rss_filter_ptr, &hw->flow_rss_list, entries) + rss_filter_ptr->filter_info.valid = false; + @@ -52 +59 @@ - +- @@ -55 +62,2 @@ -@@ -1661,6 +1654,7 @@ hns3_restore_rss_filter(struct rte_eth_dev *dev) + +@@ -1638,6 +1631,7 @@ hns3_restore_rss_filter(struct rte_eth_dev *dev) @@ -63 +71 @@ -@@ -1673,6 +1667,8 @@ hns3_restore_rss_filter(struct rte_eth_dev *dev) +@@ -1650,6 +1644,8 @@ hns3_restore_rss_filter(struct rte_eth_dev *dev)