[PATCH 21/46] common/sfc_efx/base: provide defaults on netport attach path
Ivan Malov
ivan.malov at arknetworks.am
Wed Apr 16 15:59:51 CEST 2025
Fill in some port information, including legacy Siena fields.
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_np.c | 44 ++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/drivers/common/sfc_efx/base/efx_np.c b/drivers/common/sfc_efx/base/efx_np.c
index 432185f311..3200bc0a90 100644
--- a/drivers/common/sfc_efx/base/efx_np.c
+++ b/drivers/common/sfc_efx/base/efx_np.c
@@ -12,13 +12,57 @@ efx_np_supported(
return (enp->en_family >= EFX_FAMILY_MEDFORD4) ? B_TRUE : B_FALSE;
}
+static void
+efx_np_assign_legacy_props(
+ __in efx_nic_t *enp)
+{
+ efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
+
+ memset(encp->enc_phy_revision, 0, sizeof (encp->enc_phy_revision));
+ encp->enc_phy_type = 0;
+
+#if EFSYS_OPT_NAMES
+ memset(encp->enc_phy_name, 0, sizeof (encp->enc_phy_name));
+#endif /* EFSYS_OPT_NAMES */
+
+#if EFSYS_OPT_PHY_STATS
+ encp->enc_mcdi_phy_stat_mask = 0;
+#endif /* EFSYS_OPT_PHY_STATS */
+
+#if EFSYS_OPT_PHY_FLAGS
+ encp->enc_phy_flags_mask = 0;
+#endif /* EFSYS_OPT_PHY_FLAGS */
+
+#if EFSYS_OPT_BIST
+ encp->enc_bist_mask = 0;
+#endif /* EFSYS_OPT_BIST */
+
+ encp->enc_mcdi_mdio_channel = 0;
+ encp->enc_port = 0;
+}
+
__checkReturn efx_rc_t
efx_np_attach(
__in efx_nic_t *enp)
{
+ efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
+ efx_port_t *epp = &(enp->en_port);
+
if (efx_np_supported(enp) == B_FALSE)
return (0);
+ /*
+ * Some EFX properties are mostly leftover from Siena era
+ * and we prefer to initialise those to harmless defaults.
+ */
+ efx_np_assign_legacy_props(enp);
+
+#if EFSYS_OPT_PHY_LED_CONTROL
+ encp->enc_led_mask = 1U << EFX_PHY_LED_DEFAULT;
+#endif /* EFSYS_OPT_PHY_LED_CONTROL */
+
+ epp->ep_fixed_port_type = EFX_PHY_MEDIA_INVALID;
+ epp->ep_module_type = EFX_PHY_MEDIA_INVALID;
return (0);
}
--
2.39.5
More information about the dev
mailing list