net: phy: improve definition of __ETHTOOL_LINK_MODE_MASK_NBITS
Subsystems (3)
PATCH 1/1 net: phy: improve definition of __ETHTOOL_LINK_MODE_MASK_NBITS
The way to define __ETHTOOL_LINK_MODE_MASK_NBITS seems to be overly complicated, go with a standard approach instead.
Whilst we're at it, move the comment to the right place.
Signed-off-by Heiner Kallweit <[email protected]>
--- include/linux/ethtool.h | 4 ---- include/uapi/linux/ethtool.h | 17 +++++++++-------- 2 files changed, 9 insertions(+), 12 deletions(-)
include/linux/ethtool.h +0 -4
@@ -98,10 +98,6 @@ static inline u32 ethtool_rxfh_indir_default(u32 index, u32 n_rx_rings)return index % n_rx_rings; } -/* number of link mode bits/ulongs handled internally by kernel */ -#define __ETHTOOL_LINK_MODE_MASK_NBITS \ - (__ETHTOOL_LINK_MODE_LAST + 1) -/* declare a link mode bitmap */ #define __ETHTOOL_DECLARE_LINK_MODE_MASK (name) \ DECLARE_BITMAP(name, __ETHTOOL_LINK_MODE_MASK_NBITS)
include/uapi/linux/ethtool.h +9 -8
@@ -1432,6 +1432,13 @@ enum ethtool_link_mode_bit_indices { ETHTOOL_LINK_MODE_56000baseSR4_Full_BIT =29 , ETHTOOL_LINK_MODE_56000baseLR4_Full_BIT =30 , ETHTOOL_LINK_MODE_25000baseCR_Full_BIT =31 , + +/* Last allowed bit for __ETHTOOL_LINK_MODE_LEGACY_MASK is bit +* 31. Please do NOT define any SUPPORTED_* or ADVERTISED_* +* macro for bits > 31. The only way to use indices > 31 is to +* use the new ETHTOOL_GLINKSETTINGS/ETHTOOL_SLINKSETTINGS API. +*/ + ETHTOOL_LINK_MODE_25000baseKR_Full_BIT =32 , ETHTOOL_LINK_MODE_25000baseSR_Full_BIT =33 , ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT = 34,
@@ -1454,14 +1461,8 @@ enum ethtool_link_mode_bit_indices {ETHTOOL_LINK_MODE_FEC_RS_BIT =50 ,ETHTOOL_LINK_MODE_FEC_BASER_BIT =51 , -/* Last allowed bit for __ETHTOOL_LINK_MODE_LEGACY_MASK is bit -* 31. Please do NOT define any SUPPORTED_* or ADVERTISED_* -* macro for bits > 31. The only way to use indices > 31 is to -* use the new ETHTOOL_GLINKSETTINGS/ETHTOOL_SLINKSETTINGS API. -*/ - - __ETHTOOL_LINK_MODE_LAST - = ETHTOOL_LINK_MODE_FEC_BASER_BIT, +/* must be last entry */ + __ETHTOOL_LINK_MODE_MASK_NBITS };#define __ETHTOOL_LINK_MODE_LEGACY_MASK (base_name) \
Signature · 1 line
2.20.1
David Miller
maintainerFrom: Heiner Kallweit <[email protected]>
Date: Mon, 18 Feb 2019 21:43:31 +0100
Quoted 5 lines
The way to define
__ETHTOOL_LINK_MODE_MASK_NBITSseems to be overly complicated, go with a standard approach instead.
Whilst we're at it, move the comment to the right place.Signed-off-by Heiner Kallweit <[email protected]>
Hey Heiner, you'll have to respin this after the recent mlx5 pull into net-next which added new mode values.
Thanks.