[PATCH v2 33/45] common/sfc_efx/base: fill in MAC statistics mask on Medford4
Ivan Malov
ivan.malov at arknetworks.am
Wed Apr 23 17:59:50 CEST 2025
Let client drivers know which MAC statistics can be accessed.
Signed-off-by: Ivan Malov <ivan.malov at arknetworks.am>
Reviewed-by: Andy Moreton <andy.moreton at amd.com>
Reviewed-by: Pieter Jansen Van Vuuren <pieter.jansen-van-vuuren at amd.com>
---
drivers/common/sfc_efx/base/efx_mac.c | 2 +-
drivers/common/sfc_efx/base/medford4_impl.h | 9 ++++++
drivers/common/sfc_efx/base/medford4_mac.c | 31 +++++++++++++++++++++
3 files changed, 41 insertions(+), 1 deletion(-)
diff --git a/drivers/common/sfc_efx/base/efx_mac.c b/drivers/common/sfc_efx/base/efx_mac.c
index 3c29db0016..6abe2046e8 100644
--- a/drivers/common/sfc_efx/base/efx_mac.c
+++ b/drivers/common/sfc_efx/base/efx_mac.c
@@ -105,7 +105,7 @@ static const efx_mac_ops_t __efx_mac_medford4_ops = {
ef10_mac_loopback_set, /* emo_loopback_set */
#endif /* EFSYS_OPT_LOOPBACK */
#if EFSYS_OPT_MAC_STATS
- ef10_mac_stats_get_mask, /* emo_stats_get_mask */
+ medford4_mac_stats_get_mask, /* emo_stats_get_mask */
efx_mcdi_mac_stats_clear, /* emo_stats_clear */
efx_mcdi_mac_stats_upload, /* emo_stats_upload */
efx_mcdi_mac_stats_periodic, /* emo_stats_periodic */
diff --git a/drivers/common/sfc_efx/base/medford4_impl.h b/drivers/common/sfc_efx/base/medford4_impl.h
index 8b232c516a..2fbf1495d1 100644
--- a/drivers/common/sfc_efx/base/medford4_impl.h
+++ b/drivers/common/sfc_efx/base/medford4_impl.h
@@ -56,6 +56,15 @@ extern __checkReturn efx_rc_t
medford4_mac_reconfigure(
__in efx_nic_t *enp);
+#if EFSYS_OPT_MAC_STATS
+LIBEFX_INTERNAL
+extern __checkReturn efx_rc_t
+medford4_mac_stats_get_mask(
+ __in efx_nic_t *enp,
+ __inout_bcount(sz) uint32_t *maskp,
+ __in size_t sz);
+#endif /* EFSYS_OPT_MAC_STATS */
+
#ifdef __cplusplus
}
#endif
diff --git a/drivers/common/sfc_efx/base/medford4_mac.c b/drivers/common/sfc_efx/base/medford4_mac.c
index ade4379a19..23c59f18ed 100644
--- a/drivers/common/sfc_efx/base/medford4_mac.c
+++ b/drivers/common/sfc_efx/base/medford4_mac.c
@@ -89,4 +89,35 @@ medford4_mac_reconfigure(
EFSYS_PROBE1(fail1, efx_rc_t, rc);
return (rc);
}
+
+#if EFSYS_OPT_MAC_STATS
+ __checkReturn efx_rc_t
+medford4_mac_stats_get_mask(
+ __in efx_nic_t *enp,
+ __inout_bcount(sz) uint32_t *maskp,
+ __in size_t sz)
+{
+ efx_port_t *epp = &(enp->en_port);
+ unsigned int i;
+ efx_rc_t rc;
+
+ for (i = 0; i < EFX_ARRAY_SIZE(epp->ep_np_mac_stat_lut); ++i) {
+ const struct efx_mac_stats_range rng[] = { { i, i } };
+
+ if (epp->ep_np_mac_stat_lut[i].ens_valid == B_FALSE)
+ continue;
+
+ rc = efx_mac_stats_mask_add_ranges(maskp, sz, rng, 1);
+ if (rc != 0)
+ goto fail1;
+ }
+
+ /* TODO: care about VADAPTOR statistics when VF support arrives */
+ return (0);
+
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+ return (rc);
+}
+#endif /* EFSYS_OPT_MAC_STATS */
#endif /* EFSYS_OPT_MEDFORD4 */
--
2.39.5
More information about the dev
mailing list