From: Daniel Golle Date: Fri, 11 Oct 2024 03:42:09 +0000 (+0100) Subject: generic: net: phy: be more conservative about MAC interface selection X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=ee03a2742ba450409b9d82228064c08b1c35e800;p=openwrt%2Fstaging%2Fpepe2k.git generic: net: phy: be more conservative about MAC interface selection Only add SerDes interface modes at lower speeds to host_interfaces. Fixes: 5281033831 ("generic: net: phy: use all SerDes MAC interface modes") Signed-off-by: Daniel Golle --- diff --git a/target/linux/generic/pending-6.6/706-net-phy-populate-host_interfaces-when-attaching-PHY.patch b/target/linux/generic/pending-6.6/706-net-phy-populate-host_interfaces-when-attaching-PHY.patch index bd2d015b17..78e0049f05 100644 --- a/target/linux/generic/pending-6.6/706-net-phy-populate-host_interfaces-when-attaching-PHY.patch +++ b/target/linux/generic/pending-6.6/706-net-phy-populate-host_interfaces-when-attaching-PHY.patch @@ -1,4 +1,4 @@ -From 9e1a0d2006bc108b239b5bc00b42c2a8cc651217 Mon Sep 17 00:00:00 2001 +From 4e432e530db0056450fbc4a3cee793f16adc39a7 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Tue, 8 Oct 2024 23:58:41 +0100 Subject: [PATCH] net: phy: populate host_interfaces when attaching PHY @@ -15,18 +15,39 @@ full-duplex only. Signed-off-by: Daniel Golle --- - drivers/net/phy/phylink.c | 7 +++++++ - 1 file changed, 7 insertions(+) + drivers/net/phy/phylink.c | 21 ++++++++++++++++++++- + 1 file changed, 20 insertions(+), 1 deletion(-) --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c -@@ -2044,6 +2044,13 @@ int phylink_fwnode_phy_connect(struct ph +@@ -2017,7 +2017,7 @@ int phylink_fwnode_phy_connect(struct ph + { + struct fwnode_handle *phy_fwnode; + struct phy_device *phy_dev; +- int ret; ++ int i, ret; + + /* Fixed links and 802.3z are handled without needing a PHY */ + if (pl->cfg_link_an_mode == MLO_AN_FIXED || +@@ -2044,6 +2044,25 @@ int phylink_fwnode_phy_connect(struct ph pl->link_config.interface = pl->link_interface; } -+ /* Assume SerDes interface modes share the same lanes and allow -+ * the PHY to switch between them ++ /* Assume single-lane SerDes interface modes share the same ++ * lanes and allow the PHY to switch to slower also supported modes + */ ++ for (i = ARRAY_SIZE(phylink_sfp_interface_preference) - 1; i >= 0; i--) { ++ /* skip unsupported modes */ ++ if (!test_bit(phylink_sfp_interface_preference[i], pl->config->supported_interfaces)) ++ continue; ++ ++ __set_bit(phylink_sfp_interface_preference[i], phy_dev->host_interfaces); ++ ++ /* skip all faster modes */ ++ if (phylink_sfp_interface_preference[i] == pl->link_interface) ++ break; ++ } ++ + if (test_bit(pl->link_interface, phylink_sfp_interfaces)) + phy_interface_and(phy_dev->host_interfaces, phylink_sfp_interfaces, + pl->config->supported_interfaces);