aboutsummaryrefslogtreecommitdiff
path: root/sys/net/if.c
diff options
context:
space:
mode:
authorBrooks Davis <brooks@FreeBSD.org>2008-05-17 03:38:13 +0000
committerBrooks Davis <brooks@FreeBSD.org>2008-05-17 03:38:13 +0000
commitd94ccb096b76ddbb8438fb25688921d50b36f9c1 (patch)
tree9a7d31aac19a1ee7ab08078076d29569734f4d74 /sys/net/if.c
parentb8915e90a27946bcfdbe54971a748ff966bbbf14 (diff)
downloadsrc-d94ccb096b76ddbb8438fb25688921d50b36f9c1.tar.gz
src-d94ccb096b76ddbb8438fb25688921d50b36f9c1.zip
The if_check() function performed three actions:
- verified that the ifp->if_snd.ifq_mtx was initalized for all attached interfaces. This was pointless because it was initalized for all interfaces in if_attach() so I've removed it. - Checked that ifp->if_snd.ifq_maxlen is initalized and set it to ifqmaxlen if unset. This makes more sense in if_attach() so I moved it there. - The first call of if_slowtimo(). Delete if_check() and call if_slowtimo() directly from the SYSINIT().
Notes
Notes: svn path=/head/; revision=179066
Diffstat (limited to 'sys/net/if.c')
-rw-r--r--sys/net/if.c38
1 files changed, 10 insertions, 28 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 85306a4fcfab..f124e7e74960 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -111,7 +111,6 @@ static int ifconf(u_long, caddr_t);
static void if_freemulti(struct ifmultiaddr *);
static void if_grow(void);
static void if_init(void *);
-static void if_check(void *);
static void if_qflush(struct ifaltq *);
static void if_route(struct ifnet *, int flag, int fam);
static int if_setflag(struct ifnet *, int, int, int *, int);
@@ -155,7 +154,7 @@ static struct filterops netdev_filtops =
* System initialization
*/
SYSINIT(interfaces, SI_SUB_INIT_IF, SI_ORDER_FIRST, if_init, NULL);
-SYSINIT(interface_check, SI_SUB_PROTO_IF, SI_ORDER_FIRST, if_check, NULL);
+SYSINIT(interface_check, SI_SUB_PROTO_IF, SI_ORDER_FIRST, if_slowtimo, NULL);
MALLOC_DEFINE(M_IFNET, "ifnet", "interface internals");
MALLOC_DEFINE(M_IFADDR, "ifaddr", "interface address");
@@ -320,32 +319,6 @@ if_grow(void)
ifindex_table = e;
}
-/* ARGSUSED*/
-static void
-if_check(void *dummy __unused)
-{
- struct ifnet *ifp;
- int s;
-
- s = splimp();
- IFNET_RLOCK(); /* could sleep on rare error; mostly okay XXX */
- TAILQ_FOREACH(ifp, &ifnet, if_link) {
- if (ifp->if_snd.ifq_maxlen == 0) {
- if_printf(ifp, "XXX: driver didn't set ifq_maxlen\n");
- ifp->if_snd.ifq_maxlen = ifqmaxlen;
- }
- if (!mtx_initialized(&ifp->if_snd.ifq_mtx)) {
- if_printf(ifp,
- "XXX: driver didn't initialize queue mtx\n");
- mtx_init(&ifp->if_snd.ifq_mtx, "unknown",
- MTX_NETWORK_LOCK, MTX_DEF);
- }
- }
- IFNET_RUNLOCK();
- splx(s);
- if_slowtimo(0);
-}
-
/*
* Allocate a struct ifnet and an index for an interface. A layer 2
* common structure will also be allocated if an allocation routine is
@@ -525,6 +498,15 @@ if_attach(struct ifnet *ifp)
ifa->ifa_refcnt = 1;
TAILQ_INSERT_HEAD(&ifp->if_addrhead, ifa, ifa_link);
ifp->if_broadcastaddr = NULL; /* reliably crash if used uninitialized */
+
+ /*
+ * XXX: why do we warn about this? We're correcting it and most
+ * drivers just set the value the way we do.
+ */
+ if (ifp->if_snd.ifq_maxlen == 0) {
+ if_printf(ifp, "XXX: driver didn't set ifq_maxlen\n");
+ ifp->if_snd.ifq_maxlen = ifqmaxlen;
+ }
ifp->if_snd.altq_type = 0;
ifp->if_snd.altq_disc = NULL;
ifp->if_snd.altq_flags &= ALTQF_CANTCHANGE;