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 8E2AFA057F for ; Tue, 28 Jun 2022 17:20:08 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8976D40042; Tue, 28 Jun 2022 17:20:08 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 51DD440042 for ; Tue, 28 Jun 2022 17:20:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656429606; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fqTFcJwhtv9ID6Rgt08JsA+TPkZLu76QxjHuIhXzoD0=; b=GCp5oQ8VEjZl2H1SITykCSvTRPEwhoiLra3L80EX99m+HrwjiQK2N+MA+rnIgq5OSD9+h6 oygwpTEk+0C5ObZmRCwXRoe6QZXKZ5lVVxW58yFZUYxbdrdUh7Rn9SsuUIyu0oOPkVqm6i oYQQ+aJ6NB4gC61jgNLhsvYxYXQGkEo= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-498-YFC2hIz2OtOyJPKV7z8FzQ-1; Tue, 28 Jun 2022 11:20:05 -0400 X-MC-Unique: YFC2hIz2OtOyJPKV7z8FzQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5CF523C138A9; Tue, 28 Jun 2022 15:20:04 +0000 (UTC) Received: from rh.redhat.com (unknown [10.39.194.217]) by smtp.corp.redhat.com (Postfix) with ESMTP id 82DAA1410F3B; Tue, 28 Jun 2022 15:20:03 +0000 (UTC) From: Kevin Traynor To: Huisong Li Cc: Dongdong Liu , dpdk stable Subject: patch 'net/hns3: fix statistics locking' has been queued to stable release 21.11.2 Date: Tue, 28 Jun 2022 16:19:28 +0100 Message-Id: <20220628151938.2278711-16-ktraynor@redhat.com> In-Reply-To: <20220628151938.2278711-1-ktraynor@redhat.com> References: <20220628151938.2278711-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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 21.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 06/30/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/5a0533330861807023ce69f116251df1d573ce62 Thanks. Kevin --- >From 5a0533330861807023ce69f116251df1d573ce62 Mon Sep 17 00:00:00 2001 From: Huisong Li Date: Fri, 24 Jun 2022 16:59:48 +0800 Subject: [PATCH] net/hns3: fix statistics locking [ upstream commit 7b2966626197d210b08da4c04f09c1f9a2d71642 ] The stats_lock is used to protect statistics update in stats APIs and periodic task, but current code only protect queue related statistics. Fixes: a65342d9d5d2 ("net/hns3: fix MAC and queues HW statistics overflow") Signed-off-by: Huisong Li Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_stats.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/drivers/net/hns3/hns3_stats.c b/drivers/net/hns3/hns3_stats.c index 07fad03485..1b0464f3f7 100644 --- a/drivers/net/hns3/hns3_stats.c +++ b/drivers/net/hns3/hns3_stats.c @@ -630,4 +630,5 @@ hns3_stats_get(struct rte_eth_dev *eth_dev, struct rte_eth_stats *rte_stats) int ret; + rte_spinlock_lock(&hw->stats_lock); /* Update imissed stats */ ret = hns3_update_imissed_stats(hw, false); @@ -645,8 +646,5 @@ hns3_stats_get(struct rte_eth_dev *eth_dev, struct rte_eth_stats *rte_stats) continue; - rte_spinlock_lock(&hw->stats_lock); hns3_rcb_rx_ring_stats_get(rxq, stats); - rte_spinlock_unlock(&hw->stats_lock); - rte_stats->ierrors += rxq->err_stats.l2_errors + rxq->err_stats.pkt_len_errors; @@ -660,7 +658,5 @@ hns3_stats_get(struct rte_eth_dev *eth_dev, struct rte_eth_stats *rte_stats) continue; - rte_spinlock_lock(&hw->stats_lock); hns3_rcb_tx_ring_stats_get(txq, stats); - rte_spinlock_unlock(&hw->stats_lock); rte_stats->obytes += txq->basic_stats.bytes; } @@ -684,5 +680,8 @@ hns3_stats_get(struct rte_eth_dev *eth_dev, struct rte_eth_stats *rte_stats) rte_stats->oerrors; rte_stats->rx_nombuf = eth_dev->data->rx_mbuf_alloc_failed; + out: + rte_spinlock_unlock(&hw->stats_lock); + return ret; } @@ -698,4 +697,5 @@ hns3_stats_reset(struct rte_eth_dev *eth_dev) int ret; + rte_spinlock_lock(&hw->stats_lock); /* * Note: Reading hardware statistics of imissed registers will @@ -733,5 +733,4 @@ hns3_stats_reset(struct rte_eth_dev *eth_dev) continue; - rte_spinlock_lock(&hw->stats_lock); memset(&rxq->basic_stats, 0, sizeof(struct hns3_rx_basic_stats)); @@ -741,5 +740,4 @@ hns3_stats_reset(struct rte_eth_dev *eth_dev) rxq->err_stats.pkt_len_errors = 0; rxq->err_stats.l2_errors = 0; - rte_spinlock_unlock(&hw->stats_lock); } @@ -750,5 +748,4 @@ hns3_stats_reset(struct rte_eth_dev *eth_dev) continue; - rte_spinlock_lock(&hw->stats_lock); memset(&txq->basic_stats, 0, sizeof(struct hns3_tx_basic_stats)); @@ -756,11 +753,11 @@ hns3_stats_reset(struct rte_eth_dev *eth_dev) /* This register is read-clear */ (void)hns3_read_dev(txq, HNS3_RING_TX_PKTNUM_RECORD_REG); - rte_spinlock_unlock(&hw->stats_lock); } - rte_spinlock_lock(&hw->stats_lock); hns3_tqp_stats_clear(hw); - rte_spinlock_unlock(&hw->stats_lock); + out: + rte_spinlock_unlock(&hw->stats_lock); + return ret; } @@ -1083,9 +1080,9 @@ hns3_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, } } - rte_spinlock_unlock(&hw->stats_lock); ret = hns3_update_imissed_stats(hw, false); if (ret) { hns3_err(hw, "update imissed stats failed, ret = %d", ret); + rte_spinlock_unlock(&hw->stats_lock); return ret; } @@ -1116,5 +1113,4 @@ hns3_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, } - rte_spinlock_lock(&hw->stats_lock); hns3_tqp_dfx_stats_get(dev, xstats, &count); hns3_queue_stats_get(dev, xstats, &count); -- 2.34.3 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-06-28 16:18:04.411975567 +0100 +++ 0016-net-hns3-fix-statistics-locking.patch 2022-06-28 16:18:04.034387175 +0100 @@ -1 +1 @@ -From 7b2966626197d210b08da4c04f09c1f9a2d71642 Mon Sep 17 00:00:00 2001 +From 5a0533330861807023ce69f116251df1d573ce62 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 7b2966626197d210b08da4c04f09c1f9a2d71642 ] + @@ -10 +11,0 @@ -Cc: stable@dpdk.org @@ -19 +20 @@ -index a71356934a..4ec0911522 100644 +index 07fad03485..1b0464f3f7 100644