@@ -652,6 +652,9 @@ static int ax88179_set_link_ksettings(struct net_device *net,
static int
ax88179_ethtool_get_eee(struct usbnet *dev, struct ethtool_eee *data)
{
+ __ETHTOOL_DECLARE_LINK_MODE_MASK(lm_able) = {};
+ __ETHTOOL_DECLARE_LINK_MODE_MASK(lm_adv) = {};
+ __ETHTOOL_DECLARE_LINK_MODE_MASK(lm_lp) = {};
int val;
/* Get Supported EEE */
@@ -659,21 +662,24 @@ ax88179_ethtool_get_eee(struct usbnet *dev, struct ethtool_eee *data)
MDIO_MMD_PCS);
if (val < 0)
return val;
- data->supported = mmd_eee_cap_to_ethtool_sup_t(val);
+ mii_eee_cap1_mod_linkmode_t(lm_able, val);
+ ethtool_convert_link_mode_to_legacy_u32(&data->supported, lm_able);
/* Get advertisement EEE */
val = ax88179_phy_read_mmd_indirect(dev, MDIO_AN_EEE_ADV,
MDIO_MMD_AN);
if (val < 0)
return val;
- data->advertised = mmd_eee_adv_to_ethtool_adv_t(val);
+ mii_eee_cap1_mod_linkmode_t(lm_adv, val);
+ ethtool_convert_link_mode_to_legacy_u32(&data->advertised, lm_adv);
/* Get LP advertisement EEE */
val = ax88179_phy_read_mmd_indirect(dev, MDIO_AN_EEE_LPABLE,
MDIO_MMD_AN);
if (val < 0)
return val;
- data->lp_advertised = mmd_eee_adv_to_ethtool_adv_t(val);
+ mii_eee_cap1_mod_linkmode_t(lm_lp, val);
+ ethtool_convert_link_mode_to_legacy_u32(&data->lp_advertised, lm_lp);
return 0;
}
@@ -681,7 +687,11 @@ ax88179_ethtool_get_eee(struct usbnet *dev, struct ethtool_eee *data)
static int
ax88179_ethtool_set_eee(struct usbnet *dev, struct ethtool_eee *data)
{
- u16 tmp16 = ethtool_adv_to_mmd_eee_adv_t(data->advertised);
+ __ETHTOOL_DECLARE_LINK_MODE_MASK(adv) = {};
+ u16 tmp16;
+
+ adv[0] = data->advertised;
+ tmp16 = linkmode_to_mii_eee_cap1_t(adv);
return ax88179_phy_write_mmd_indirect(dev, MDIO_AN_EEE_ADV,
MDIO_MMD_AN, tmp16);
@@ -706,7 +716,7 @@ static int ax88179_chk_eee(struct usbnet *dev)
return false;
}
- cap = mmd_eee_cap_to_ethtool_sup_t(eee_cap);
+ cap = eee_cap & (MDIO_EEE_100TX | MDIO_EEE_1000T);
if (!cap) {
priv->eee_active = 0;
return false;
@@ -729,8 +739,8 @@ static int ax88179_chk_eee(struct usbnet *dev)
return false;
}
- adv = mmd_eee_adv_to_ethtool_adv_t(eee_adv);
- lp = mmd_eee_adv_to_ethtool_adv_t(eee_lp);
+ adv = eee_adv & (MDIO_EEE_100TX | MDIO_EEE_1000T);
+ lp = eee_lp & (MDIO_EEE_100TX | MDIO_EEE_1000T);
supported = (ecmd.speed == SPEED_1000) ?
SUPPORTED_1000baseT_Full :
SUPPORTED_100baseT_Full;
Replace EEE ethtool helpers with linkmode variants. This will reduce similar code snippets and prepare ethtool EEE interface to linkmode migration. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> --- drivers/net/usb/ax88179_178a.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-)