hyperv/hn: Move if_initname to an earlier place

So that functions shared w/ attach path could use if_printf().

While I'm here, remove unnecessary if_dunit and if_dname assignment.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5576
This commit is contained in:
Sepherosa Ziehau 2016-03-10 02:13:42 +00:00
parent 34d4518209
commit 431b98ddc3

View File

@ -436,6 +436,7 @@ netvsc_attach(device_t dev)
ifp = sc->hn_ifp = if_alloc(IFT_ETHER);
ifp->if_softc = sc;
if_initname(ifp, device_get_name(dev), device_get_unit(dev));
ring_cnt = hn_ring_cnt;
if (ring_cnt <= 0 || ring_cnt >= mp_ncpus)
@ -466,10 +467,6 @@ netvsc_attach(device_t dev)
sc->hn_tx_ring[0].hn_chan = chan;
vmbus_channel_cpu_set(chan, sc->hn_cpu);
if_initname(ifp, device_get_name(dev), device_get_unit(dev));
ifp->if_dunit = unit;
ifp->if_dname = NETVSC_DEVNAME;
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
ifp->if_ioctl = hn_ioctl;
ifp->if_init = hn_ifinit;