diff options
author | brooks <brooks@FreeBSD.org> | 2008-05-17 03:38:13 +0000 |
---|---|---|
committer | brooks <brooks@FreeBSD.org> | 2008-05-17 03:38:13 +0000 |
commit | 926e3bf55c7193f9b0f6aaea6f0b4dc716c112f9 (patch) | |
tree | 9a7d31aac19a1ee7ab08078076d29569734f4d74 /sys/net/if.c | |
parent | 5fc855b6601b7f44ad716a84808499900f2f3cfd (diff) | |
download | FreeBSD-src-926e3bf55c7193f9b0f6aaea6f0b4dc716c112f9.zip FreeBSD-src-926e3bf55c7193f9b0f6aaea6f0b4dc716c112f9.tar.gz |
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().
Diffstat (limited to 'sys/net/if.c')
-rw-r--r-- | sys/net/if.c | 38 |
1 files changed, 10 insertions, 28 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index 85306a4..f124e7e 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; |