[PATCH net-next v16 03/15] net: phy: Introduce PHY ports representation
Maxime Chevallier
maxime.chevallier at bootlin.com
Wed Nov 19 05:30:36 PST 2025
On 19/11/2025 04:15, Jakub Kicinski wrote:
> On Thu, 13 Nov 2025 09:14:05 +0100 Maxime Chevallier wrote:
>> --- a/include/linux/ethtool.h
>> +++ b/include/linux/ethtool.h
>> @@ -228,6 +228,10 @@ extern const struct link_mode_info link_mode_params[];
>>
>> extern const char ethtool_link_medium_names[][ETH_GSTRING_LEN];
>>
>> +#define ETHTOOL_MEDIUM_FIBER_BITS (BIT(ETHTOOL_LINK_MEDIUM_BASES) | \
>> + BIT(ETHTOOL_LINK_MEDIUM_BASEL) | \
>> + BIT(ETHTOOL_LINK_MEDIUM_BASEF))
>
> Hm, I think this is defined in uAPI as well?
hmpf indeed... thanks for spotting this
>
>> static inline const char *phy_mediums(enum ethtool_link_medium medium)
>> {
>> if (medium >= __ETHTOOL_LINK_MEDIUM_LAST)
>> @@ -236,6 +240,22 @@ static inline const char *phy_mediums(enum ethtool_link_medium medium)
>> return ethtool_link_medium_names[medium];
>> }
>>
>> +static inline enum ethtool_link_medium ethtool_str_to_medium(const char *str)
>> +{
>> + int i;
>> +
>> + for (i = 0; i < __ETHTOOL_LINK_MEDIUM_LAST; i++)
>> + if (!strcmp(phy_mediums(i), str))
>> + return i;
>> +
>> + return ETHTOOL_LINK_MEDIUM_NONE;
>> +}
>
> Same comment about possibly moving this elsewhere as on phy_mediums()
No problem :)
Thanks !
Maxime
>
>> +static inline int ethtool_linkmode_n_pairs(unsigned int mode)
>> +{
>> + return link_mode_params[mode].pairs;
>> +}
More information about the linux-arm-kernel
mailing list