Skip to content

Commit ef8d739

Browse files
minimaxwellgregkh
authored andcommitted
net: phy: don't try to setup PHY-driven SFP cages when using genphy
[ Upstream commit 5a0082e ] We don't have support for PHY-driver SFP cages with the genphy code. On top of that, it was found by sashiko that running sfp_bus_add_upstream() for genphy deadlocks, as for genphy the PHY probing runs under RTNL, which isn't the case for non-genphy drivers. This problem was reproduced, and does lead to a deadlock on RTNL. Before the blamed commit, the phy_sfp_probe() call was made by individual PHY drivers, so there was no way to get to the SFP probing path when using genphy. Let's therefore only run phy_sfp_probe when not using genphy. Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de> Fixes: bad869b ("net: phy: Only rely on phy_port for PHY-driven SFP") Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com> Link: https://patch.msgid.link/20260604092819.723505-5-maxime.chevallier@bootlin.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 0198917 commit ef8d739

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

drivers/net/phy/phy_device.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3528,9 +3528,15 @@ static int phy_setup_ports(struct phy_device *phydev)
35283528
if (ret)
35293529
return ret;
35303530

3531-
ret = phy_sfp_probe(phydev);
3532-
if (ret)
3533-
goto out;
3531+
/* We don't support SFP with genphy drivers. Also, genphy driver
3532+
* binding occurs with RTNL help, which will deadlock the call to
3533+
* sfp_bus_add_upstream().
3534+
*/
3535+
if (!phydev->is_genphy_driven) {
3536+
ret = phy_sfp_probe(phydev);
3537+
if (ret)
3538+
goto out;
3539+
}
35343540

35353541
if (phydev->n_ports < phydev->max_n_ports) {
35363542
ret = phy_default_setup_single_port(phydev);

0 commit comments

Comments
 (0)