Skip to content

Commit 6fd5eee

Browse files
committed
Merge branch 'support-setting-lanes-via-ethtool'
Danielle Ratson says: ==================== Support setting lanes via ethtool Some speeds can be achieved with different number of lanes. For example, 100Gbps can be achieved using two lanes of 50Gbps or four lanes of 25Gbps. This patchset adds a new selector that allows ethtool to advertise link modes according to their number of lanes and also force a specific number of lanes when autonegotiation is off. Advertising all link modes with a speed of 100Gbps that use two lanes: $ ethtool -s swp1 speed 100000 lanes 2 autoneg on Forcing a speed of 100Gbps using four lanes: $ ethtool -s swp1 speed 100000 lanes 4 autoneg off ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 99b8202 + f72e2f4 commit 6fd5eee

File tree

13 files changed

+626
-231
lines changed

13 files changed

+626
-231
lines changed

Documentation/networking/ethtool-netlink.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -431,16 +431,17 @@ Request contents:
431431
``ETHTOOL_A_LINKMODES_SPEED`` u32 link speed (Mb/s)
432432
``ETHTOOL_A_LINKMODES_DUPLEX`` u8 duplex mode
433433
``ETHTOOL_A_LINKMODES_MASTER_SLAVE_CFG`` u8 Master/slave port mode
434+
``ETHTOOL_A_LINKMODES_LANES`` u32 lanes
434435
========================================== ====== ==========================
435436

436437
``ETHTOOL_A_LINKMODES_OURS`` bit set allows setting advertised link modes. If
437438
autonegotiation is on (either set now or kept from before), advertised modes
438439
are not changed (no ``ETHTOOL_A_LINKMODES_OURS`` attribute) and at least one
439-
of speed and duplex is specified, kernel adjusts advertised modes to all
440-
supported modes matching speed, duplex or both (whatever is specified). This
441-
autoselection is done on ethtool side with ioctl interface, netlink interface
442-
is supposed to allow requesting changes without knowing what exactly kernel
443-
supports.
440+
of speed, duplex and lanes is specified, kernel adjusts advertised modes to all
441+
supported modes matching speed, duplex, lanes or all (whatever is specified).
442+
This autoselection is done on ethtool side with ioctl interface, netlink
443+
interface is supposed to allow requesting changes without knowing what exactly
444+
kernel supports.
444445

445446

446447
LINKSTATE_GET

drivers/net/ethernet/mellanox/mlxsw/spectrum.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -328,15 +328,16 @@ struct mlxsw_sp_port_type_speed_ops {
328328
u32 ptys_eth_proto,
329329
struct ethtool_link_ksettings *cmd);
330330
void (*from_ptys_link)(struct mlxsw_sp *mlxsw_sp, u32 ptys_eth_proto,
331-
u8 width, unsigned long *mode);
331+
unsigned long *mode);
332332
u32 (*from_ptys_speed)(struct mlxsw_sp *mlxsw_sp, u32 ptys_eth_proto);
333-
void (*from_ptys_speed_duplex)(struct mlxsw_sp *mlxsw_sp,
334-
bool carrier_ok, u32 ptys_eth_proto,
335-
struct ethtool_link_ksettings *cmd);
333+
void (*from_ptys_link_mode)(struct mlxsw_sp *mlxsw_sp,
334+
bool carrier_ok, u32 ptys_eth_proto,
335+
struct ethtool_link_ksettings *cmd);
336336
int (*ptys_max_speed)(struct mlxsw_sp_port *mlxsw_sp_port, u32 *p_max_speed);
337-
u32 (*to_ptys_advert_link)(struct mlxsw_sp *mlxsw_sp, u8 width,
337+
u32 (*to_ptys_advert_link)(struct mlxsw_sp *mlxsw_sp,
338+
const struct ethtool_link_ksettings *cmd);
339+
u32 (*to_ptys_speed_lanes)(struct mlxsw_sp *mlxsw_sp, u8 width,
338340
const struct ethtool_link_ksettings *cmd);
339-
u32 (*to_ptys_speed)(struct mlxsw_sp *mlxsw_sp, u8 width, u32 speed);
340341
void (*reg_ptys_eth_pack)(struct mlxsw_sp *mlxsw_sp, char *payload,
341342
u8 local_port, u32 proto_admin, bool autoneg);
342343
void (*reg_ptys_eth_unpack)(struct mlxsw_sp *mlxsw_sp, char *payload,

0 commit comments

Comments
 (0)