realtek: pcs: avoid unneeded SerDes reconfiguration
authorJonas Jelonek <jelonek.jonas@gmail.com>
Sun, 25 Jan 2026 23:28:14 +0000 (23:28 +0000)
committerRobert Marko <robimarko@gmail.com>
Sun, 1 Feb 2026 10:47:25 +0000 (11:47 +0100)
commit66880d12c36b7b8f3f3407bbd120d82bc3ec4ea0
treefe44b4816f4192c1effbd646438b29cfb1b65bb5
parent356ceb43ec4886238ee1cc084b52b4d14863a50c
realtek: pcs: avoid unneeded SerDes reconfiguration

Avoid to reconfigure a SerDes when it has been configured for a mode
before. This usually applies to switches which drive multiple ports on a
single SerDes. For those, the phylink subsystem triggers PCS
configuration everytime although it's a single SerDes. For example, on
switches with XSGMII-connected RTL8218D the particular SerDes is
configured eight times but only a single run is needed.

Add a proper check to pcs_config which checks the mode stored in the
SerDes instance against the requested mode. Other 'settings' should be
executed though, e.g. setting autoneg. While at it, drop the check if
there is a 'setup_serdes' implementation. It's just a driver-internal
interface and all variants implement this now.

Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21763
Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c