Skip to content

Commit 79f88a5

Browse files
minimaxwellPaolo Abeni
authored andcommitted
net: ethtool: Export the link_mode_params definitions
link_mode_params contains a lookup table of all 802.3 link modes that are currently supported with structured data about each mode's speed, duplex, number of lanes and mediums. As a preparation for a port representation, export that table for the rest of the net stack to use. Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com> Link: https://patch.msgid.link/20250307173611.129125-2-maxime.chevallier@bootlin.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent 702e3fa commit 79f88a5

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

include/linux/ethtool.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,14 @@ static inline u8 *ethtool_rxfh_context_key(struct ethtool_rxfh_context *ctx)
210210

211211
void ethtool_rxfh_context_lost(struct net_device *dev, u32 context_id);
212212

213+
struct link_mode_info {
214+
int speed;
215+
u8 lanes;
216+
u8 duplex;
217+
};
218+
219+
extern const struct link_mode_info link_mode_params[];
220+
213221
/* declare a link mode bitmap */
214222
#define __ETHTOOL_DECLARE_LINK_MODE_MASK(name) \
215223
DECLARE_BITMAP(name, __ETHTOOL_LINK_MODE_MASK_NBITS)

net/ethtool/common.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,7 @@ const struct link_mode_info link_mode_params[] = {
424424
__DEFINE_LINK_MODE_PARAMS(800000, VR4, Full),
425425
};
426426
static_assert(ARRAY_SIZE(link_mode_params) == __ETHTOOL_LINK_MODE_MASK_NBITS);
427+
EXPORT_SYMBOL_GPL(link_mode_params);
427428

428429
const char netif_msg_class_names[][ETH_GSTRING_LEN] = {
429430
[NETIF_MSG_DRV_BIT] = "drv",

net/ethtool/common.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,6 @@
1515
#define __SOF_TIMESTAMPING_CNT (const_ilog2(SOF_TIMESTAMPING_LAST) + 1)
1616
#define __HWTSTAMP_FLAG_CNT (const_ilog2(HWTSTAMP_FLAG_LAST) + 1)
1717

18-
struct link_mode_info {
19-
int speed;
20-
u8 lanes;
21-
u8 duplex;
22-
};
23-
2418
struct genl_info;
2519
struct hwtstamp_provider_desc;
2620

@@ -33,7 +27,6 @@ tunable_strings[__ETHTOOL_TUNABLE_COUNT][ETH_GSTRING_LEN];
3327
extern const char
3428
phy_tunable_strings[__ETHTOOL_PHY_TUNABLE_COUNT][ETH_GSTRING_LEN];
3529
extern const char link_mode_names[][ETH_GSTRING_LEN];
36-
extern const struct link_mode_info link_mode_params[];
3730
extern const char netif_msg_class_names[][ETH_GSTRING_LEN];
3831
extern const char wol_mode_names[][ETH_GSTRING_LEN];
3932
extern const char sof_timestamping_names[][ETH_GSTRING_LEN];

0 commit comments

Comments
 (0)