X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fsfc%2Fbase%2Fefx_phy.c;h=36a7bbd3dde393425ae8184b015fc6874723117c;hb=d31c844435e6aba171a41a47dd5818fe8c498337;hp=e78d6efcbb00d2a078abd97114832a9fd63a5a7c;hpb=7624c9442df3b87aac77c6923b59740299866c43;p=dpdk.git diff --git a/drivers/net/sfc/base/efx_phy.c b/drivers/net/sfc/base/efx_phy.c index e78d6efcbb..36a7bbd3dd 100644 --- a/drivers/net/sfc/base/efx_phy.c +++ b/drivers/net/sfc/base/efx_phy.c @@ -15,7 +15,7 @@ static const efx_phy_ops_t __efx_phy_siena_ops = { 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 */ @@ -35,7 +35,7 @@ static const efx_phy_ops_t __efx_phy_ef10_ops = { 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 */ @@ -288,8 +288,8 @@ efx_phy_media_type_get( efx_phy_module_get_info( __in efx_nic_t *enp, __in uint8_t dev_addr, - __in uint8_t offset, - __in uint8_t len, + __in size_t offset, + __in size_t len, __out_bcount(len) uint8_t *data) { efx_rc_t rc; @@ -297,7 +297,8 @@ efx_phy_module_get_info( EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); EFSYS_ASSERT(data != NULL); - if ((uint32_t)offset + len > 0x100) { + if ((offset > EFX_PHY_MEDIA_INFO_MAX_OFFSET) || + ((offset + len) > EFX_PHY_MEDIA_INFO_MAX_OFFSET)) { rc = EINVAL; goto fail1; } @@ -320,19 +321,41 @@ fail1: efx_phy_fec_type_get( __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);