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 14AA5A0540 for ; Thu, 7 Jul 2022 09:57:22 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0CF2A406B4; Thu, 7 Jul 2022 09:57:22 +0200 (CEST) Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by mails.dpdk.org (Postfix) with ESMTP id 08E95406B4 for ; Thu, 7 Jul 2022 09:57:21 +0200 (CEST) Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id A583B40027 for ; Thu, 7 Jul 2022 07:57:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1657180638; bh=8KY+OEseT/X/Ed+WnjfdklsxbEPdzD61DotYjU4Jbps=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=DWza57Lv/6TNWzqraH7Z6i4vyvCj78vSYdcDp8aDBq5CzWR6muznaYkFb42tU2SAS mEAX5LUEcIceHKL+IXnet1o5wefkdegI1brYZ35kEckYsg/9ixOkPUMUd+OcOfNZ7d 1WqmT6wj/HflkmViXPo0HPIr/9iIfK82CBBlBgHB/PRjrnfklnFp+JySO0K6xradyF njI6Cz6RS/hrjhFHA2Cd46kCO+mIKPg93POppTs/fsDNr577kBQ9rtf8v7WEC5hFXk 2uUEm1RNXRkL7JpOrjrA3mjh3Y9okAKRth1A01jx5zIn94LafcC8VWSvJ8zLbuP3d7 ViJbqC0nRX9mg== Received: by mail-ed1-f71.google.com with SMTP id x8-20020a056402414800b0042d8498f50aso13537291eda.23 for ; Thu, 07 Jul 2022 00:57:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8KY+OEseT/X/Ed+WnjfdklsxbEPdzD61DotYjU4Jbps=; b=xXkLKoljWa3nnE6XFd50TYUbieO5obPwkPRsBk5vMnPypP1RuvPeL1haJeHik5h0Au m4GrYi1KlWMavstM4kwmBDNcN7PUkLeQdXZrCQ7l5annCAnMoeFSRh7kmj9hY+osw4nS 6mBa4dJcD454zBnycSwU7HgeQMaosw9Ks+FajQ+iOvtUrXYfp/wriWOkFSnLMI+fy4Ud 8177SRtZSARitcUVdREKmrG+zRjnvUXkOuS8eI+u1744C9G7A3Pigp1Hfh6pNYgbBO5T 7Qu/IHEhwqtAvZ9KEUwi/5n2lADVGCVUU6VhhvriObjBYAQdISLbQGq/ekiT4XgNmSh5 3qWg== X-Gm-Message-State: AJIora/7UPVs7Mpl2bkz84EN0gJGUzZaAhjDuEIL0ChdW/5LZHnqtPuX 33xvUMO5HGBqUU06Dpbrp4tLrnwmFDnITA6bPb6Lr1lUgEtLTX1wCw1+ADLEaATFjlZv6k9GxFc 23t6BgKHLwGqyBS+Y519kd5CP X-Received: by 2002:a17:907:868b:b0:72a:b8af:aa49 with SMTP id qa11-20020a170907868b00b0072ab8afaa49mr22671536ejc.69.1657180638405; Thu, 07 Jul 2022 00:57:18 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u1UJgDwYI7Z8i2aQDwWE5adlYgUR4JG1HiLgL98vj4R7JDEyZSmi1bz477fUsQR+X9b+986Q== X-Received: by 2002:a17:907:868b:b0:72a:b8af:aa49 with SMTP id qa11-20020a170907868b00b0072ab8afaa49mr22671521ejc.69.1657180638210; Thu, 07 Jul 2022 00:57:18 -0700 (PDT) Received: from Keschdeichel.fritz.box ([2a02:6d40:3a4f:7b00:c19b:938e:7c97:afe2]) by smtp.gmail.com with ESMTPSA id 18-20020a170906329200b0072abb95eaa4sm6194548ejw.215.2022.07.07.00.57.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jul 2022 00:57:17 -0700 (PDT) From: christian.ehrhardt@canonical.com To: Chengwen Feng Cc: =?UTF-8?q?Morten=20Br=C3=B8rup?= , Andrew Rybchenko , dpdk stable Subject: patch 'net/mvpp2: fix xstats get return if xstats is null' has been queued to stable release 19.11.13 Date: Thu, 7 Jul 2022 09:54:32 +0200 Message-Id: <20220707075522.194223-37-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220707075522.194223-1-christian.ehrhardt@canonical.com> References: <20220707075522.194223-1-christian.ehrhardt@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 19.11.13 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 07/09/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/cpaelzer/dpdk-stable-queue This queued commit can be viewed at: https://github.com/cpaelzer/dpdk-stable-queue/commit/5894d7acdc5870f3399f6b8d33213626d264adfe Thanks. Christian Ehrhardt --- >From 5894d7acdc5870f3399f6b8d33213626d264adfe Mon Sep 17 00:00:00 2001 From: Chengwen Feng Date: Fri, 13 May 2022 10:53:53 +0800 Subject: [PATCH] net/mvpp2: fix xstats get return if xstats is null MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [ upstream commit d853d24b27d6524f26a2a830c7ef678ba739cfce ] Many user (e.g. telemetry) invokes rte_eth_xstats_get(port_id, NULL, 0) to retrieve the required number of elements, but currently mvpp2 PMD returns zero when xstats is null. Remove the logic of "return zero when xstats is NULL", and add the logic of "return the required number of entries when n is lower than the required number of entries". Fixes: a77b5378cd41 ("net/mrvl: add extended statistics") Signed-off-by: Chengwen Feng Acked-by: Morten Brørup Reviewed-by: Andrew Rybchenko --- drivers/net/mvpp2/mrvl_ethdev.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c index 7571e16343..3e12b4b119 100644 --- a/drivers/net/mvpp2/mrvl_ethdev.c +++ b/drivers/net/mvpp2/mrvl_ethdev.c @@ -1376,13 +1376,14 @@ mrvl_xstats_get(struct rte_eth_dev *dev, { struct mrvl_priv *priv = dev->data->dev_private; struct pp2_ppio_statistics ppio_stats; - unsigned int i; + unsigned int i, count; - if (!stats) - return 0; + count = RTE_DIM(mrvl_xstats_tbl); + if (n < count) + return count; pp2_ppio_get_statistics(priv->ppio, &ppio_stats, 0); - for (i = 0; i < n && i < RTE_DIM(mrvl_xstats_tbl); i++) { + for (i = 0; i < count; i++) { uint64_t val; if (mrvl_xstats_tbl[i].size == sizeof(uint32_t)) @@ -1398,7 +1399,7 @@ mrvl_xstats_get(struct rte_eth_dev *dev, stats[i].value = val; } - return n; + return count; } /** -- 2.37.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-07-07 09:54:12.771625402 +0200 +++ 0037-net-mvpp2-fix-xstats-get-return-if-xstats-is-null.patch 2022-07-07 09:54:10.877824074 +0200 @@ -1 +1 @@ -From d853d24b27d6524f26a2a830c7ef678ba739cfce Mon Sep 17 00:00:00 2001 +From 5894d7acdc5870f3399f6b8d33213626d264adfe Mon Sep 17 00:00:00 2001 @@ -8,0 +9,2 @@ +[ upstream commit d853d24b27d6524f26a2a830c7ef678ba739cfce ] + @@ -18 +19,0 @@ -Cc: stable@dpdk.org @@ -28 +29 @@ -index f86701d248..735efb6cfc 100644 +index 7571e16343..3e12b4b119 100644 @@ -31 +32 @@ -@@ -1626,13 +1626,14 @@ mrvl_xstats_get(struct rte_eth_dev *dev, +@@ -1376,13 +1376,14 @@ mrvl_xstats_get(struct rte_eth_dev *dev, @@ -50 +51 @@ -@@ -1648,7 +1649,7 @@ mrvl_xstats_get(struct rte_eth_dev *dev, +@@ -1398,7 +1399,7 @@ mrvl_xstats_get(struct rte_eth_dev *dev,