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 68ECEA0C47 for ; Tue, 10 Aug 2021 17:45:02 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5FE1F4014F; Tue, 10 Aug 2021 17:45:02 +0200 (CEST) Received: from smtp-relay-canonical-0.canonical.com (smtp-relay-canonical-0.canonical.com [185.125.188.120]) by mails.dpdk.org (Postfix) with ESMTP id 4EA5F411C6 for ; Tue, 10 Aug 2021 17:45:00 +0200 (CEST) Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.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-canonical-0.canonical.com (Postfix) with ESMTPS id CCDDB3F0FD for ; Tue, 10 Aug 2021 15:44:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1628610299; bh=ORyzlqr8S5LYQ5rLc/MM7vE9DoE3q9Rooo8nOOQtgDs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=EP/RXklFu3Lle+Q/2sehc3nKWVSKFKlOKPt6H2v3XEf44XOq3hjQn20Z65Myq2LZ6 W+Rid79EWrkU5N+IHF4/z5A81AuTZ4BJuJ9ZrAA7b3VdPRt+BngBvfTIW2XzsU6h7R n8YL5rvYhco5pCrN3BpzEUnEpzcqEvg1nr5x/z5piFIix6l2ocSQhN9Q1H8QCFjDBS w5JJyIbZA2RVsVsC52mVQLF+D9bb04d7ZgWP93vOAfooAENQP4BhS2104WSP3MiNwX BC6WTNCTygG/K/MBrnsF3tejNX33+3jmiQzR5EHk29/WfUYLHolOXuSa70JeqcEo9E sTggR0qPpq4Jg== Received: by mail-ej1-f71.google.com with SMTP id nb40-20020a1709071ca8b02905992266c319so5706047ejc.21 for ; Tue, 10 Aug 2021 08:44:59 -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=ORyzlqr8S5LYQ5rLc/MM7vE9DoE3q9Rooo8nOOQtgDs=; b=NxMx2NTNu//DuPOoSsA3/2fW8UY3VwQJqdAOYhVitFSyJHZnFxupuw6iHYRX6XbEdB 89rRDrTs2brToLF8e3bTqi/u266ouk1cR3XSpmSh0FPwVJkCvaCWH9W8OY0qIvEknmhy sS/nGB4VL8tAw3DaarMBta3N5SbY1DHIK/koWOUBbhakP3L9Fk3SbIfncQUY1b8voihF /AJR6bVc+mFJieIy2AysC2vxpDnTgLGgChBPljM2BZCN+n0VwaLQPztApbwM3n+1Xw0B 4MwPyEOgdQSYP6GHytyssDbh3KnMvvWe5yIIAhRzvGhIhHrBJpGiiGGRX1LWbdstEBQS Hgug== X-Gm-Message-State: AOAM5326pTDOQ7Vh/Vb1TriIQ1ceZ+2GcgBwOqsgWQj5roF3gD2O5GJK kieke5/cUTrL3uP12vfpG/YlRAL36pmZ8uZSDzUBJ3ZswBs0OlG4FIrMlNtBAEHCHLfP9sNfkw+ vGgoEsPR34a2frVw4kjZR9ExB X-Received: by 2002:a05:6402:1cb2:: with SMTP id cz18mr5527885edb.339.1628610299558; Tue, 10 Aug 2021 08:44:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvghnUQmVIyEwiG0lzHWhO6kWmMhsUDYblf2LOo8uNGYCl89pV1/AzQBKiToHs3bMlnCtehg== X-Received: by 2002:a05:6402:1cb2:: with SMTP id cz18mr5527868edb.339.1628610299374; Tue, 10 Aug 2021 08:44:59 -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.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Aug 2021 08:44:58 -0700 (PDT) From: christian.ehrhardt@canonical.com To: Ivan Ilchenko Cc: Andrew Rybchenko , Andy Moreton , dpdk stable Date: Tue, 10 Aug 2021 17:40:09 +0200 Message-Id: <20210810154022.749358-89-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 MAC stats update for stopped device' 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/dcfe651cffd573cac59103b948e498edb8ae9ecc Thanks. Christian Ehrhardt --- >From dcfe651cffd573cac59103b948e498edb8ae9ecc Mon Sep 17 00:00:00 2001 From: Ivan Ilchenko Date: Fri, 23 Jul 2021 16:15:11 +0300 Subject: [PATCH] net/sfc: fix MAC stats update for stopped device [ upstream commit 1827b073ed47fbc8efedebecd61686a137e4433b ] Return the latest stats snapshot in stopped state instead of returning an error. Fixes: 1caab2f1e68 ("net/sfc: add basic statistics") Signed-off-by: Ivan Ilchenko Signed-off-by: Andrew Rybchenko Reviewed-by: Andy Moreton --- drivers/net/sfc/sfc.h | 2 +- drivers/net/sfc/sfc_ethdev.c | 6 +++--- drivers/net/sfc/sfc_port.c | 11 +++++++---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h index e12b4f56f2..4c0320c6a8 100644 --- a/drivers/net/sfc/sfc.h +++ b/drivers/net/sfc/sfc.h @@ -405,7 +405,7 @@ int sfc_port_start(struct sfc_adapter *sa); void sfc_port_stop(struct sfc_adapter *sa); void sfc_port_link_mode_to_info(efx_link_mode_t link_mode, struct rte_eth_link *link_info); -int sfc_port_update_mac_stats(struct sfc_adapter *sa); +int sfc_port_update_mac_stats(struct sfc_adapter *sa, boolean_t manual_update); int sfc_port_reset_mac_stats(struct sfc_adapter *sa); int sfc_set_rx_mode(struct sfc_adapter *sa); diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index c008a93af0..5b2a72ebf3 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -598,7 +598,7 @@ sfc_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) sfc_adapter_lock(sa); - ret = sfc_port_update_mac_stats(sa); + ret = sfc_port_update_mac_stats(sa, B_FALSE); if (ret != 0) goto unlock; @@ -716,7 +716,7 @@ sfc_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, sfc_adapter_lock(sa); - rc = sfc_port_update_mac_stats(sa); + rc = sfc_port_update_mac_stats(sa, B_FALSE); if (rc != 0) { SFC_ASSERT(rc > 0); nstats = -rc; @@ -780,7 +780,7 @@ sfc_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids, sfc_adapter_lock(sa); - rc = sfc_port_update_mac_stats(sa); + rc = sfc_port_update_mac_stats(sa, B_FALSE); if (rc != 0) { SFC_ASSERT(rc > 0); ret = -rc; diff --git a/drivers/net/sfc/sfc_port.c b/drivers/net/sfc/sfc_port.c index ee59766208..7fd1f777ac 100644 --- a/drivers/net/sfc/sfc_port.c +++ b/drivers/net/sfc/sfc_port.c @@ -25,7 +25,8 @@ /** * Update MAC statistics in the buffer. * - * @param sa Adapter + * @param sa Adapter + * @param force_upload Flag to upload MAC stats in any case * * @return Status code * @retval 0 Success @@ -33,7 +34,7 @@ * @retval ENOMEM Memory allocation failure */ int -sfc_port_update_mac_stats(struct sfc_adapter *sa) +sfc_port_update_mac_stats(struct sfc_adapter *sa, boolean_t force_upload) { struct sfc_port *port = &sa->port; efsys_mem_t *esmp = &port->mac_stats_dma_mem; @@ -45,14 +46,14 @@ sfc_port_update_mac_stats(struct sfc_adapter *sa) SFC_ASSERT(sfc_adapter_is_locked(sa)); if (sa->state != SFC_ADAPTER_STARTED) - return EINVAL; + return 0; /* * If periodic statistics DMA'ing is off or if not supported, * make a manual request and keep an eye on timer if need be */ if (!port->mac_stats_periodic_dma_supported || - (port->mac_stats_update_period_ms == 0)) { + (port->mac_stats_update_period_ms == 0) || force_upload) { if (port->mac_stats_update_period_ms != 0) { uint64_t timestamp = sfc_get_system_msecs(); @@ -366,6 +367,8 @@ sfc_port_stop(struct sfc_adapter *sa) (void)efx_mac_stats_periodic(sa->nic, &sa->port.mac_stats_dma_mem, 0, B_FALSE); + sfc_port_update_mac_stats(sa, B_TRUE); + efx_port_fini(sa->nic); efx_filter_fini(sa->nic); -- 2.32.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-08-10 15:11:16.447793519 +0200 +++ 0089-net-sfc-fix-MAC-stats-update-for-stopped-device.patch 2021-08-10 15:11:13.106638735 +0200 @@ -1 +1 @@ -From 1827b073ed47fbc8efedebecd61686a137e4433b Mon Sep 17 00:00:00 2001 +From dcfe651cffd573cac59103b948e498edb8ae9ecc Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 1827b073ed47fbc8efedebecd61686a137e4433b ] + @@ -10 +11,0 @@ -Cc: stable@dpdk.org @@ -22 +23 @@ -index 972d32606d..1594f934ba 100644 +index e12b4f56f2..4c0320c6a8 100644 @@ -25 +26 @@ -@@ -422,7 +422,7 @@ int sfc_port_start(struct sfc_adapter *sa); +@@ -405,7 +405,7 @@ int sfc_port_start(struct sfc_adapter *sa); @@ -33 +34 @@ - int sfc_set_rx_mode_unchecked(struct sfc_adapter *sa); + @@ -35 +36 @@ -index ae9304f90f..bbc22723f6 100644 +index c008a93af0..5b2a72ebf3 100644 @@ -38 +39 @@ -@@ -615,7 +615,7 @@ sfc_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) +@@ -598,7 +598,7 @@ sfc_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) @@ -47 +48 @@ -@@ -733,7 +733,7 @@ sfc_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, +@@ -716,7 +716,7 @@ sfc_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, @@ -56 +57 @@ -@@ -797,7 +797,7 @@ sfc_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids, +@@ -780,7 +780,7 @@ sfc_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids, @@ -66 +67 @@ -index bb9e01d96b..8c432c15f5 100644 +index ee59766208..7fd1f777ac 100644 @@ -69 +70 @@ -@@ -26,7 +26,8 @@ +@@ -25,7 +25,8 @@ @@ -79 +80 @@ -@@ -34,7 +35,7 @@ +@@ -33,7 +34,7 @@ @@ -88 +89 @@ -@@ -46,14 +47,14 @@ sfc_port_update_mac_stats(struct sfc_adapter *sa) +@@ -45,14 +46,14 @@ sfc_port_update_mac_stats(struct sfc_adapter *sa) @@ -105 +106 @@ -@@ -367,6 +368,8 @@ sfc_port_stop(struct sfc_adapter *sa) +@@ -366,6 +367,8 @@ sfc_port_stop(struct sfc_adapter *sa)