Initialize the ifnet before calling mii_phy_probe() as some phy drivers

(e.g. e1000phy(4)) expect if_dname to be valid when they are probed.

MFC after:	3 days
This commit is contained in:
John Baldwin 2010-01-27 14:43:28 +00:00
parent bcc7f0f408
commit 47a933e3df

View File

@ -526,14 +526,6 @@ nve_attach(device_t dev)
goto fail;
}
/* Probe device for MII interface to PHY */
DEBUGOUT(NVE_DEBUG_INIT, "nve: do mii_phy_probe\n");
if (mii_phy_probe(dev, &sc->miibus, nve_ifmedia_upd, nve_ifmedia_sts)) {
device_printf(dev, "MII without any phy!\n");
error = ENXIO;
goto fail;
}
/* Setup interface parameters */
ifp->if_softc = sc;
if_initname(ifp, device_get_name(dev), device_get_unit(dev));
@ -549,6 +541,14 @@ nve_attach(device_t dev)
ifp->if_capabilities |= IFCAP_VLAN_MTU;
ifp->if_capenable |= IFCAP_VLAN_MTU;
/* Probe device for MII interface to PHY */
DEBUGOUT(NVE_DEBUG_INIT, "nve: do mii_phy_probe\n");
if (mii_phy_probe(dev, &sc->miibus, nve_ifmedia_upd, nve_ifmedia_sts)) {
device_printf(dev, "MII without any phy!\n");
error = ENXIO;
goto fail;
}
/* Attach to OS's managers. */
ether_ifattach(ifp, eaddr);