From 8b4fc7299f2f63fdb3ed646bbed861ebd732ff61 Mon Sep 17 00:00:00 2001 From: kmacy Date: Thu, 20 Mar 2008 05:35:02 +0000 Subject: Don't re-initialize the interface if it is already running. This one line change makes the following code found in many ethernet device drivers (at least em, igb, ixgbe, and cxgb) gratuitous case SIOCSIFADDR: if (ifa->ifa_addr->sa_family == AF_INET) { /* * XXX * Since resetting hardware takes a very long time * and results in link renegotiation we only * initialize the hardware only when it is absolutely * required. */ ifp->if_flags |= IFF_UP; if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { EM_CORE_LOCK(adapter); em_init_locked(adapter); EM_CORE_UNLOCK(adapter); } arp_ifinit(ifp, ifa); } else error = ether_ioctl(ifp, command, data); break; --- sys/net/if_ethersubr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sys/net') diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index d18d422..6964248 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -1020,7 +1020,8 @@ ether_ioctl(struct ifnet *ifp, u_long command, caddr_t data) switch (ifa->ifa_addr->sa_family) { #ifdef INET case AF_INET: - ifp->if_init(ifp->if_softc); /* before arpwhohas */ + if (!(ifp->if_flags & IFF_DRV_RUNNING)) + ifp->if_init(ifp->if_softc); /* before arpwhohas */ arp_ifinit(ifp, ifa); break; #endif -- cgit v1.1