Skip to content

Add ethtool extended link state

Ido Schimmel netdev 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest10 patches 1 replyIn review
  2. v110 patches 5 repliesSuperseded

Changes in v2 from the cover letter

* In documentation, show ETHTOOL_LINK_EXT_STATE_* and ETHTOOL_LINK_EXT_SUBSTATE_* constants instead of user-space strings
* Add _CI_ to cable_issue substates to be consistent with other substates
* Keep the commit messages within 75 columns
* Use u8 variable for __link_ext_substate
* Document the meaning of -ENODATA in get_link_ext_state() callback description
* Do not zero data->link_ext_state_provided after getting an error
* Use ret variable for error value

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10mlxsw: spectrum_dcb: Rename mlxsw_sp_port_headroom_set()drivers/net/ethernet/mellanox/mlxsw/spectrum_dcb.c+3 -30 replies
2/10mlxsw: Move ethtool_ops to spectrum_ethtool.cdrivers/net/ethernet/mellanox/mlxsw/Makefile drivers/net/ethernet/mellanox/mlxsw/spectrum.c drivers/net/ethernet/mellanox/mlxsw/spectrum.h +1 more+892 -8750 replies
3/10mlxsw: spectrum_ethtool: Move mlxsw_sp_port_type_speed_ops structsdrivers/net/ethernet/mellanox/mlxsw/spectrum.c drivers/net/ethernet/mellanox/mlxsw/spectrum.h drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c+660 -6600 replies
4/10Documentation: networking: ethtool-netlink: Add link extended stateDocumentation/networking/ethtool-netlink.rst+124 -40 replies
5/10ethtool: Add link extended stateinclude/linux/ethtool.h include/uapi/linux/ethtool.h include/uapi/linux/ethtool_netlink.h +1 more+143 -40 replies
6/10mlxsw: reg: Port Diagnostics Database Registerdrivers/net/ethernet/mellanox/mlxsw/reg.h+51 -00 replies
7/10mlxsw: spectrum_ethtool: Add link extended statedrivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c+145 -00 replies
8/10selftests: forwarding: ethtool: Move different_speeds_get() to ethtool_libtools/testing/selftests/net/forwarding/ethtool.sh tools/testing/selftests/net/forwarding/ethtool_lib.sh+17 -170 replies
9/10selftests: forwarding: forwarding.config.sample: Add port with no cable connectedtools/testing/selftests/net/forwarding/forwarding.config.sample+3 -00 replies
10/10selftests: forwarding: Add tests for ethtool extended statetools/testing/selftests/net/forwarding/ethtool_extended_state.sh+102 -00 replies

Reviews trailers per patch

All 10 patches have a Reviewed-by or Acked-by.

PatchPetr MachataJiri PirkoFlorian FainelliJacob Keller
1/10R-b R-b R-b
2/10R-b R-b R-b
3/10R-b R-b R-b
4/10R-b R-b R-b
5/10R-b R-b
6/10R-b R-b
7/10R-b
8/10R-b R-b
9/10R-b R-b
10/10R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v2 thread

Cover letter [PATCH net-next v2 00/10] Add ethtool extended link state

From: Ido Schimmel <[email protected]>

Amit says:

Currently, device drivers can only indicate to user space if the network link is up or down, without additional information.

This patch set provides an infrastructure that allows these drivers to expose more information to user space about the link state. The information can save users' time when trying to understand why a link is not operationally up, for example.

The above is achieved by extending the existing ethtool LINKSTATE_GET command with attributes that carry the extended state.

For example, no link due to missing cable:

$ ethtool ethX
...
Link detected: no (No cable)

Beside the general extended state, drivers can pass additional information about the link state using the sub-state field. For example:

$ ethtool ethX
...
Link detected: no (Autoneg, No partner detected)

In the future the infrastructure can be extended - for example - to allow PHY drivers to report whether a downshift to a lower speed occurred. Something like:

$ ethtool ethX
...
Link detected: yes (downshifted)

Patch set overview:

Patches #1-#3 move mlxsw ethtool code to a separate file Patches #4-#5 add the ethtool infrastructure for extended link state Patches #6-#7 add support of extended link state in the mlxsw driver Patches #8-#10 add test cases

Changes since v1:

* In documentation, show ETHTOOL_LINK_EXT_STATE_* and ETHTOOL_LINK_EXT_SUBSTATE_* constants instead of user-space strings
* Add _CI_ to cable_issue substates to be consistent with other substates
* Keep the commit messages within 75 columns
* Use u8 variable for __link_ext_substate
* Document the meaning of -ENODATA in get_link_ext_state() callback description
* Do not zero data->link_ext_state_provided after getting an error
* Use ret variable for error value

Changes since RFC:

* Move documentation patch before ethtool patch
* Add nla_total_size() instead of sizeof() directly
* Return an error code from linkstate_get_ext_state()
* Remove SHORTED_CABLE, add CABLE_TEST_FAILURE instead
* Check if the interface is administratively up before setting ext_state
* Document all sub-states

Amit Cohen (10):
mlxsw: spectrum_dcb: Rename mlxsw_sp_port_headroom_set()
mlxsw: Move ethtool_ops to spectrum_ethtool.c
mlxsw: spectrum_ethtool: Move mlxsw_sp_port_type_speed_ops structs
Documentation: networking: ethtool-netlink: Add link extended state
ethtool: Add link extended state
mlxsw: reg: Port Diagnostics Database Register
mlxsw: spectrum_ethtool: Add link extended state
selftests: forwarding: ethtool: Move different_speeds_get() to
ethtool_lib
selftests: forwarding: forwarding.config.sample: Add port with no
cable connected
selftests: forwarding: Add tests for ethtool extended state

 Documentation/networking/ethtool-netlink.rst  |  128 +-
 drivers/net/ethernet/mellanox/mlxsw/Makefile  |    3 +-
 drivers/net/ethernet/mellanox/mlxsw/reg.h     |   51 +
 .../net/ethernet/mellanox/mlxsw/spectrum.c    | 1540 +--------------
 .../net/ethernet/mellanox/mlxsw/spectrum.h    |   45 +
 .../ethernet/mellanox/mlxsw/spectrum_dcb.c    |    6 +-
 .../mellanox/mlxsw/spectrum_ethtool.c         | 1644 +++++++++++++++++
 include/linux/ethtool.h                       |   23 +
 include/uapi/linux/ethtool.h                  |   70 +
 include/uapi/linux/ethtool_netlink.h          |    2 +
 net/ethtool/linkstate.c                       |   52 +-
 .../selftests/net/forwarding/ethtool.sh       |   17 -
 .../net/forwarding/ethtool_extended_state.sh  |  102 +
 .../selftests/net/forwarding/ethtool_lib.sh   |   17 +
 .../net/forwarding/forwarding.config.sample   |    3 +
 15 files changed, 2140 insertions(+), 1563 deletions(-)
 create mode 100644 drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c
 create mode 100755 tools/testing/selftests/net/forwarding/ethtool_extended_state.sh
Signature · 1 line
2.26.2