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 73533A0524 for ; Fri, 5 Feb 2021 12:32:12 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6D59440682; Fri, 5 Feb 2021 12:32:12 +0100 (CET) Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by mails.dpdk.org (Postfix) with ESMTP id 3B25C40682 for ; Fri, 5 Feb 2021 12:32:11 +0100 (CET) Received: by mail-wr1-f54.google.com with SMTP id p15so7268202wrq.8 for ; Fri, 05 Feb 2021 03:32:11 -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=fCu2xLvRC6gAy52sfNaA9OmUEDKcb+G6MSZXUVJeKvQ=; b=Tz4M2dawrwrAYx1oZMQP/Y8UUqypWsArFs2hkR+8LOWeUXtvl9wZbJDka9GaytKe8W 62c+Cmgj7fF3XtOXaOjYkIpZvSefSQJhddCbbGOokkiJAokzwbndo3TJgKgP+ipKMWmy doNw1qPR2+iKijCu+p/C7YgyVe6iSTVVGjfLRaJHqftVzKYzuCc3zMYlczBSY64FFngo q24u/IlHIp2uF3ekXTpx2bosutoRkOxwD1LWESIZZGhAiKtHxbndV/By6gAcarxmEeor ugw83xlPG6GNPmTUpFaE/Hi1cPohCTqRu6AEWbG8l8Sq26/CXLX3SnSVTw5FZOAkk11v dr8g== 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=fCu2xLvRC6gAy52sfNaA9OmUEDKcb+G6MSZXUVJeKvQ=; b=buDD4v7Kel5KVQmClMEl/IoxXrW2ZZAgj4J8lGdjMvbBBgARWsl3vtzGWKjfecylgD NtBoLc92fsj9nPj3RH+d7Cq36YS/YCBv890OsGK3Y8p7nRSvXurNFLVq4rthNuwtXag4 /vl4AWu8R4eCBNolZCEImsbT6eXnPECSUiy48Jv7pR/snn9NO8SAgrPk/MJ7IKKgNt4W XU78ntx1cOe+AOJqqwh4GhBwUvr5Yki9vZJmyCKXygjPaqp5WOOOlHJy8udVTN3dU/Rm TQrame9adW1FZQKm6Nw1of5GJx55kCY7hrwHh/jzUYyrlcO0Om1jpI4cQLSWNzsWM/xP jGlw== X-Gm-Message-State: AOAM530Kx57OnruTmJ7MWZRUW7TV2MZoRN2d0bO+B6ASpriNQlaiShVJ ayBpyj/WjFCHn9KCYWTXVfE= X-Google-Smtp-Source: ABdhPJyF+Knagyzuh1qjXwp2+VajzrIvUqMYovx9dPwNj61RVF/+elxw/zvP+8Z10AmQ8rTDsO8BGg== X-Received: by 2002:a5d:68c1:: with SMTP id p1mr4514232wrw.325.1612524731008; Fri, 05 Feb 2021 03:32:11 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id w12sm266663wmi.4.2021.02.05.03.32.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Feb 2021 03:32:10 -0800 (PST) From: luca.boccassi@gmail.com To: Huisong Li Cc: Lijun Ou , dpdk stable Date: Fri, 5 Feb 2021 11:16:59 +0000 Message-Id: <20210205111920.1272063-133-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210205111920.1272063-1-luca.boccassi@gmail.com> References: <20210205111920.1272063-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/hns3: fix xstats with id and names' 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/07/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/642e10664fdc74999403bc2c65c843c3f73ed4f2 Thanks. Luca Boccassi --- >From 642e10664fdc74999403bc2c65c843c3f73ed4f2 Mon Sep 17 00:00:00 2001 From: Huisong Li Date: Wed, 6 Jan 2021 11:46:28 +0800 Subject: [PATCH] net/hns3: fix xstats with id and names [ upstream commit 3213d584b698f41dbef14599a41ab0a7a78739b4 ] Currently, validity check for ids and values in the hns3_dev_xstats_get_by_id API is incorrect, which will cause a problem. Namely, if the ID range of the xstats stats item does not include the basic stats item, the app can not obtain the corresponding xstats statistics in hns3_dev_xstats_get_by_id. Similarly, the hns3_dev_xstats_get_names_by_id interface also has a problem. Although the input parameter verification code cannot be executed due to the implementation of the ethdev framework interface, the driver needs to ensure the correctness of the input parameters. Fixes: 8839c5e202f3 ("net/hns3: support device stats") Signed-off-by: Huisong Li Signed-off-by: Lijun Ou --- drivers/net/hns3/hns3_stats.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/drivers/net/hns3/hns3_stats.c b/drivers/net/hns3/hns3_stats.c index 91168ac95a..1597af3545 100644 --- a/drivers/net/hns3/hns3_stats.c +++ b/drivers/net/hns3/hns3_stats.c @@ -933,9 +933,13 @@ hns3_dev_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids, uint32_t i; int ret; - if (ids == NULL || size < cnt_stats) + if (ids == NULL && values == NULL) return cnt_stats; + if (ids == NULL) + if (size < cnt_stats) + return cnt_stats; + /* Update tqp stats by read register */ ret = hns3_update_tqp_stats(hw); if (ret) { @@ -957,6 +961,15 @@ hns3_dev_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids, return -EINVAL; } + if (ids == NULL && values != NULL) { + for (i = 0; i < cnt_stats; i++) + memcpy(&values[i], &values_copy[i].value, + sizeof(values[i])); + + rte_free(values_copy); + return cnt_stats; + } + for (i = 0; i < size; i++) { if (ids[i] >= cnt_stats) { hns3_err(hw, "ids[%u] (%" PRIx64 ") is invalid, " @@ -1005,9 +1018,16 @@ hns3_dev_xstats_get_names_by_id(struct rte_eth_dev *dev, uint64_t len; uint32_t i; - if (ids == NULL || xstats_names == NULL) + if (xstats_names == NULL) return cnt_stats; + if (ids == NULL) { + if (size < cnt_stats) + return cnt_stats; + + return hns3_dev_xstats_get_names(dev, xstats_names, cnt_stats); + } + len = cnt_stats * sizeof(struct rte_eth_xstat_name); names_copy = rte_zmalloc("hns3_xstats_names", len, 0); if (names_copy == NULL) { -- 2.29.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-02-05 11:18:35.125683847 +0000 +++ 0133-net-hns3-fix-xstats-with-id-and-names.patch 2021-02-05 11:18:29.010694996 +0000 @@ -1 +1 @@ -From 3213d584b698f41dbef14599a41ab0a7a78739b4 Mon Sep 17 00:00:00 2001 +From 642e10664fdc74999403bc2c65c843c3f73ed4f2 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 3213d584b698f41dbef14599a41ab0a7a78739b4 ] + @@ -22 +23,0 @@ -Cc: stable@dpdk.org