[PATCH 3/9] common/sfc_efx/base: fix indication of requestable FEC flags

Ivan Malov
2025-12-29T21:35:55Z

Without these, the client driver will not allow to change default FEC mode.
The existing code assumes that the FW supplies them in the 'FEC_REQ' field
of the 'GET_FIXED_PORT_PROPERTIES' MCDI, but that is not the case. Arrange
the code to reuse the snippet from pre-X4 EF10 attach path to set the bits.

Fixes: a90549f527eb ("common/sfc_efx/base: get netport fixed capabilities on probe")
Cc: stable@dpdk.org

Signed-off-by: Ivan Malov <ivan.malov@arknetworks.am>
Reviewed-by: Andy Moreton <andy.moreton@amd.com>
---
drivers/common/sfc_efx/base/ef10_nic.c | 57 ++++++++++++++------------
drivers/common/sfc_efx/base/efx_np.c | 2 +-
2 files changed, 32 insertions(+), 27 deletions(-)

diff --git a/drivers/common/sfc_efx/base/ef10_nic.c b/drivers/common/sfc_efx/base/ef10_nic.c
index 627144cfb0..9af4259d38 100644
--- a/drivers/common/sfc_efx/base/ef10_nic.c
+++ b/drivers/common/sfc_efx/base/ef10_nic.c
@@ -2220,35 +2220,23 @@ efx_mcdi_nic_board_cfg(

encp->enc_board_type = board_type;

- if (efx_np_supported(enp) != B_FALSE)
- goto skip_phy_props;
-
- /* Fill out fields in enp->en_port and enp->en_nic_cfg from MCDI */
- if ((rc = efx_mcdi_get_phy_cfg(enp)) != 0)
- goto fail8;
+ if (efx_np_supported(enp) == B_FALSE) {
+ /*
+ * Fill out fields in enp->en_port and enp->en_nic_cfg from MCDI
+ */
+ rc = efx_mcdi_get_phy_cfg(enp);
+ if (rc != 0)
+ goto fail8;

- /*
- * Firmware with support for *_FEC capability bits does not
- * report that the corresponding *_FEC_REQUESTED bits are supported.
- * Add them here so that drivers understand that they are supported.
- */
- if (epp->ep_phy_cap_mask & (1u << EFX_PHY_CAP_BASER_FEC))
- epp->ep_phy_cap_mask |=
- (1u << EFX_PHY_CAP_BASER_FEC_REQUESTED);
- if (epp->ep_phy_cap_mask & (1u << EFX_PHY_CAP_RS_FEC))
- epp->ep_phy_cap_mask |=
- (1u << EFX_PHY_CAP_RS_FEC_REQUESTED);
- if (epp->ep_phy_cap_mask & (1u << EFX_PHY_CAP_25G_BASER_FEC))
- epp->ep_phy_cap_mask |=
- (1u << EFX_PHY_CAP_25G_BASER_FEC_REQUESTED);
+ /* Obtain the default PHY advertised capabilities */
+ rc = ef10_phy_get_link(enp, &els);
+ if (rc != 0)
+ goto fail9;

- /* Obtain the default PHY advertised capabilities */
- if ((rc = ef10_phy_get_link(enp, &els)) != 0)
- goto fail9;
- epp->ep_default_adv_cap_mask = els.epls.epls_adv_cap_mask;
- epp->ep_adv_cap_mask = els.epls.epls_adv_cap_mask;
+ epp->ep_default_adv_cap_mask = els.epls.epls_adv_cap_mask;
+ epp->ep_adv_cap_mask = els.epls.epls_adv_cap_mask;
+ }

-skip_phy_props:
/* Check capabilities of running datapath firmware */
if ((rc = ef10_get_datapath_caps(enp)) != 0)
goto fail10;
@@ -2483,6 +2471,7 @@ ef10_nic_probe(
{
efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
efx_drv_cfg_t *edcp = &(enp->en_drv_cfg);
+ efx_port_t *epp = &(enp->en_port);
efx_rc_t rc;

EFSYS_ASSERT(EFX_FAMILY_IS_EF10(enp));
@@ -2506,6 +2495,22 @@ ef10_nic_probe(
if (rc != 0)
goto fail5;

+ /*
+ * Firmware with support for *_FEC capability bits does not
+ * report that the corresponding *_FEC_REQUESTED bits are supported.
+ * Add them here so that drivers understand that they are supported.
+ */
+
+ if (epp->ep_phy_cap_mask & (1u << EFX_PHY_CAP_BASER_FEC))
+ epp->ep_phy_cap_mask |=
+ (1u << EFX_PHY_CAP_BASER_FEC_REQUESTED);
+ if (epp->ep_phy_cap_mask & (1u << EFX_PHY_CAP_RS_FEC))
+ epp->ep_phy_cap_mask |=
+ (1u << EFX_PHY_CAP_RS_FEC_REQUESTED);
+ if (epp->ep_phy_cap_mask & (1u << EFX_PHY_CAP_25G_BASER_FEC))
+ epp->ep_phy_cap_mask |=
+ (1u << EFX_PHY_CAP_25G_BASER_FEC_REQUESTED);
+
/*
* Set default driver config limits (based on board config).
*
diff --git a/drivers/common/sfc_efx/base/efx_np.c b/drivers/common/sfc_efx/base/efx_np.c
index ca0eb09b4a..45f3cd07ed 100644
--- a/drivers/common/sfc_efx/base/efx_np.c
+++ b/drivers/common/sfc_efx/base/efx_np.c
@@ -1392,7 +1392,7 @@ efx_np_link_ctrl(
* no 'FEC_REQUESTED' bits, use 'NONE' or 'AUTO' from above.
*/
EFX_NP_CAP_SW_MASK_TO_HW_ENUM(efx_np_cap_map_fec_req,
- ETH_AN_FIELDS_FEC_REQ, cap_data_raw, cap_mask_sw,
+ ETH_AN_FIELDS_FEC_MASK, cap_data_raw, cap_mask_sw,
NULL, NULL, &supported, &cap_enum_hw);

if ((cap_mask_sw & EFX_PHY_CAP_FEC_MASK) != 0
--
2.47.3