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 0EE58A0C47 for ; Mon, 26 Jul 2021 15:56:11 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 07C60410EF; Mon, 26 Jul 2021 15:56:11 +0200 (CEST) Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) by mails.dpdk.org (Postfix) with ESMTP id 221A6410EF for ; Mon, 26 Jul 2021 15:56:09 +0200 (CEST) Received: by mail-wr1-f41.google.com with SMTP id p5so6094652wro.7 for ; Mon, 26 Jul 2021 06:56:09 -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=ArdHyGgL2g+dCB0vQgNeJkYtOD9+aaIrBI4uuFfEy3U=; b=YcTSkGNrhSs8mNjd8EYAbjEPAmWEZ4Ya5szhPPEvMLrtlyGt0xytH1Jf9t8nGVlBgq 6rhNlikpM+52hhn74MLB2dafKqvz6xPW0UEKW4XtJiKCL5CeN087hKLrmi3Q/a+Om+7E 7ni0OWFJh6nP30V7wePJCSA091XP7mHL/bJAqnjuReg/DK64gH48/PSReYtO3rBeSB+X /OX2t5ugFZaf0l6Kwa2eh+3pXLvNA5EwX8QR4rVp5gALooXcgwtVUm3/ge/XAD0erhSQ 3FOFTN+g9YcNwhSBcLQCt3nF3VyLeBAVyRnw0mfTfz9/NoDoJ2/3YW6tGnHn4l2a3J/u rGHA== 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=ArdHyGgL2g+dCB0vQgNeJkYtOD9+aaIrBI4uuFfEy3U=; b=PfsjHFEWqu4zSNVfG+wW5aAAQ9hLn4t5l3lpmMRgJLYMYku2F+NbtnHc4GnLQHtoDM BcsLM+0XlWbXmjqz1dCv4pjbzNxA0UA+mKZo+qz2JeCIakR8l3Pbc940bOBHWdjtZBAW 2NKzlkkkQG8fEn+Mnvg3LnMq/9PtkGxSmLg+KJAvaL+yH9MV51xX1u+7rMlUfC7EfvZM HPz5TN7C4K8NbgkQ6zYKQ2MKdHcGAC9oWzboX/o078rGUO4GJGOTvUbEyu+CApHv7sf9 zRI9/76Y2QNtCsVjgEJU4UL7nNOtC8BY2x+dhJ+Wi0/B6rN1v2YEuUv2NgF9GWgCJ93b 3lSQ== X-Gm-Message-State: AOAM533Wu6pmDzeiX+Cljhmij81AR5Yp7BX98cB6hzep0XOAk+F9asyU uhZ0yOks56PN9fmG5OSOp1k= X-Google-Smtp-Source: ABdhPJzy6zZS3TxOhGOouv8j0GwcrkoELIal4IlqnIWXVg5x0em0cVCrLnptigczar2t/5qvXOWlFA== X-Received: by 2002:a05:6000:2a9:: with SMTP id l9mr19318191wry.75.1627307768946; Mon, 26 Jul 2021 06:56:08 -0700 (PDT) Received: from localhost ([137.220.125.106]) by smtp.gmail.com with ESMTPSA id b15sm50042199wrr.27.2021.07.26.06.56.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jul 2021 06:56:08 -0700 (PDT) From: luca.boccassi@gmail.com To: Ivan Ilchenko Cc: Andrew Rybchenko , Andy Moreton , dpdk stable Date: Mon, 26 Jul 2021 14:53:18 +0100 Message-Id: <20210726135322.149850-55-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 MAC stats update for stopped device' 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/0cd4f7ee81a9abab110aeef15703c6d7c6560244 Thanks. Luca Boccassi --- >From 0cd4f7ee81a9abab110aeef15703c6d7c6560244 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 6192ac89f8..9db465862b 100644 --- a/drivers/net/sfc/sfc.h +++ b/drivers/net/sfc/sfc.h @@ -399,7 +399,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); int sfc_set_rx_mode_unchecked(struct sfc_adapter *sa); diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 59f61b09a8..e6de2c30f7 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -606,7 +606,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; @@ -724,7 +724,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; @@ -788,7 +788,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 817b412e29..fc66430809 100644 --- a/drivers/net/sfc/sfc_port.c +++ b/drivers/net/sfc/sfc_port.c @@ -26,7 +26,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 @@ -34,7 +35,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; @@ -46,14 +47,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(); @@ -367,6 +368,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.30.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-07-26 13:53:19.133876630 +0100 +++ 0055-net-sfc-fix-MAC-stats-update-for-stopped-device.patch 2021-07-26 13:53:15.965295061 +0100 @@ -1 +1 @@ -From 1827b073ed47fbc8efedebecd61686a137e4433b Mon Sep 17 00:00:00 2001 +From 0cd4f7ee81a9abab110aeef15703c6d7c6560244 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 6192ac89f8..9db465862b 100644 @@ -25 +26 @@ -@@ -422,7 +422,7 @@ int sfc_port_start(struct sfc_adapter *sa); +@@ -399,7 +399,7 @@ int sfc_port_start(struct sfc_adapter *sa); @@ -35 +36 @@ -index ae9304f90f..bbc22723f6 100644 +index 59f61b09a8..e6de2c30f7 100644 @@ -38 +39 @@ -@@ -615,7 +615,7 @@ sfc_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) +@@ -606,7 +606,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, +@@ -724,7 +724,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, +@@ -788,7 +788,7 @@ sfc_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids, @@ -66 +67 @@ -index bb9e01d96b..8c432c15f5 100644 +index 817b412e29..fc66430809 100644