net: enetc: kill PHY-less mode for PFs
Right now, a PHY-less port (no phy-mode, no fixed-link, no phy-handle)
doesn't register with phylink, but calls netif_carrier_on() from
enetc_start().
This makes sense for a VF, but for a PF, this is braindead, because we
never call enetc_mac_enable() so the MAC is left inoperational.
Furthermore, commit 71b77a7a27
("enetc: Migrate to PHYLINK and
PCS_LYNX") put the nail in the coffin because it removed the initial
netif_carrier_off() call done right after register_netdev().
Without that call, netif_carrier_on() does not call
linkwatch_fire_event(), so the operstate remains IF_OPER_UNKNOWN.
Just deny the broken configuration by requiring that a phy-mode is
present, and always register a PF with phylink.
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Link: https://lore.kernel.org/r/20220511094200.558502-1-vladimir.oltean@nxp.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
43213daed6
commit
0f84d403b8
|
@ -1105,7 +1105,6 @@ static int enetc_phylink_create(struct enetc_ndev_priv *priv,
|
||||||
|
|
||||||
static void enetc_phylink_destroy(struct enetc_ndev_priv *priv)
|
static void enetc_phylink_destroy(struct enetc_ndev_priv *priv)
|
||||||
{
|
{
|
||||||
if (priv->phylink)
|
|
||||||
phylink_destroy(priv->phylink);
|
phylink_destroy(priv->phylink);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1273,7 +1272,12 @@ static int enetc_pf_probe(struct pci_dev *pdev,
|
||||||
goto err_alloc_msix;
|
goto err_alloc_msix;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!of_get_phy_mode(node, &pf->if_mode)) {
|
err = of_get_phy_mode(node, &pf->if_mode);
|
||||||
|
if (err) {
|
||||||
|
dev_err(&pdev->dev, "Failed to read PHY mode\n");
|
||||||
|
goto err_phy_mode;
|
||||||
|
}
|
||||||
|
|
||||||
err = enetc_mdiobus_create(pf, node);
|
err = enetc_mdiobus_create(pf, node);
|
||||||
if (err)
|
if (err)
|
||||||
goto err_mdiobus_create;
|
goto err_mdiobus_create;
|
||||||
|
@ -1281,7 +1285,6 @@ static int enetc_pf_probe(struct pci_dev *pdev,
|
||||||
err = enetc_phylink_create(priv, node);
|
err = enetc_phylink_create(priv, node);
|
||||||
if (err)
|
if (err)
|
||||||
goto err_phylink_create;
|
goto err_phylink_create;
|
||||||
}
|
|
||||||
|
|
||||||
err = register_netdev(ndev);
|
err = register_netdev(ndev);
|
||||||
if (err)
|
if (err)
|
||||||
|
@ -1294,6 +1297,7 @@ err_reg_netdev:
|
||||||
err_phylink_create:
|
err_phylink_create:
|
||||||
enetc_mdiobus_destroy(pf);
|
enetc_mdiobus_destroy(pf);
|
||||||
err_mdiobus_create:
|
err_mdiobus_create:
|
||||||
|
err_phy_mode:
|
||||||
enetc_free_msix(priv);
|
enetc_free_msix(priv);
|
||||||
err_config_si:
|
err_config_si:
|
||||||
err_alloc_msix:
|
err_alloc_msix:
|
||||||
|
|
Loading…
Reference in New Issue