aboutsummaryrefslogtreecommitdiff
path: root/sys/contrib
diff options
context:
space:
mode:
authorBjoern A. Zeeb <bz@FreeBSD.org>2009-05-18 01:05:09 +0000
committerBjoern A. Zeeb <bz@FreeBSD.org>2009-05-18 01:05:09 +0000
commitce9237f1b2b10c07dd85195269a91e3499680e21 (patch)
tree776bdce750a0647a4d3fc4c02321b1fb2db2b043 /sys/contrib
parente9d57f2fd16a94d3c1d35f032aaa6893322dde02 (diff)
downloadsrc-ce9237f1b2b10c07dd85195269a91e3499680e21.tar.gz
src-ce9237f1b2b10c07dd85195269a91e3499680e21.zip
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
Notes
Notes: svn path=/head/; revision=192278
Diffstat (limited to 'sys/contrib')
-rw-r--r--sys/contrib/altq/altq/altq_subr.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/sys/contrib/altq/altq/altq_subr.c b/sys/contrib/altq/altq/altq_subr.c
index 6febbabf511d..17557c130719 100644
--- a/sys/contrib/altq/altq/altq_subr.c
+++ b/sys/contrib/altq/altq/altq_subr.c
@@ -454,7 +454,9 @@ static void
tbr_timeout(arg)
void *arg;
{
- INIT_VNET_NET(curvnet);
+#if defined(__FreeBSD__)
+ VNET_ITERATOR_DECL(vnet_iter);
+#endif
struct ifnet *ifp;
int active, s;
@@ -466,16 +468,25 @@ tbr_timeout(arg)
#endif
#if defined(__FreeBSD__) && (__FreeBSD_version >= 500000)
IFNET_RLOCK();
-#endif
- for (ifp = TAILQ_FIRST(&V_ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list)) {
- /* read from if_snd unlocked */
- if (!TBR_IS_ENABLED(&ifp->if_snd))
- continue;
- active++;
- if (!IFQ_IS_EMPTY(&ifp->if_snd) && ifp->if_start != NULL)
- (*ifp->if_start)(ifp);
- }
+ VNET_LIST_RLOCK();
+ VNET_FOREACH(vnet_iter) {
+ CURVNET_SET(vnet_iter);
+ INIT_VNET_NET(vnet_iter);
+#endif
+ for (ifp = TAILQ_FIRST(&V_ifnet); ifp;
+ ifp = TAILQ_NEXT(ifp, if_list)) {
+ /* read from if_snd unlocked */
+ if (!TBR_IS_ENABLED(&ifp->if_snd))
+ continue;
+ active++;
+ if (!IFQ_IS_EMPTY(&ifp->if_snd) &&
+ ifp->if_start != NULL)
+ (*ifp->if_start)(ifp);
+ }
#if defined(__FreeBSD__) && (__FreeBSD_version >= 500000)
+ CURVNET_RESTORE();
+ }
+ VNET_LIST_RUNLOCK();
IFNET_RUNLOCK();
#endif
splx(s);