DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/sfc: request MAC stats upload immediately on port start
@ 2017-07-08 15:16 Andrew Rybchenko
  2017-07-18  8:23 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Rybchenko @ 2017-07-08 15:16 UTC (permalink / raw)
  To: dev; +Cc: Ivan Malov, stable

From: Ivan Malov <ivan.malov@oktetlabs.ru>

If MAC stats refresh is arranged to be done by periodic DMA,
the first DMA transaction is unlikely to occur right on the
port start; if the user tries to get stats right after port
start and before the transaction occurs, bogus figures will
be collected; a one-off stats upload on port start is a fix

Fixes: 1caab2f1e684 ("net/sfc: add basic statistics")
Cc: stable@dpdk.org

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/sfc/sfc_port.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/net/sfc/sfc_port.c b/drivers/net/sfc/sfc_port.c
index e7eea9f..ba2284f 100644
--- a/drivers/net/sfc/sfc_port.c
+++ b/drivers/net/sfc/sfc_port.c
@@ -245,6 +245,18 @@ sfc_port_start(struct sfc_adapter *sa)
 		}
 	}
 
+	if ((port->mac_stats_update_period_ms != 0) &&
+	    port->mac_stats_periodic_dma_supported) {
+		/*
+		 * Request an explicit MAC stats upload immediately to
+		 * preclude bogus figures readback if the user decides
+		 * to read stats before periodic DMA is really started
+		 */
+		rc = efx_mac_stats_upload(sa->nic, &port->mac_stats_dma_mem);
+		if (rc != 0)
+			goto fail_mac_stats_upload;
+	}
+
 	sfc_log_init(sa, "disable MAC drain");
 	rc = efx_mac_drain(sa->nic, B_FALSE);
 	if (rc != 0)
@@ -265,6 +277,7 @@ sfc_port_start(struct sfc_adapter *sa)
 	(void)efx_mac_stats_periodic(sa->nic, &port->mac_stats_dma_mem,
 				     0, B_FALSE);
 
+fail_mac_stats_upload:
 fail_mac_stats_periodic:
 fail_mcast_address_list_set:
 fail_mac_filter_set:
-- 
2.7.4

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [dpdk-stable] [PATCH] net/sfc: request MAC stats upload immediately on port start
  2017-07-08 15:16 [dpdk-dev] [PATCH] net/sfc: request MAC stats upload immediately on port start Andrew Rybchenko
@ 2017-07-18  8:23 ` Ferruh Yigit
  0 siblings, 0 replies; 2+ messages in thread
From: Ferruh Yigit @ 2017-07-18  8:23 UTC (permalink / raw)
  To: Andrew Rybchenko, dev; +Cc: Ivan Malov, stable

On 7/8/2017 4:16 PM, Andrew Rybchenko wrote:
> From: Ivan Malov <ivan.malov@oktetlabs.ru>
> 
> If MAC stats refresh is arranged to be done by periodic DMA,
> the first DMA transaction is unlikely to occur right on the
> port start; if the user tries to get stats right after port
> start and before the transaction occurs, bogus figures will
> be collected; a one-off stats upload on port start is a fix
> 
> Fixes: 1caab2f1e684 ("net/sfc: add basic statistics")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>

Applied to dpdk-next-net/master, thanks.

(Another column aligned commit log from Ivan :), thanks!)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-07-18  8:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-08 15:16 [dpdk-dev] [PATCH] net/sfc: request MAC stats upload immediately on port start Andrew Rybchenko
2017-07-18  8:23 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).