Index: head/sys/dev/sfxge/common/ef10_impl.h =================================================================== --- head/sys/dev/sfxge/common/ef10_impl.h +++ head/sys/dev/sfxge/common/ef10_impl.h @@ -619,11 +619,7 @@ /* PHY */ typedef struct ef10_link_state_s { - uint32_t els_adv_cap_mask; - uint32_t els_lp_cap_mask; - unsigned int els_fcntl; - efx_phy_fec_type_t els_fec; - efx_link_mode_t els_link_mode; + efx_phy_link_state_t epls; #if EFSYS_OPT_LOOPBACK efx_loopback_type_t els_loopback; #endif @@ -660,9 +656,9 @@ __out uint32_t *ouip); extern __checkReturn efx_rc_t -ef10_phy_fec_type_get( +ef10_phy_link_state_get( __in efx_nic_t *enp, - __out efx_phy_fec_type_t *fecp); + __out efx_phy_link_state_t *eplsp); #if EFSYS_OPT_PHY_STATS Index: head/sys/dev/sfxge/common/ef10_mac.c =================================================================== --- head/sys/dev/sfxge/common/ef10_mac.c +++ head/sys/dev/sfxge/common/ef10_mac.c @@ -49,10 +49,10 @@ if ((rc = ef10_phy_get_link(enp, &els)) != 0) goto fail1; - epp->ep_adv_cap_mask = els.els_adv_cap_mask; - epp->ep_fcntl = els.els_fcntl; + epp->ep_adv_cap_mask = els.epls.epls_adv_cap_mask; + epp->ep_fcntl = els.epls.epls_fcntl; - *link_modep = els.els_link_mode; + *link_modep = els.epls.epls_link_mode; return (0); Index: head/sys/dev/sfxge/common/ef10_nic.c =================================================================== --- head/sys/dev/sfxge/common/ef10_nic.c +++ head/sys/dev/sfxge/common/ef10_nic.c @@ -1879,8 +1879,8 @@ /* Obtain the default PHY advertised capabilities */ if ((rc = ef10_phy_get_link(enp, &els)) != 0) goto fail7; - epp->ep_default_adv_cap_mask = els.els_adv_cap_mask; - epp->ep_adv_cap_mask = els.els_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; /* Check capabilities of running datapath firmware */ if ((rc = ef10_get_datapath_caps(enp)) != 0) Index: head/sys/dev/sfxge/common/ef10_phy.c =================================================================== --- head/sys/dev/sfxge/common/ef10_phy.c +++ head/sys/dev/sfxge/common/ef10_phy.c @@ -313,9 +313,9 @@ } mcdi_phy_decode_cap(MCDI_OUT_DWORD(req, GET_LINK_OUT_CAP), - &elsp->els_adv_cap_mask); + &elsp->epls.epls_adv_cap_mask); mcdi_phy_decode_cap(MCDI_OUT_DWORD(req, GET_LINK_OUT_LP_CAP), - &elsp->els_lp_cap_mask); + &elsp->epls.epls_lp_cap_mask); if (req.emr_out_length_used < MC_CMD_GET_LINK_OUT_V2_LEN) fec = MC_CMD_FEC_NONE; @@ -325,9 +325,17 @@ mcdi_phy_decode_link_mode(enp, MCDI_OUT_DWORD(req, GET_LINK_OUT_FLAGS), MCDI_OUT_DWORD(req, GET_LINK_OUT_LINK_SPEED), MCDI_OUT_DWORD(req, GET_LINK_OUT_FCNTL), - fec, &elsp->els_link_mode, - &elsp->els_fcntl, &elsp->els_fec); + fec, &elsp->epls.epls_link_mode, + &elsp->epls.epls_fcntl, &elsp->epls.epls_fec); + if (req.emr_out_length_used < MC_CMD_GET_LINK_OUT_V2_LEN) { + elsp->epls.epls_ld_cap_mask = 0; + } else { + mcdi_phy_decode_cap(MCDI_OUT_DWORD(req, GET_LINK_OUT_V2_LD_CAP), + &elsp->epls.epls_ld_cap_mask); + } + + #if EFSYS_OPT_LOOPBACK /* * MC_CMD_LOOPBACK and EFX_LOOPBACK names are equivalent, so use the @@ -570,18 +578,18 @@ } __checkReturn efx_rc_t -ef10_phy_fec_type_get( +ef10_phy_link_state_get( __in efx_nic_t *enp, - __out efx_phy_fec_type_t *fecp) + __out efx_phy_link_state_t *eplsp) { efx_rc_t rc; ef10_link_state_t els; - /* Obtain the active FEC type */ + /* Obtain the active link state */ if ((rc = ef10_phy_get_link(enp, &els)) != 0) goto fail1; - *fecp = els.els_fec; + *eplsp = els.epls; return (0); Index: head/sys/dev/sfxge/common/efx.h =================================================================== --- head/sys/dev/sfxge/common/efx.h +++ head/sys/dev/sfxge/common/efx.h @@ -3286,6 +3286,21 @@ __in efx_nic_t *enp, __out efx_phy_fec_type_t *typep); +typedef struct efx_phy_link_state_s { + uint32_t epls_adv_cap_mask; + uint32_t epls_lp_cap_mask; + uint32_t epls_ld_cap_mask; + unsigned int epls_fcntl; + efx_phy_fec_type_t epls_fec; + efx_link_mode_t epls_link_mode; +} efx_phy_link_state_t; + +extern __checkReturn efx_rc_t +efx_phy_link_state_get( + __in efx_nic_t *enp, + __out efx_phy_link_state_t *eplsp); + + #ifdef __cplusplus } #endif Index: head/sys/dev/sfxge/common/efx_impl.h =================================================================== --- head/sys/dev/sfxge/common/efx_impl.h +++ head/sys/dev/sfxge/common/efx_impl.h @@ -252,7 +252,7 @@ efx_rc_t (*epo_reconfigure)(efx_nic_t *); efx_rc_t (*epo_verify)(efx_nic_t *); efx_rc_t (*epo_oui_get)(efx_nic_t *, uint32_t *); - efx_rc_t (*epo_fec_type_get)(efx_nic_t *, efx_phy_fec_type_t *); + efx_rc_t (*epo_link_state_get)(efx_nic_t *, efx_phy_link_state_t *); #if EFSYS_OPT_PHY_STATS efx_rc_t (*epo_stats_update)(efx_nic_t *, efsys_mem_t *, uint32_t *); Index: head/sys/dev/sfxge/common/efx_phy.c =================================================================== --- head/sys/dev/sfxge/common/efx_phy.c +++ head/sys/dev/sfxge/common/efx_phy.c @@ -44,7 +44,7 @@ siena_phy_reconfigure, /* epo_reconfigure */ siena_phy_verify, /* epo_verify */ siena_phy_oui_get, /* epo_oui_get */ - NULL, /* epo_fec_type_get */ + NULL, /* epo_link_state_get */ #if EFSYS_OPT_PHY_STATS siena_phy_stats_update, /* epo_stats_update */ #endif /* EFSYS_OPT_PHY_STATS */ @@ -64,7 +64,7 @@ ef10_phy_reconfigure, /* epo_reconfigure */ ef10_phy_verify, /* epo_verify */ ef10_phy_oui_get, /* epo_oui_get */ - ef10_phy_fec_type_get, /* epo_fec_type_get */ + ef10_phy_link_state_get, /* epo_link_state_get */ #if EFSYS_OPT_PHY_STATS ef10_phy_stats_update, /* epo_stats_update */ #endif /* EFSYS_OPT_PHY_STATS */ @@ -351,18 +351,40 @@ __in efx_nic_t *enp, __out efx_phy_fec_type_t *typep) { + efx_rc_t rc; + efx_phy_link_state_t epls; + + if ((rc = efx_phy_link_state_get(enp, &epls)) != 0) + goto fail1; + + *typep = epls.epls_fec; + + return (0); + +fail1: + EFSYS_PROBE1(fail1, efx_rc_t, rc); + + return (rc); +} + + __checkReturn efx_rc_t +efx_phy_link_state_get( + __in efx_nic_t *enp, + __out efx_phy_link_state_t *eplsp) +{ efx_port_t *epp = &(enp->en_port); const efx_phy_ops_t *epop = epp->ep_epop; efx_rc_t rc; EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); + EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PROBE); - if (epop->epo_fec_type_get == NULL) { + if (epop->epo_link_state_get == NULL) { rc = ENOTSUP; goto fail1; } - if ((rc = epop->epo_fec_type_get(enp, typep)) != 0) + if ((rc = epop->epo_link_state_get(enp, eplsp)) != 0) goto fail2; return (0);