summaryrefslogtreecommitdiffstats
path: root/sys/dev/re
diff options
context:
space:
mode:
authoryongari <yongari@FreeBSD.org>2009-11-19 23:12:44 +0000
committeryongari <yongari@FreeBSD.org>2009-11-19 23:12:44 +0000
commitb3aef05c86fc82ae0918fdc48e30725bddd83da6 (patch)
tree161742f9f8e176c3464bbc3c9735a914cc1701a2 /sys/dev/re
parent5b747869cea58ac47587b51889a10b0247b7a334 (diff)
downloadFreeBSD-src-b3aef05c86fc82ae0918fdc48e30725bddd83da6.zip
FreeBSD-src-b3aef05c86fc82ae0918fdc48e30725bddd83da6.tar.gz
Minimize interface reinitialization by checking IFF_DRV_RUNNING
flag. This fixes unnecessary interface UP/DOWNs during getting an IP address via DHCP. Tested by: Warren Block ( wblock<> wonkity dot com )
Diffstat (limited to 'sys/dev/re')
-rw-r--r--sys/dev/re/if_re.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/sys/dev/re/if_re.c b/sys/dev/re/if_re.c
index 25d189b..ed2b449 100644
--- a/sys/dev/re/if_re.c
+++ b/sys/dev/re/if_re.c
@@ -753,6 +753,7 @@ re_diag(struct rl_softc *sc)
ifp->if_flags |= IFF_PROMISC;
sc->rl_testmode = 1;
+ ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
re_init_locked(sc);
sc->rl_flags |= RL_FLAG_LINK;
if (sc->rl_type == RL_8169)
@@ -2145,8 +2146,10 @@ re_poll_locked(struct ifnet *ifp, enum poll_cmd cmd, int count)
* XXX check behaviour on receiver stalls.
*/
- if (status & RL_ISR_SYSTEM_ERR)
+ if (status & RL_ISR_SYSTEM_ERR) {
+ ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
re_init_locked(sc);
+ }
}
return (rx_npkts);
}
@@ -2222,8 +2225,10 @@ re_int_task(void *arg, int npending)
RL_ISR_TX_ERR|RL_ISR_TX_DESC_UNAVAIL))
re_txeof(sc);
- if (status & RL_ISR_SYSTEM_ERR)
+ if (status & RL_ISR_SYSTEM_ERR) {
+ ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
re_init_locked(sc);
+ }
if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
taskqueue_enqueue_fast(taskqueue_fast, &sc->rl_txtask);
@@ -2539,6 +2544,9 @@ re_init_locked(struct rl_softc *sc)
mii = device_get_softc(sc->rl_miibus);
+ if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
+ return;
+
/*
* Cancel pending I/O and free all RX/TX buffers.
*/
@@ -2793,7 +2801,8 @@ re_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
case SIOCADDMULTI:
case SIOCDELMULTI:
RL_LOCK(sc);
- re_set_rxmode(sc);
+ if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
+ re_set_rxmode(sc);
RL_UNLOCK(sc);
break;
case SIOCGIFMEDIA:
@@ -2862,8 +2871,10 @@ re_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
if ((mask & IFCAP_WOL_MAGIC) != 0)
ifp->if_capenable ^= IFCAP_WOL_MAGIC;
}
- if (reinit && ifp->if_drv_flags & IFF_DRV_RUNNING)
+ if (reinit && ifp->if_drv_flags & IFF_DRV_RUNNING) {
+ ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
re_init(sc);
+ }
VLAN_CAPABILITIES(ifp);
}
break;
@@ -2899,6 +2910,7 @@ re_watchdog(struct rl_softc *sc)
ifp->if_oerrors++;
re_rxeof(sc, NULL);
+ ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
re_init_locked(sc);
if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
taskqueue_enqueue_fast(taskqueue_fast, &sc->rl_txtask);
OpenPOWER on IntegriCloud