DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] common/sfc_efx/base: clear VADAPTER stats upon allocation
@ 2026-08-24 11:26 Ivan Malov
  2026-08-24 16:06 ` Stephen Hemminger
  0 siblings, 1 reply; 4+ messages in thread
From: Ivan Malov @ 2026-08-24 11:26 UTC (permalink / raw)
  To: dev
  Cc: Viacheslav Galaktionov, Andy Moreton, Roman Zhukov,
	Pieter Jansen van Vuuren, Stephen Hemminger, Andrew Rybchenko

The probe-time clear in 'ef10_nic_probe' runs before the VADAPTER is
allocated and so cannot zero its counters. Add a complementary clear
to the point at which the VADAPTER is already in place, so that
VADAPTER statistics begin at zero for both PFs and VFs.

This change affects only Medford4 NICs within the 26.11 release, where
Medford4 VADAPTER statistics have been added in the first place.

Signed-off-by: Ivan Malov <ivan.malov@arknetworks.am>
Reviewed-by: Viacheslav Galaktionov <viacheslav.galaktionov@arknetworks.am>
Reviewed-by: Andy Moreton <andy.moreton@amd.com>
---
 drivers/common/sfc_efx/base/ef10_nic.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/common/sfc_efx/base/ef10_nic.c b/drivers/common/sfc_efx/base/ef10_nic.c
index 9af4259d38..954409ec90 100644
--- a/drivers/common/sfc_efx/base/ef10_nic.c
+++ b/drivers/common/sfc_efx/base/ef10_nic.c
@@ -2868,10 +2868,30 @@ ef10_nic_init(
 		if ((rc = ef10_upstream_port_vadaptor_alloc(enp)) != 0)
 			goto fail5;
 	}
+
+#if EFSYS_OPT_MAC_STATS
+	/*
+	 * Clear MAC statistics for the freshly allocated VADAPTER.
+	 * The probe-time wipe in 'ef10_nic_probe' predates the
+	 * allocation and cannot reach vadaptor-scoped counters;
+	 * do it here while 'en_vport_id' holds a valid value.
+	 */
+	rc = efx_mcdi_mac_stats_clear(enp);
+	if (rc != 0)
+		goto fail6;
+#endif
 	enp->en_nic_cfg.enc_mcdi_max_payload_length = MCDI_CTL_SDU_LEN_MAX_V2;
 
 	return (0);
 
+#if EFSYS_OPT_MAC_STATS
+fail6:
+	EFSYS_PROBE(fail6);
+	if (alloc_vadaptor != B_FALSE) {
+		(void) efx_mcdi_vadaptor_free(enp, enp->en_vport_id);
+		enp->en_vport_id = EVB_PORT_ID_NULL;
+	}
+#endif
 fail5:
 	EFSYS_PROBE(fail5);
 fail4:
-- 
2.47.3


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

end of thread, other threads:[~2026-08-24 16:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-24 11:26 [PATCH 1/1] common/sfc_efx/base: clear VADAPTER stats upon allocation Ivan Malov
2026-08-24 16:06 ` Stephen Hemminger
2026-08-24 16:44   ` Ivan Malov
2026-08-24 16:50     ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox