From 3cae73118ebbcfc2f5ebe8df37479b7c12d346f3 Mon Sep 17 00:00:00 2001 From: Andrew Gallatin Date: Wed, 6 Apr 2011 15:45:32 +0000 Subject: [PATCH] Implement mxge_init() This fixes a long standing bug in mxge(4) where "ifconfig mxge0 $IP" did not bring the interface into a RUNNING state, like it does on most (all?) other FreeBSD NIC drivers. Thanks to gnn for mentioning the bug, and yongari for pointing out that ether_ioctl() invokes ifp->if_init() in SIOCSIFADDR. MFC after: 7 days --- sys/dev/mxge/if_mxge.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/dev/mxge/if_mxge.c b/sys/dev/mxge/if_mxge.c index 6e6d6499700..f6164d011d6 100644 --- a/sys/dev/mxge/if_mxge.c +++ b/sys/dev/mxge/if_mxge.c @@ -3054,6 +3054,14 @@ mxge_intr(void *arg) static void mxge_init(void *arg) { + mxge_softc_t *sc = arg; + struct ifnet *ifp = sc->ifp; + + + mtx_lock(&sc->driver_mtx); + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + (void) mxge_open(sc); + mtx_unlock(&sc->driver_mtx); }