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 0D355A0C47 for ; Tue, 10 Aug 2021 17:44:59 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 02F674014F; Tue, 10 Aug 2021 17:44:59 +0200 (CEST) Received: from smtp-relay-canonical-1.canonical.com (smtp-relay-canonical-1.canonical.com [185.125.188.121]) by mails.dpdk.org (Postfix) with ESMTP id B51054014F for ; Tue, 10 Aug 2021 17:44:57 +0200 (CEST) Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (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-canonical-1.canonical.com (Postfix) with ESMTPS id 9E04B3F107 for ; Tue, 10 Aug 2021 15:44:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1628610297; bh=Qkn3VB/7sUF6DN9vp/kKS+FVNATuMobo5pgXvv6H3iQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Kl4IlsStvukMmThsI6dVeCbBZxthg6xIcjGa2H9TVeVhnu9zi1fDtTfjNmCX3nAY9 tZs7Uh7Q/sTazzIRPGV21iisBQ5GN37DqF2yuOwy/qZ130XB2g3j2gxHlDi8n7frf7 ltmEGwdsBmobYKL8ptouCHdQaq3ekCNM0a1wyxwBPQ6HX8Gb6uM8wqj7BL+Lhjyib9 vFbGCH6mMSlGaa5Rq0q1RuxLI1lRpti+ftKlhd1keje2ezT23G1FvufvQqPj/YvQj2 pCKUaAFULvK4Nziit/44hP1hfQepSlWINH7sPr6iOLGh7OF1TocaxBgJ1WA9aJIpuz 7O/y1ogxcT4vw== Received: by mail-ed1-f72.google.com with SMTP id cm18-20020a0564020c92b02903bc7f21d540so10948922edb.13 for ; Tue, 10 Aug 2021 08:44:57 -0700 (PDT) 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=Qkn3VB/7sUF6DN9vp/kKS+FVNATuMobo5pgXvv6H3iQ=; b=MdftlUojXkyW1MxacncO5EZPihRSJzpG21o1kybv7zqgwscRHgHCTf9uCUeWjSmTzj anz7noIN6VX/1ptY2rCgsLPPXTkY/mcssGuLV1KbAh8bwRXcUR875ZS0FG8zrJ9SfHOu p7kuQCt9wjNDfUP3iDBUfijoTeXgOJhQyUn4sBka6Q1A8UzGLSVXF+2Kqvq16QCEPh9s jS4kIHsHp9JbTOmgrQImFsn4e+uHvTtHUZtELTCRGZhcle+OIPhUcz1MU8pKsu99uT9r erqFH4dhO6c5/BRFqDHd8+8hZC0vJc9BsmeJ1D3grVtAaBhUVkj1wyjiFMBqFNnCO0b0 grFA== X-Gm-Message-State: AOAM530d1Y0SDoJFp+HHAkPrUgWMr7/Wl1CK9CvuRJpaiG50Vrq4qVaU z58UQE8HzJQGognRX3wwcx3/7u56C6btAX13fW+P+wJLmquBdOeOnn/LEU6htIcWoCuklNINaNf gbxoBc/kO4Ha0KM/1hluwlW8e X-Received: by 2002:a05:6402:95c:: with SMTP id h28mr5868778edz.199.1628610297171; Tue, 10 Aug 2021 08:44:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0k9PSCfGxFsDgpkXEm5zMiFLeDmfExvF8pQd8An9r1RfdTYx5RVKg0bfwa07V+26op4yjWw== X-Received: by 2002:a05:6402:95c:: with SMTP id h28mr5868761edz.199.1628610296998; Tue, 10 Aug 2021 08:44:56 -0700 (PDT) Received: from Keschdeichel.fritz.box ([2001:67c:1560:8007::aac:c4ad]) by smtp.gmail.com with ESMTPSA id s24sm1712089edq.56.2021.08.10.08.44.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Aug 2021 08:44:56 -0700 (PDT) From: christian.ehrhardt@canonical.com To: Ivan Ilchenko Cc: Andrew Rybchenko , Andy Moreton , dpdk stable Date: Tue, 10 Aug 2021 17:40:07 +0200 Message-Id: <20210810154022.749358-87-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210810154022.749358-1-christian.ehrhardt@canonical.com> References: <20210810154022.749358-1-christian.ehrhardt@canonical.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 19.11.10 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.10 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 08/12/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/a31460e290504bbb8ec62ef76281044eac9a715b Thanks. Christian Ehrhardt --- >From a31460e290504bbb8ec62ef76281044eac9a715b 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 93c7ee6322..7317c30a71 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -777,13 +777,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) { @@ -798,7 +795,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; @@ -823,10 +820,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; @@ -836,7 +836,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.32.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-08-10 15:11:16.368105036 +0200 +++ 0087-net-sfc-fix-xstats-query-by-ID-according-to-ethdev.patch 2021-08-10 15:11:13.102638705 +0200 @@ -1 +1 @@ -From 8232cc2d35ab9d07a729971b6c7596189775bc8f Mon Sep 17 00:00:00 2001 +From a31460e290504bbb8ec62ef76281044eac9a715b 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 93c7ee6322..7317c30a71 100644 @@ -24 +25 @@ -@@ -794,13 +794,10 @@ sfc_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids, +@@ -777,13 +777,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, +@@ -798,7 +795,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, +@@ -823,10 +820,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, +@@ -836,7 +836,7 @@ sfc_xstats_get_names_by_id(struct rte_eth_dev *dev,