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

luca.boccassi at gmail.com luca.boccassi at gmail.com
Mon Jul 26 15:53:18 CEST 2021


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 <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 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 at 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


More information about the stable mailing list