Re: [PATCH net v2] net: phy: aquantia: Introduce custom get_features

From: Abhishek Chauhan (ABC)
Date: Tue Sep 24 2024 - 11:20:34 EST




On 9/24/2024 5:04 AM, Andrew Lunn wrote:
>> +static void aqr_supported_speed(struct phy_device *phydev, u32 max_speed)
>> +{
>> + __ETHTOOL_DECLARE_LINK_MODE_MASK(supported) = { 0, };
>> +
>> + linkmode_set_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, supported);
>> + linkmode_set_bit(ETHTOOL_LINK_MODE_Pause_BIT, supported);
>> + linkmode_set_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, supported);
>> + linkmode_set_bit(ETHTOOL_LINK_MODE_FIBRE_BIT, supported);
>> + linkmode_set_bit(ETHTOOL_LINK_MODE_TP_BIT, supported);
>> + linkmode_set_bit(ETHTOOL_LINK_MODE_10baseT_Half_BIT, supported);
>> + linkmode_set_bit(ETHTOOL_LINK_MODE_10baseT_Full_BIT, supported);
>> + linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Half_BIT, supported);
>> + linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, supported);
>> + linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT, supported);
>> + linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, supported);
>> +
>> + if (max_speed == SPEED_2500) {
>> + linkmode_set_bit(ETHTOOL_LINK_MODE_2500baseX_Full_BIT, supported);
>> + linkmode_set_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, supported);
>> + } else if (max_speed == SPEED_5000) {
>> + linkmode_set_bit(ETHTOOL_LINK_MODE_2500baseX_Full_BIT, supported);
>> + linkmode_set_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, supported);
>> + linkmode_set_bit(ETHTOOL_LINK_MODE_5000baseT_Full_BIT, supported);
>> + }
>> +
>> + linkmode_copy(phydev->supported, supported);
>> +}
>
> So you have got lots of comments....
>
> Please split this into two patches. One patch for the PHY you are
> interested in, and a second patch to remove phy_set_max_speed() and
> fix up that PHY.
>
Noted!

> Also, i would prefer you do the normal feature discovery, calling
> genphy_read_abilities() and/or genphy_c45_pma_read_abilities() and
> then fixup the results by removing the modes which should not be
> there.
>
Sounds good!
> Take a look at bcm84881_get_features() as an example.
>
Thanks Andrew!
> Andrew