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 86DF7A0547 for ; Tue, 9 Feb 2021 11:36:28 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8150E16070A; Tue, 9 Feb 2021 11:36:28 +0100 (CET) Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) by mails.dpdk.org (Postfix) with ESMTP id A5CEE160705 for ; Tue, 9 Feb 2021 11:36:26 +0100 (CET) Received: by mail-wr1-f46.google.com with SMTP id q7so20928545wre.13 for ; Tue, 09 Feb 2021 02:36:26 -0800 (PST) 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=a5Ry0PakBI4bUSxRF5v0boX86aMy3V2i14XRNxUeIEk=; b=TPQpnb1Nmei5l7ciaEAU9KRTUbSmSm9aZx2Pd9S4g8RDY33NDFtZhwQm6Biv0YAzqC 3r+RJwmOzpEXgdXok9inZF3Cswl/nnVD5SoszDuED4RSD4f/gHx11Ynmo332YnK1VB3c TH8p9k3gsl0mmnt/U6SdQBosjEb/ftYSnlvjxN/qqLQeLsxIMFdeLbW3IhMnH7Lpuh6m Djk9aR17D6j9LrBd8Qdz0G95Gsr0dakuWO1dHXMZdPwXiVjc4wXCCNIqlmgBn/Kk3R1h sRKp++3t/PchmspkaGYipNHTxycZnVHauF9llC8yDkfUbT26Remo0D12LL6WwOMVxAro cS5g== 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=a5Ry0PakBI4bUSxRF5v0boX86aMy3V2i14XRNxUeIEk=; b=idel1kIYRSpWimnzFeU34hxeXiC5Kd7TKRJKMQ7tghxYwsVamOZ3tAX9IKBjzwMMZM tUrhtcyRSetu7Mao4cEHFCgaXipBH1YGgMtMcwrcUeylBZisNC0i6mK88PSrAUlKwPzF sSQh8uXM0gtLcpSNz7rKW9mjjwJSoWkjrmoQ8X675zkoa5VFY3b1FuIlU/Q7CAlCPWMR 6/hIyagH6NMxTaAIyWJVb7ClKYQUNLE+v9Yxl8RsVsfxmRp+zbgW3uQeMwbkyI8GWwBR tqfeXTG91un4SmD7fweTvVE+OwJCUVVN4bxBU0RpPEN1IOix1nhdZGeM5XCibMlZ9wG8 RubA== X-Gm-Message-State: AOAM530J67+UpjfMk3qHbab4Kj9JKuzSZjEeHkWJgq53m9SGgGJN9PB2 zJdYRwsJZWUBensBNe6OPqA= X-Google-Smtp-Source: ABdhPJzHLjQwxVavuHJxaVqib5LBxq1SDb/V5FvalpqcurtuuFmSLmuQRhlbD+ifxnA5mt4HTqkhMg== X-Received: by 2002:adf:a59a:: with SMTP id g26mr17485074wrc.271.1612866986471; Tue, 09 Feb 2021 02:36:26 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id a132sm4106692wmf.42.2021.02.09.02.36.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Feb 2021 02:36:25 -0800 (PST) From: luca.boccassi@gmail.com To: Chengwen Feng Cc: Lijun Ou , dpdk stable Date: Tue, 9 Feb 2021 10:35:16 +0000 Message-Id: <20210209103529.466775-18-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210209103529.466775-1-luca.boccassi@gmail.com> References: <20210205111920.1272063-1-luca.boccassi@gmail.com> <20210209103529.466775-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/hns3: fix flow director rule residue on malloc failure' has been queued to stable release 20.11.1 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 Sender: "stable" Hi, FYI, your patch has been queued to stable release 20.11.1 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/11/21. 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/ffb6a48b68564c01ba98333d4fabf4107e937019 Thanks. Luca Boccassi --- >From ffb6a48b68564c01ba98333d4fabf4107e937019 Mon Sep 17 00:00:00 2001 From: Chengwen Feng Date: Wed, 3 Feb 2021 20:23:54 +0800 Subject: [PATCH] net/hns3: fix flow director rule residue on malloc failure [ upstream commit 2b9a66e1b606d3813d72dd81c626949e09706e27 ] After FD rule config success, driver will malloc fdir_rule to hold the rule info, if malloc fail the FD rule in hardware was not cleanup. Fixes: fcba820d9b9e ("net/hns3: support flow director") Signed-off-by: Chengwen Feng Signed-off-by: Lijun Ou --- drivers/net/hns3/hns3_flow.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c index d1bf9832a9..8e4519a425 100644 --- a/drivers/net/hns3/hns3_flow.c +++ b/drivers/net/hns3/hns3_flow.c @@ -1822,17 +1822,18 @@ hns3_flow_create(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, flow->counter_id = fdir_rule.act_cnt.id; } + + fdir_rule_ptr = rte_zmalloc("hns3 fdir rule", + sizeof(struct hns3_fdir_rule_ele), + 0); + if (fdir_rule_ptr == NULL) { + hns3_err(hw, "failed to allocate fdir_rule memory."); + ret = -ENOMEM; + goto err_fdir; + } + ret = hns3_fdir_filter_program(hns, &fdir_rule, false); if (!ret) { - fdir_rule_ptr = rte_zmalloc("hns3 fdir rule", - sizeof(struct hns3_fdir_rule_ele), - 0); - if (fdir_rule_ptr == NULL) { - hns3_err(hw, "Failed to allocate fdir_rule memory"); - ret = -ENOMEM; - goto err_fdir; - } - memcpy(&fdir_rule_ptr->fdir_conf, &fdir_rule, sizeof(struct hns3_fdir_rule)); TAILQ_INSERT_TAIL(&process_list->fdir_list, @@ -1843,10 +1844,10 @@ hns3_flow_create(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, return flow; } + rte_free(fdir_rule_ptr); err_fdir: if (fdir_rule.flags & HNS3_RULE_FLAG_COUNTER) hns3_counter_release(dev, fdir_rule.act_cnt.id); - err: rte_flow_error_set(error, -ret, RTE_FLOW_ERROR_TYPE_HANDLE, NULL, "Failed to create flow"); -- 2.29.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-02-09 10:34:58.654756438 +0000 +++ 0018-net-hns3-fix-flow-director-rule-residue-on-malloc-fa.patch 2021-02-09 10:34:57.910584004 +0000 @@ -1 +1 @@ -From 2b9a66e1b606d3813d72dd81c626949e09706e27 Mon Sep 17 00:00:00 2001 +From ffb6a48b68564c01ba98333d4fabf4107e937019 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 2b9a66e1b606d3813d72dd81c626949e09706e27 ] + @@ -10 +11,0 @@ -Cc: stable@dpdk.org @@ -19 +20 @@ -index c484114b32..a016857aa5 100644 +index d1bf9832a9..8e4519a425 100644 @@ -22 +23 @@ -@@ -1806,17 +1806,18 @@ hns3_flow_create(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, +@@ -1822,17 +1822,18 @@ hns3_flow_create(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, @@ -50 +51 @@ -@@ -1827,10 +1828,10 @@ hns3_flow_create(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, +@@ -1843,10 +1844,10 @@ hns3_flow_create(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,