[PATCH RFC net-next 0/8] net: phylink: introduce legacy mode flag

Russell King (Oracle) linux at armlinux.org.uk
Tue Nov 23 01:52:52 PST 2021


Hi all,

In March 2020, phylink gained support to split the PCS support out of
the MAC callbacks. By doing so, a slight behavioural difference was
introduced when a PCS is present, specifically:

1) the call to mac_config() when the link comes up or advertisement
   changes were eliminated
2) mac_an_restart() will never be called
3) mac_pcs_get_state() will never be called

The intention was to eventually remove this support once all phylink
users were converted. Unfortunately, this still hasn't happened - and
in some cases, it looks like it may never happen.

Through discussion with Sean Anderson, we now need to allow the PCS to
be optional for modern drivers, so we need a different way to identify
these legacy drivers.

In order to do that, this series of patches introduce a
"legacy_pre_march2020" which is used to allow the old behaviour - in
other words, we get the old behaviour only when there is no PCS and
this flag is true. Otherwise, we get the new behaviour.

I decided to use the date of the change in the flag as just using
"legacy" or "legacy_driver" is too non-descript. An alternative could
be to use the git sha1 hash of the set of changes.

As part of this series, I have consolidated DSA's phylink creation, so
only one place needs maintenance. This reduces the size of subsequent
changes, including further changes I have lined up.

I believe I have added the legacy flag to all the drivers which use
legacy mode - that being the ag71xx, mtk_eth_soc and axienet ethernet
drivers, and many DSA drivers - the ones which need the old behaviour
are identified by having non-NULL phylink_mac_link_state or
phylink_mac_an_restart methods in their dsa_switch_ops structure.

 drivers/net/ethernet/atheros/ag71xx.c             |  1 +
 drivers/net/ethernet/mediatek/mtk_eth_soc.c       |  4 ++
 drivers/net/ethernet/xilinx/xilinx_axienet_main.c |  1 +
 drivers/net/phy/phylink.c                         | 32 +++++++++-----
 include/linux/phylink.h                           | 20 +++++++++
 net/dsa/dsa_priv.h                                |  2 +-
 net/dsa/port.c                                    | 51 ++++++++++++++++-------
 net/dsa/slave.c                                   | 19 ++-------
 8 files changed, 86 insertions(+), 44 deletions(-)

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!



More information about the linux-arm-kernel mailing list