openwrt / netifd

[MIRROR] OpenWrt Network interface configuration daemon
https://git.openwrt.org/?p=project/netifd.git;
17 stars 19 forks source link

system-linux: switch to new ETHTOOL_xLINKSETTINGS API #9

Closed dangowrt closed 1 year ago

dangowrt commented 1 year ago

This work is based on https://github.com/openwrt/netifd/pull/2 and has been largely improved, completely dropping support for the legacy API.

ETHTOOL_GSET / ETHTOOL_SSET API is deprecated since Linux v5.2 released in 2016, see torvalds/linux@3f1ac7a700d03. All still maintained OpenWrt versions use kernel versions new enough to support the new API.

Hence migrate to ETHTOOL_xLINKSETTINGS API to handle auto-negotiation for flow-control as well as higher bandwidth like 2.5G, 5G, 10G, ...

Instead of hard-coding the supported modes, generate a header file during build describing them from <linux/ethtool.h>.

dangowrt commented 1 year ago

Maybe I should consider a build-time option to limit the generated modes by maximum speed, so the binary on platforms any only supporting 1G won't grow. On the other hand, even on platforms supporting only 1G the PHY might be able to indicate link partner speed abilities beyond 1G (but it's rather rare, and do we care?).

robimarko commented 1 year ago

I can confirm that this finally allows 2500Base-T to be advertised on Qnap 301W. Tested-by: Robert Marko <robimarko@gmail.com>