[dpdk-stable] patch 'net/sfc: fix MAC stats update for stopped device' has been queued to stable release 19.11.10

christian.ehrhardt at canonical.com christian.ehrhardt at canonical.com
Tue Aug 10 17:40:09 CEST 2021


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 <christian.ehrhardt at canonical.com>

---
>From dcfe651cffd573cac59103b948e498edb8ae9ecc Mon Sep 17 00:00:00 2001
From: Ivan Ilchenko <ivan.ilchenko at oktetlabs.ru>
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 <ivan.ilchenko at oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko at oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton at xilinx.com>
---
 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 at 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)


More information about the stable mailing list