]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: phylink: allow attaching phy for SFP modules on 802.3z mode
authorMarek Behún <kabel@kernel.org>
Fri, 30 Sep 2022 14:21:06 +0000 (16:21 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 3 Oct 2022 10:08:33 +0000 (11:08 +0100)
Some SFPs may contain an internal PHY which may in some cases want to
connect with the host interface in 1000base-x/2500base-x mode.
Do not fail if such PHY is being attached in one of these PHY interface
modes.

Signed-off-by: Marek Behún <kabel@kernel.org>
Reviewed-by: Russell King <rmk+kernel@armlinux.org.uk>
Reviewed-by: Pali Rohár <pali@kernel.org>
Cc: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/phylink.c

index 9ff8eb5166664bf1b00755a7e0734b6ab14bfaa7..75464df191ef71dcb0ecb8870275f800f6b15e27 100644 (file)
@@ -1669,7 +1669,7 @@ static int phylink_attach_phy(struct phylink *pl, struct phy_device *phy,
 {
        if (WARN_ON(pl->cfg_link_an_mode == MLO_AN_FIXED ||
                    (pl->cfg_link_an_mode == MLO_AN_INBAND &&
-                    phy_interface_mode_is_8023z(interface))))
+                    phy_interface_mode_is_8023z(interface) && !pl->sfp_bus)))
                return -EINVAL;
 
        if (pl->phydev)
@@ -2918,9 +2918,6 @@ static int phylink_sfp_config_phy(struct phylink *pl, u8 mode,
                return ret;
        }
 
-       if (phy_interface_mode_is_8023z(iface) && pl->phydev)
-               return -EINVAL;
-
        pl->link_port = pl->sfp_port;
 
        phylink_sfp_set_config(pl, mode, support, &config);