tbr_timeout() is a timer driven function[1]. While the previous commit

made LINT happy this does the proper looping over all vnets as we are
only called `globally' and not once per vnet instance.

Reported by:	zec [1]
Missed by:	bz  [1] in r192264
Reviewed by:	zec
This commit is contained in:
bz 2009-05-18 01:05:09 +00:00
parent db51d624ff
commit b0401160b1

View File

@ -454,7 +454,9 @@ static void
tbr_timeout(arg) tbr_timeout(arg)
void *arg; void *arg;
{ {
INIT_VNET_NET(curvnet); #if defined(__FreeBSD__)
VNET_ITERATOR_DECL(vnet_iter);
#endif
struct ifnet *ifp; struct ifnet *ifp;
int active, s; int active, s;
@ -466,16 +468,25 @@ tbr_timeout(arg)
#endif #endif
#if defined(__FreeBSD__) && (__FreeBSD_version >= 500000) #if defined(__FreeBSD__) && (__FreeBSD_version >= 500000)
IFNET_RLOCK(); IFNET_RLOCK();
VNET_LIST_RLOCK();
VNET_FOREACH(vnet_iter) {
CURVNET_SET(vnet_iter);
INIT_VNET_NET(vnet_iter);
#endif #endif
for (ifp = TAILQ_FIRST(&V_ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list)) { for (ifp = TAILQ_FIRST(&V_ifnet); ifp;
/* read from if_snd unlocked */ ifp = TAILQ_NEXT(ifp, if_list)) {
if (!TBR_IS_ENABLED(&ifp->if_snd)) /* read from if_snd unlocked */
continue; if (!TBR_IS_ENABLED(&ifp->if_snd))
active++; continue;
if (!IFQ_IS_EMPTY(&ifp->if_snd) && ifp->if_start != NULL) active++;
(*ifp->if_start)(ifp); if (!IFQ_IS_EMPTY(&ifp->if_snd) &&
} ifp->if_start != NULL)
(*ifp->if_start)(ifp);
}
#if defined(__FreeBSD__) && (__FreeBSD_version >= 500000) #if defined(__FreeBSD__) && (__FreeBSD_version >= 500000)
CURVNET_RESTORE();
}
VNET_LIST_RUNLOCK();
IFNET_RUNLOCK(); IFNET_RUNLOCK();
#endif #endif
splx(s); splx(s);