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 B4695A0C47 for ; Mon, 26 Jul 2021 15:56:08 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A92A840F35; Mon, 26 Jul 2021 15:56:08 +0200 (CEST) Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) by mails.dpdk.org (Postfix) with ESMTP id 4E41040DDA for ; Mon, 26 Jul 2021 15:56:07 +0200 (CEST) Received: by mail-wm1-f51.google.com with SMTP id k4so5390443wms.3 for ; Mon, 26 Jul 2021 06:56:07 -0700 (PDT) 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=RvPw6N3YnY/aSsGQ2y4X9yrCQk7QgZRu8slWFTIYIcg=; b=HqvDAgdG/xyrbV8jtI3G32y0KPJjSdS9H8p8/KeAJZT0nbEm1wc2dOoeoohQLJuFNj wQBt9QF+piLlv7JhoJYyteXzHvwKNg24ZHmeN9vgls7APFsl9CIjxO8SViesLJxGKWxg RWG8fWbkwteXGB6ZNfp3m5HL/1zgWKKmS43RbiaXVUivk9BQni+xNeYmH29uowcIJDnQ zM8HkZIDzkZ5EaFZUM68juaWogBbOALjUjt1AHPZ9GTcBagExo0Z3OvfLqcLbVjiuH26 ZKelC8R8A8VstC9LZdK/I+wMy2+kQLXMUU5otfpYjnMjZ2w1kEMaiPV1a8E2CYYmiyVl i8Zg== 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=RvPw6N3YnY/aSsGQ2y4X9yrCQk7QgZRu8slWFTIYIcg=; b=SIIe46hGSOFQ/GeqLFAkllR2758jxJND6GRak207uiDLNJ5O/JzDn0/45Ls3uPPHex LaqedDmAZA5FxbCkLwSUE5nB/FFO1iIwZeEfyiO50lryhC43IQs/i0O+EuaFDDPDUKVC jLsp1/HQJ4YE7O/kXuLfv6k14c+Ttzgcck0itkNmngrGUCP/82DuYd03o2e59upSioQ+ iAkr+JQHwaU/iIWc9gODTVLnuhEKAG5OwLPUfz+AiNCd4BpatKGZAeSqIpQn0HHzZTyt axUehZGP2RcW28PJLF+A6mouz5dFtwJdmmX+MUdMJzn8Qmz6WFpuMsdTYC71wPglRjoF 9MgQ== X-Gm-Message-State: AOAM531z2cQW4RT3zbMzNG/zobhkFvA99RFgTRRWth4BM3WKfLPnuevB hcKni+yQ2cCSeVEAFg2sWrc= X-Google-Smtp-Source: ABdhPJz9PxbjMmEcJeEAAJ1g/lGyWMqf6lAMKy3Sdxl0QoDU88C0ycqNzPDmY5AmXYaRdJtvgGM0Pw== X-Received: by 2002:a1c:7ed8:: with SMTP id z207mr27756wmc.167.1627307767126; Mon, 26 Jul 2021 06:56:07 -0700 (PDT) Received: from localhost ([137.220.125.106]) by smtp.gmail.com with ESMTPSA id q7sm36181470wmq.33.2021.07.26.06.56.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jul 2021 06:56:06 -0700 (PDT) From: luca.boccassi@gmail.com To: Ivan Ilchenko Cc: Andrew Rybchenko , Andy Moreton , dpdk stable Date: Mon, 26 Jul 2021 14:53:16 +0100 Message-Id: <20210726135322.149850-53-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210726135322.149850-1-luca.boccassi@gmail.com> References: <20210712130551.2462159-1-luca.boccassi@gmail.com> <20210726135322.149850-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/sfc: fix xstats query by ID according to ethdev' has been queued to stable release 20.11.3 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.3 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/28/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/e4ebfdeb0d05d303408e555ad27297203c58532d Thanks. Luca Boccassi --- >From e4ebfdeb0d05d303408e555ad27297203c58532d Mon Sep 17 00:00:00 2001 From: Ivan Ilchenko Date: Fri, 23 Jul 2021 16:15:09 +0300 Subject: [PATCH] net/sfc: fix xstats query by ID according to ethdev [ upstream commit 8232cc2d35ab9d07a729971b6c7596189775bc8f ] Fix xstats by ID callbacks according to ethdev usage. Handle combinations of input arguments that are required by ethdev and sanity check and reject other combinations on callback entry. Fixes: 73280c1e4ff ("net/sfc: support xstats retrieval by ID") Signed-off-by: Ivan Ilchenko Signed-off-by: Andrew Rybchenko Reviewed-by: Andy Moreton --- drivers/net/sfc/sfc_ethdev.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 41dc0bf05d..e5c30e6d3f 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -785,13 +785,10 @@ sfc_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids, int ret; int rc; - sfc_adapter_lock(sa); + if (unlikely(ids == NULL || values == NULL)) + return -EINVAL; - if (unlikely(values == NULL) || - unlikely(ids == NULL && n < port->mac_stats_nb_supported)) { - ret = port->mac_stats_nb_supported; - goto unlock; - } + sfc_adapter_lock(sa); rc = sfc_port_update_mac_stats(sa); if (rc != 0) { @@ -806,7 +803,7 @@ sfc_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids, if (!EFX_MAC_STAT_SUPPORTED(port->mac_stats_mask, i)) continue; - if ((ids == NULL) || (ids[nb_written] == nb_supported)) + if (ids[nb_written] == nb_supported) values[nb_written++] = mac_stats[i]; ++nb_supported; @@ -831,10 +828,13 @@ sfc_xstats_get_names_by_id(struct rte_eth_dev *dev, unsigned int nb_written = 0; unsigned int i; + if (unlikely(xstats_names == NULL && ids != NULL) || + unlikely(xstats_names != NULL && ids == NULL)) + return -EINVAL; + sfc_adapter_lock(sa); - if (unlikely(xstats_names == NULL) || - unlikely((ids == NULL) && (size < port->mac_stats_nb_supported))) { + if (unlikely(xstats_names == NULL && ids == NULL)) { nb_supported = port->mac_stats_nb_supported; sfc_adapter_unlock(sa); return nb_supported; @@ -844,7 +844,7 @@ sfc_xstats_get_names_by_id(struct rte_eth_dev *dev, if (!EFX_MAC_STAT_SUPPORTED(port->mac_stats_mask, i)) continue; - if ((ids == NULL) || (ids[nb_written] == nb_supported)) { + if (ids[nb_written] == nb_supported) { char *name = xstats_names[nb_written++].name; strlcpy(name, efx_mac_stat_name(sa->nic, i), -- 2.30.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-07-26 13:53:18.988046127 +0100 +++ 0053-net-sfc-fix-xstats-query-by-ID-according-to-ethdev.patch 2021-07-26 13:53:15.957294893 +0100 @@ -1 +1 @@ -From 8232cc2d35ab9d07a729971b6c7596189775bc8f Mon Sep 17 00:00:00 2001 +From e4ebfdeb0d05d303408e555ad27297203c58532d Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 8232cc2d35ab9d07a729971b6c7596189775bc8f ] + @@ -11 +12,0 @@ -Cc: stable@dpdk.org @@ -21 +22 @@ -index d5417e5e65..fca3f524a1 100644 +index 41dc0bf05d..e5c30e6d3f 100644 @@ -24 +25 @@ -@@ -794,13 +794,10 @@ sfc_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids, +@@ -785,13 +785,10 @@ sfc_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids, @@ -41 +42 @@ -@@ -815,7 +812,7 @@ sfc_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids, +@@ -806,7 +803,7 @@ sfc_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids, @@ -50 +51 @@ -@@ -840,10 +837,13 @@ sfc_xstats_get_names_by_id(struct rte_eth_dev *dev, +@@ -831,10 +828,13 @@ sfc_xstats_get_names_by_id(struct rte_eth_dev *dev, @@ -66 +67 @@ -@@ -853,7 +853,7 @@ sfc_xstats_get_names_by_id(struct rte_eth_dev *dev, +@@ -844,7 +844,7 @@ sfc_xstats_get_names_by_id(struct rte_eth_dev *dev,