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 1D510A0524 for ; Thu, 4 Feb 2021 12:36:26 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1850D240771; Thu, 4 Feb 2021 12:36:26 +0100 (CET) Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by mails.dpdk.org (Postfix) with ESMTP id F3380240733 for ; Thu, 4 Feb 2021 12:36:24 +0100 (CET) Received: from 2.general.paelzer.uk.vpn ([10.172.196.173] helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1l7cvw-0005U5-Qa; Thu, 04 Feb 2021 11:36:24 +0000 From: Christian Ehrhardt To: Chengchang Tang Cc: Lijun Ou , dpdk stable Date: Thu, 4 Feb 2021 12:28:49 +0100 Message-Id: <20210204112954.2488123-74-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210204112954.2488123-1-christian.ehrhardt@canonical.com> References: <20210204112954.2488123-1-christian.ehrhardt@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/hns3: fix register length when dumping registers' has been queued to stable release 19.11.7 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 19.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 02/06/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/cpaelzer/dpdk-stable-queue This queued commit can be viewed at: https://github.com/cpaelzer/dpdk-stable-queue/commit/60c02f53c38f8fdbe481542bf718072d518f2e41 Thanks. Christian Ehrhardt --- >From 60c02f53c38f8fdbe481542bf718072d518f2e41 Mon Sep 17 00:00:00 2001 From: Chengchang Tang Date: Thu, 14 Jan 2021 21:33:34 +0800 Subject: [PATCH] net/hns3: fix register length when dumping registers [ upstream commit 2d0467532b1a2c10739a89ead3bd03042486b1de ] Currently, the reg length return by HNS3 is the total length of all the registers. But for upper layer user, the total register length is the length multiplied by width. This can lead to a waste of memory and print some invalid information. This patch corrects the length and width of the register. Fixes: 936eda25e8da ("net/hns3: support dump register") Signed-off-by: Chengchang Tang Signed-off-by: Lijun Ou --- drivers/net/hns3/hns3_regs.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/net/hns3/hns3_regs.c b/drivers/net/hns3/hns3_regs.c index 63c8602a87..e424d5abc4 100644 --- a/drivers/net/hns3/hns3_regs.c +++ b/drivers/net/hns3/hns3_regs.c @@ -118,6 +118,7 @@ hns3_get_regs_length(struct hns3_hw *hw, uint32_t *length) struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); uint32_t cmdq_lines, common_lines, ring_lines, tqp_intr_lines; uint32_t regs_num_32_bit, regs_num_64_bit; + uint32_t dfx_reg_lines; uint32_t len; int ret; @@ -131,7 +132,7 @@ hns3_get_regs_length(struct hns3_hw *hw, uint32_t *length) tqp_intr_lines = sizeof(tqp_intr_reg_addrs) / REG_LEN_PER_LINE + 1; len = (cmdq_lines + common_lines + ring_lines * hw->tqps_num + - tqp_intr_lines * hw->num_msi) * REG_LEN_PER_LINE; + tqp_intr_lines * hw->num_msi) * REG_NUM_PER_LINE; if (!hns->is_vf) { ret = hns3_get_regs_num(hw, ®s_num_32_bit, ®s_num_64_bit); @@ -140,8 +141,11 @@ hns3_get_regs_length(struct hns3_hw *hw, uint32_t *length) ret); return -ENOTSUP; } - len += regs_num_32_bit * sizeof(uint32_t) + - regs_num_64_bit * sizeof(uint64_t); + dfx_reg_lines = regs_num_32_bit * sizeof(uint32_t) / + REG_LEN_PER_LINE + 1; + dfx_reg_lines += regs_num_64_bit * sizeof(uint64_t) / + REG_LEN_PER_LINE + 1; + len += dfx_reg_lines * REG_NUM_PER_LINE; } *length = len; -- 2.30.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-02-04 12:04:31.158826693 +0100 +++ 0074-net-hns3-fix-register-length-when-dumping-registers.patch 2021-02-04 12:04:28.074789772 +0100 @@ -1 +1 @@ -From 2d0467532b1a2c10739a89ead3bd03042486b1de Mon Sep 17 00:00:00 2001 +From 60c02f53c38f8fdbe481542bf718072d518f2e41 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 2d0467532b1a2c10739a89ead3bd03042486b1de ] + @@ -14 +15,0 @@ -Cc: stable@dpdk.org @@ -23 +24 @@ -index b2cc599f12..32597fe21c 100644 +index 63c8602a87..e424d5abc4 100644 @@ -26 +27 @@ -@@ -104,6 +104,7 @@ hns3_get_regs_length(struct hns3_hw *hw, uint32_t *length) +@@ -118,6 +118,7 @@ hns3_get_regs_length(struct hns3_hw *hw, uint32_t *length) @@ -34 +35 @@ -@@ -117,7 +118,7 @@ hns3_get_regs_length(struct hns3_hw *hw, uint32_t *length) +@@ -131,7 +132,7 @@ hns3_get_regs_length(struct hns3_hw *hw, uint32_t *length) @@ -43 +44 @@ -@@ -126,8 +127,11 @@ hns3_get_regs_length(struct hns3_hw *hw, uint32_t *length) +@@ -140,8 +141,11 @@ hns3_get_regs_length(struct hns3_hw *hw, uint32_t *length)