Remove IFF_NEEDSGIANT, a compatibility infrastructure introduced
in FreeBSD 5.x to allow network device drivers to run with Giant despite the network stack being Giant-free. This significantly simplifies calls into ioctl() on network interfaces, especially in the multicast code, as well as eliminates deferred invocation of interface if_start routines. Disable the build on device drivers still depending on IFF_NEEDSGIANT as they no longer compile. They will be removed in a few weeks if they haven't been made MPSAFE in that time. Disabled drivers: if_ar if_axe if_aue if_cdce if_cue if_kue if_ray if_rue if_rum if_sr if_udav if_ural if_zyd Drivers that were already disabled because of tty changes: if_ppp if_sl Discussed on: arch@
This commit is contained in:
parent
0592710988
commit
70b6a8119c
@ -765,10 +765,6 @@ device arcnet
|
||||
# of synchronous PPP links (like `cx', `ar').
|
||||
device sppp
|
||||
|
||||
# The `sl' device implements the Serial Line IP (SLIP) service.
|
||||
# The `ppp' device implements the Point-to-Point Protocol.
|
||||
|
||||
|
||||
# The `bpf' device enables the Berkeley Packet Filter. Be
|
||||
# aware of the legal and administrative consequences of enabling this
|
||||
# option. The number of devices determines the maximum number of
|
||||
@ -836,15 +832,6 @@ device enc
|
||||
# Link aggregation interface.
|
||||
device lagg
|
||||
|
||||
#
|
||||
# The PPP_BSDCOMP option enables support for compress(1) style entire
|
||||
# packet compression, the PPP_DEFLATE is for zlib/gzip style compression.
|
||||
# PPP_FILTER enables code for filtering the ppp data stream and selecting
|
||||
# events for resetting the demand dial activity timer - requires bpf.
|
||||
# See pppd(8) for more details.
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# Internet family options:
|
||||
#
|
||||
@ -2678,7 +2665,6 @@ options SC_DEBUG_LEVEL=5 # Syscons debug level
|
||||
options SC_RENDER_DEBUG # syscons rendering debugging
|
||||
|
||||
options SHOW_BUSYBUFS # List buffers that prevent root unmount
|
||||
options SLIP_IFF_OPTS
|
||||
options VFS_BIO_DEBUG # VFS buffer I/O debugging
|
||||
|
||||
options KSTACK_MAX_PAGES=32 # Maximum pages to give the kernel stack
|
||||
|
@ -1306,7 +1306,6 @@ dev/random/probe.c optional random
|
||||
dev/random/randomdev.c optional random
|
||||
dev/random/randomdev_soft.c optional random
|
||||
dev/random/yarrow.c optional random
|
||||
dev/ray/if_ray.c optional ray pccard
|
||||
dev/rc/rc.c optional rc
|
||||
dev/re/if_re.c optional re
|
||||
dev/rndtest/rndtest.c optional rndtest
|
||||
@ -1424,8 +1423,6 @@ dev/sound/midi/synth_if.m optional sound
|
||||
dev/spibus/spibus.c optional spibus \
|
||||
dependency "spibus_if.h"
|
||||
dev/spibus/spibus_if.m optional spibus
|
||||
dev/sr/if_sr.c optional sr
|
||||
dev/sr/if_sr_pci.c optional sr pci
|
||||
dev/ste/if_ste.c optional ste pci
|
||||
dev/stg/tmc18c30.c optional stg
|
||||
dev/stg/tmc18c30_isa.c optional stg isa
|
||||
@ -1502,15 +1499,6 @@ legacy/dev/usb/ehci_ddb.c optional oehci
|
||||
legacy/dev/usb/ehci_pci.c optional oehci pci
|
||||
legacy/dev/usb/hid.c optional ousb
|
||||
legacy/dev/usb/if_aue.c optional oaue
|
||||
legacy/dev/usb/if_axe.c optional oaxe
|
||||
legacy/dev/usb/if_cdce.c optional ocdce
|
||||
legacy/dev/usb/if_cue.c optional ocue
|
||||
legacy/dev/usb/if_kue.c optional okue
|
||||
legacy/dev/usb/if_ural.c optional oural
|
||||
legacy/dev/usb/if_rue.c optional orue
|
||||
legacy/dev/usb/if_rum.c optional orum
|
||||
legacy/dev/usb/if_udav.c optional oudav
|
||||
legacy/dev/usb/if_zyd.c optional ozyd
|
||||
legacy/dev/usb/ohci.c optional oohci
|
||||
legacy/dev/usb/ohci_pci.c optional oohci pci
|
||||
legacy/dev/usb/sl811hs.c optional oslhci
|
||||
@ -2160,7 +2148,6 @@ net/bpf_jitter.c optional bpf_jitter
|
||||
net/bpf_filter.c optional bpf | netgraph_bpf
|
||||
net/bpf_zerocopy.c optional bpf
|
||||
net/bridgestp.c optional bridge | if_bridge
|
||||
net/bsd_comp.c optional ppp_bsdcomp
|
||||
net/ieee8023ad_lacp.c optional lagg
|
||||
net/if.c standard
|
||||
net/if_arcsubr.c optional arcnet
|
||||
@ -2184,8 +2171,6 @@ net/if_loop.c optional loop
|
||||
net/if_llatbl.c standard
|
||||
net/if_media.c standard
|
||||
net/if_mib.c standard
|
||||
net/if_ppp.c optional ppp
|
||||
net/if_sl.c optional sl
|
||||
net/if_spppfr.c optional sppp | netgraph_sppp
|
||||
net/if_spppsubr.c optional sppp | netgraph_sppp
|
||||
net/if_stf.c optional stf
|
||||
@ -2195,8 +2180,6 @@ net/if_vlan.c optional vlan
|
||||
net/mppcc.c optional netgraph_mppc_compression
|
||||
net/mppcd.c optional netgraph_mppc_compression
|
||||
net/netisr.c standard
|
||||
net/ppp_deflate.c optional ppp_deflate
|
||||
net/ppp_tty.c optional ppp
|
||||
net/pfil.c optional ether | inet
|
||||
net/radix.c standard
|
||||
net/radix_mpath.c standard
|
||||
@ -2204,10 +2187,10 @@ net/raw_cb.c standard
|
||||
net/raw_usrreq.c standard
|
||||
net/route.c standard
|
||||
net/rtsock.c standard
|
||||
net/slcompress.c optional netgraph_vjc | ppp | sl | sppp | \
|
||||
net/slcompress.c optional netgraph_vjc | sppp | \
|
||||
netgraph_sppp
|
||||
net/zlib.c optional crypto | geom_uzip | ipsec | \
|
||||
mxge | ppp_deflate | netgraph_deflate | \
|
||||
mxge | netgraph_deflate | \
|
||||
ddb_ctf
|
||||
net80211/ieee80211.c optional wlan
|
||||
net80211/ieee80211_acl.c optional wlan_acl
|
||||
|
@ -130,9 +130,6 @@ dev/agp/agp_via.c optional agp
|
||||
dev/aic/aic_isa.c optional aic isa
|
||||
dev/amdtemp/amdtemp.c optional amdtemp
|
||||
dev/arcmsr/arcmsr.c optional arcmsr pci
|
||||
dev/ar/if_ar.c optional ar
|
||||
dev/ar/if_ar_isa.c optional ar isa
|
||||
dev/ar/if_ar_pci.c optional ar pci
|
||||
dev/asmc/asmc.c optional asmc isa
|
||||
dev/atkbdc/atkbd.c optional atkbd atkbdc
|
||||
dev/atkbdc/atkbd_atkbdc.c optional atkbd atkbdc
|
||||
@ -218,7 +215,6 @@ dev/sio/sio_pccard.c optional sio pccard
|
||||
dev/sio/sio_pci.c optional sio pci
|
||||
dev/sio/sio_puc.c optional sio puc
|
||||
dev/speaker/spkr.c optional speaker
|
||||
dev/sr/if_sr_isa.c optional sr isa
|
||||
dev/syscons/apm/apm_saver.c optional apm_saver apm
|
||||
dev/syscons/scterm-teken.c optional sc
|
||||
dev/syscons/scvesactl.c optional sc vga vesa
|
||||
|
@ -85,8 +85,6 @@ dev/agp/agp_nvidia.c optional agp
|
||||
dev/agp/agp_sis.c optional agp
|
||||
dev/agp/agp_via.c optional agp
|
||||
dev/aic/aic_cbus.c optional aic isa
|
||||
dev/ar/if_ar.c optional ar
|
||||
dev/ar/if_ar_pci.c optional ar pci
|
||||
dev/ce/ceddk.c optional ce
|
||||
dev/ce/if_ce.c optional ce
|
||||
dev/ce/tau32-ddk.c optional ce
|
||||
|
@ -407,9 +407,6 @@ MROUTING opt_mrouting.h
|
||||
NCP
|
||||
NETATALK opt_atalk.h
|
||||
NFSLOCKD
|
||||
PPP_BSDCOMP opt_ppp.h
|
||||
PPP_DEFLATE opt_ppp.h
|
||||
PPP_FILTER opt_ppp.h
|
||||
RADIX_MPATH opt_mpath.h
|
||||
ROUTETABLES opt_route.h
|
||||
COMPAT_ROUTE_FLAGS opt_route.h
|
||||
|
@ -528,8 +528,6 @@ hint.mse.0.irq="5"
|
||||
# Network interfaces:
|
||||
#
|
||||
|
||||
# ar: Arnet SYNC/570i hdlc sync 2/4 port V.35/X.21 serial driver
|
||||
# (requires sppp)
|
||||
# ath: Atheros a/b/g WiFi adapters (requires ath_hal and wlan)
|
||||
# ce: Cronyx Tau-PCI/32 sync single/dual port G.703/E1 serial adaptor
|
||||
# with 32 HDLC subchannels (requires sppp (default), or NETGRAPH if
|
||||
@ -554,17 +552,11 @@ hint.mse.0.irq="5"
|
||||
# nve: nVidia nForce MCP on-board Ethernet Networking
|
||||
# ral: Ralink Technology IEEE 802.11 wireless adapter
|
||||
# sbni: Granch SBNI12-xx ISA and PCI adapters
|
||||
# sr: RISCom/N2 hdlc sync 1/2 port V.35/X.21 serial driver (requires sppp)
|
||||
# wl: Lucent Wavelan (ISA card only).
|
||||
# wpi: Intel 3945ABG Wireless LAN controller
|
||||
|
||||
# Order for ISA/EISA devices is important here
|
||||
|
||||
device ar
|
||||
hint.ar.0.at="isa"
|
||||
hint.ar.0.port="0x300"
|
||||
hint.ar.0.irq="10"
|
||||
hint.ar.0.maddr="0xd0000"
|
||||
device ath # Atheros pci/cardbus NIC's
|
||||
device ath_hal # pci/cardbus chip support
|
||||
#device ath_ar5210 # AR5210 chips
|
||||
@ -619,11 +611,6 @@ hint.sbni.0.at="isa"
|
||||
hint.sbni.0.port="0x210"
|
||||
hint.sbni.0.irq="0xefdead"
|
||||
hint.sbni.0.flags="0"
|
||||
device sr
|
||||
hint.sr.0.at="isa"
|
||||
hint.sr.0.port="0x300"
|
||||
hint.sr.0.irq="5"
|
||||
hint.sr.0.maddr="0xd0000"
|
||||
device wl
|
||||
hint.wl.0.at="isa"
|
||||
hint.wl.0.port="0x300"
|
||||
|
@ -551,9 +551,7 @@ poll_switch(SYSCTL_HANDLER_ARGS)
|
||||
else
|
||||
ifr.ifr_reqcap =
|
||||
ifp->if_capenable & ~IFCAP_POLLING;
|
||||
IFF_LOCKGIANT(ifp); /* LOR here */
|
||||
(void) (*ifp->if_ioctl)(ifp, SIOCSIFCAP, (caddr_t)&ifr);
|
||||
IFF_UNLOCKGIANT(ifp);
|
||||
}
|
||||
}
|
||||
IFNET_RUNLOCK();
|
||||
|
@ -24,7 +24,6 @@ SUBDIR= ${_3dfx} \
|
||||
${_an} \
|
||||
${_aout} \
|
||||
${_apm} \
|
||||
${_ar} \
|
||||
${_arcmsr} \
|
||||
${_arcnet} \
|
||||
${_asmc} \
|
||||
@ -219,7 +218,6 @@ SUBDIR= ${_3dfx} \
|
||||
puc \
|
||||
ral \
|
||||
${_random} \
|
||||
${_ray} \
|
||||
rc4 \
|
||||
${_rdma} \
|
||||
re \
|
||||
@ -244,7 +242,6 @@ SUBDIR= ${_3dfx} \
|
||||
${_speaker} \
|
||||
${_splash} \
|
||||
${_sppp} \
|
||||
${_sr} \
|
||||
ste \
|
||||
${_stg} \
|
||||
stge \
|
||||
@ -332,7 +329,6 @@ _amd= amd
|
||||
_an= an
|
||||
_aout= aout
|
||||
_apm= apm
|
||||
_ar= ar
|
||||
_arcnet= arcnet
|
||||
_bktr= bktr
|
||||
_cardbus= cardbus
|
||||
@ -385,7 +381,6 @@ _opensolaris= opensolaris
|
||||
_pccard= pccard
|
||||
_pcfclock= pcfclock
|
||||
_pst= pst
|
||||
_ray= ray
|
||||
_rdma= rdma
|
||||
_safe= safe
|
||||
_sbni= sbni
|
||||
@ -395,7 +390,6 @@ _sound= sound
|
||||
_speaker= speaker
|
||||
_splash= splash
|
||||
_sppp= sppp
|
||||
_sr= sr
|
||||
_stg= stg
|
||||
_streams= streams
|
||||
_svr4= svr4
|
||||
|
@ -44,8 +44,6 @@ SUBDIR= async \
|
||||
source \
|
||||
split \
|
||||
sppp \
|
||||
${_sync_ar} \
|
||||
${_sync_sr} \
|
||||
tag \
|
||||
tcpmss \
|
||||
tee \
|
||||
@ -54,11 +52,6 @@ SUBDIR= async \
|
||||
vjc \
|
||||
vlan
|
||||
|
||||
.if ${MACHINE_ARCH} == "i386"
|
||||
_sync_ar= sync_ar
|
||||
_sync_sr= sync_sr
|
||||
.endif
|
||||
|
||||
.if ${MK_BLUETOOTH} != "no" || defined(ALL_MODULES)
|
||||
_bluetooth= bluetooth
|
||||
.endif
|
||||
|
66
sys/net/if.c
66
sys/net/if.c
@ -138,7 +138,6 @@ static void link_rtrequest(int, struct rtentry *, struct rt_addrinfo *);
|
||||
static int if_rtdel(struct radix_node *, void *);
|
||||
static int ifhwioctl(u_long, struct ifnet *, caddr_t, struct thread *);
|
||||
static int if_delmulti_locked(struct ifnet *, struct ifmultiaddr *, int);
|
||||
static void if_start_deferred(void *context, int pending);
|
||||
static void do_link_state_change(void *, int);
|
||||
static int if_getgroup(struct ifgroupreq *, struct ifnet *);
|
||||
static int if_getgroupmembers(struct ifgroupreq *);
|
||||
@ -582,7 +581,6 @@ if_attach(struct ifnet *ifp)
|
||||
panic ("%s: BUG: if_attach called without if_alloc'd input()\n",
|
||||
ifp->if_xname);
|
||||
|
||||
TASK_INIT(&ifp->if_starttask, 0, if_start_deferred, ifp);
|
||||
TASK_INIT(&ifp->if_linktask, 0, do_link_state_change, ifp);
|
||||
IF_AFDATA_LOCK_INIT(ifp);
|
||||
ifp->if_afdata_initialized = 0;
|
||||
@ -674,9 +672,6 @@ if_attach(struct ifnet *ifp)
|
||||
if (atomic_cmpset_int(&slowtimo_started, 0, 1) && !cold)
|
||||
if_slowtimo(0);
|
||||
}
|
||||
if (ifp->if_flags & IFF_NEEDSGIANT)
|
||||
if_printf(ifp,
|
||||
"WARNING: using obsoleted IFF_NEEDSGIANT flag\n");
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1607,8 +1602,7 @@ if_qflush(struct ifnet *ifp)
|
||||
* call the appropriate interface routine on expiration.
|
||||
*
|
||||
* XXXRW: Note that because timeouts run with Giant, if_watchdog() is called
|
||||
* holding Giant. If we switch to an MPSAFE callout, we likely need to grab
|
||||
* Giant before entering if_watchdog() on an IFF_NEEDSGIANT interface.
|
||||
* holding Giant.
|
||||
*/
|
||||
static void
|
||||
if_slowtimo(void *arg)
|
||||
@ -1741,9 +1735,7 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td)
|
||||
ifp->if_flags = (ifp->if_flags & IFF_CANTCHANGE) |
|
||||
(new_flags &~ IFF_CANTCHANGE);
|
||||
if (ifp->if_ioctl) {
|
||||
IFF_LOCKGIANT(ifp);
|
||||
(void) (*ifp->if_ioctl)(ifp, cmd, data);
|
||||
IFF_UNLOCKGIANT(ifp);
|
||||
}
|
||||
getmicrotime(&ifp->if_lastchange);
|
||||
break;
|
||||
@ -1756,9 +1748,7 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td)
|
||||
return (EOPNOTSUPP);
|
||||
if (ifr->ifr_reqcap & ~ifp->if_capabilities)
|
||||
return (EINVAL);
|
||||
IFF_LOCKGIANT(ifp);
|
||||
error = (*ifp->if_ioctl)(ifp, cmd, data);
|
||||
IFF_UNLOCKGIANT(ifp);
|
||||
if (error == 0)
|
||||
getmicrotime(&ifp->if_lastchange);
|
||||
break;
|
||||
@ -1830,9 +1820,7 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td)
|
||||
return (error);
|
||||
if (ifp->if_ioctl == NULL)
|
||||
return (EOPNOTSUPP);
|
||||
IFF_LOCKGIANT(ifp);
|
||||
error = (*ifp->if_ioctl)(ifp, cmd, data);
|
||||
IFF_UNLOCKGIANT(ifp);
|
||||
if (error == 0)
|
||||
getmicrotime(&ifp->if_lastchange);
|
||||
break;
|
||||
@ -1848,9 +1836,7 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td)
|
||||
return (EINVAL);
|
||||
if (ifp->if_ioctl == NULL)
|
||||
return (EOPNOTSUPP);
|
||||
IFF_LOCKGIANT(ifp);
|
||||
error = (*ifp->if_ioctl)(ifp, cmd, data);
|
||||
IFF_UNLOCKGIANT(ifp);
|
||||
if (error == 0) {
|
||||
getmicrotime(&ifp->if_lastchange);
|
||||
rt_ifmsg(ifp);
|
||||
@ -1920,9 +1906,7 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td)
|
||||
return (error);
|
||||
if (ifp->if_ioctl == NULL)
|
||||
return (EOPNOTSUPP);
|
||||
IFF_LOCKGIANT(ifp);
|
||||
error = (*ifp->if_ioctl)(ifp, cmd, data);
|
||||
IFF_UNLOCKGIANT(ifp);
|
||||
if (error == 0)
|
||||
getmicrotime(&ifp->if_lastchange);
|
||||
break;
|
||||
@ -1938,9 +1922,7 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td)
|
||||
case SIOCGIFGENERIC:
|
||||
if (ifp->if_ioctl == NULL)
|
||||
return (EOPNOTSUPP);
|
||||
IFF_LOCKGIANT(ifp);
|
||||
error = (*ifp->if_ioctl)(ifp, cmd, data);
|
||||
IFF_UNLOCKGIANT(ifp);
|
||||
break;
|
||||
|
||||
case SIOCSIFLLADDR:
|
||||
@ -2168,9 +2150,7 @@ if_setflag(struct ifnet *ifp, int flag, int pflag, int *refcount, int onswitch)
|
||||
}
|
||||
ifr.ifr_flags = ifp->if_flags & 0xffff;
|
||||
ifr.ifr_flagshigh = ifp->if_flags >> 16;
|
||||
IFF_LOCKGIANT(ifp);
|
||||
error = (*ifp->if_ioctl)(ifp, SIOCSIFFLAGS, (caddr_t)&ifr);
|
||||
IFF_UNLOCKGIANT(ifp);
|
||||
if (error)
|
||||
goto recover;
|
||||
/* Notify userland that interface flags have changed */
|
||||
@ -2540,9 +2520,7 @@ if_addmulti(struct ifnet *ifp, struct sockaddr *sa,
|
||||
* interface to let them know about it.
|
||||
*/
|
||||
if (ifp->if_ioctl != NULL) {
|
||||
IFF_LOCKGIANT(ifp);
|
||||
(void) (*ifp->if_ioctl)(ifp, SIOCADDMULTI, 0);
|
||||
IFF_UNLOCKGIANT(ifp);
|
||||
}
|
||||
|
||||
if (llsa != NULL)
|
||||
@ -2601,9 +2579,7 @@ if_delmulti(struct ifnet *ifp, struct sockaddr *sa)
|
||||
return (ENOENT);
|
||||
|
||||
if (lastref && ifp->if_ioctl != NULL) {
|
||||
IFF_LOCKGIANT(ifp);
|
||||
(void)(*ifp->if_ioctl)(ifp, SIOCDELMULTI, 0);
|
||||
IFF_UNLOCKGIANT(ifp);
|
||||
}
|
||||
|
||||
return (0);
|
||||
@ -2613,9 +2589,7 @@ if_delmulti(struct ifnet *ifp, struct sockaddr *sa)
|
||||
* Delete a multicast group membership by group membership pointer.
|
||||
* Network-layer protocol domains must use this routine.
|
||||
*
|
||||
* It is safe to call this routine if the ifp disappeared. Callers should
|
||||
* hold IFF_LOCKGIANT() to avoid a LOR in case the hardware needs to be
|
||||
* reconfigured.
|
||||
* It is safe to call this routine if the ifp disappeared.
|
||||
*/
|
||||
void
|
||||
if_delmulti_ifma(struct ifmultiaddr *ifma)
|
||||
@ -2660,9 +2634,7 @@ if_delmulti_ifma(struct ifmultiaddr *ifma)
|
||||
*/
|
||||
IF_ADDR_UNLOCK(ifp);
|
||||
if (lastref && ifp->if_ioctl != NULL) {
|
||||
IFF_LOCKGIANT(ifp);
|
||||
(void)(*ifp->if_ioctl)(ifp, SIOCDELMULTI, 0);
|
||||
IFF_UNLOCKGIANT(ifp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2784,7 +2756,6 @@ if_setlladdr(struct ifnet *ifp, const u_char *lladdr, int len)
|
||||
*/
|
||||
if ((ifp->if_flags & IFF_UP) != 0) {
|
||||
if (ifp->if_ioctl) {
|
||||
IFF_LOCKGIANT(ifp);
|
||||
ifp->if_flags &= ~IFF_UP;
|
||||
ifr.ifr_flags = ifp->if_flags & 0xffff;
|
||||
ifr.ifr_flagshigh = ifp->if_flags >> 16;
|
||||
@ -2793,7 +2764,6 @@ if_setlladdr(struct ifnet *ifp, const u_char *lladdr, int len)
|
||||
ifr.ifr_flags = ifp->if_flags & 0xffff;
|
||||
ifr.ifr_flagshigh = ifp->if_flags >> 16;
|
||||
(*ifp->if_ioctl)(ifp, SIOCSIFFLAGS, (caddr_t)&ifr);
|
||||
IFF_UNLOCKGIANT(ifp);
|
||||
}
|
||||
#ifdef INET
|
||||
/*
|
||||
@ -2839,39 +2809,11 @@ if_printf(struct ifnet *ifp, const char * fmt, ...)
|
||||
return (retval);
|
||||
}
|
||||
|
||||
/*
|
||||
* When an interface is marked IFF_NEEDSGIANT, its if_start() routine cannot
|
||||
* be called without Giant. However, we often can't acquire the Giant lock
|
||||
* at those points; instead, we run it via a task queue that holds Giant via
|
||||
* if_start_deferred.
|
||||
*
|
||||
* XXXRW: We need to make sure that the ifnet isn't fully detached until any
|
||||
* outstanding if_start_deferred() tasks that will run after the free. This
|
||||
* probably means waiting in if_detach().
|
||||
*/
|
||||
void
|
||||
if_start(struct ifnet *ifp)
|
||||
{
|
||||
|
||||
if (ifp->if_flags & IFF_NEEDSGIANT) {
|
||||
if (mtx_owned(&Giant))
|
||||
(*(ifp)->if_start)(ifp);
|
||||
else
|
||||
taskqueue_enqueue(taskqueue_swi_giant,
|
||||
&ifp->if_starttask);
|
||||
} else
|
||||
(*(ifp)->if_start)(ifp);
|
||||
}
|
||||
|
||||
static void
|
||||
if_start_deferred(void *context, int pending)
|
||||
{
|
||||
struct ifnet *ifp;
|
||||
|
||||
GIANT_REQUIRED;
|
||||
|
||||
ifp = context;
|
||||
(ifp->if_start)(ifp);
|
||||
(*(ifp)->if_start)(ifp);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2908,7 +2850,7 @@ if_handoff(struct ifqueue *ifq, struct mbuf *m, struct ifnet *ifp, int adjust)
|
||||
_IF_ENQUEUE(ifq, m);
|
||||
IF_UNLOCK(ifq);
|
||||
if (ifp != NULL && !active)
|
||||
if_start(ifp);
|
||||
(*(ifp)->if_start)(ifp);
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
@ -829,9 +829,7 @@ bridge_set_ifcap(struct bridge_softc *sc, struct bridge_iflist *bif, int set)
|
||||
ifr.ifr_reqcap = set;
|
||||
|
||||
if (ifp->if_capenable != set) {
|
||||
IFF_LOCKGIANT(ifp);
|
||||
error = (*ifp->if_ioctl)(ifp, SIOCSIFCAP, (caddr_t)&ifr);
|
||||
IFF_UNLOCKGIANT(ifp);
|
||||
if (error)
|
||||
if_printf(sc->sc_ifp,
|
||||
"error setting interface capabilities on %s\n",
|
||||
|
@ -181,7 +181,6 @@ struct ifnet {
|
||||
void *if_afdata[AF_MAX];
|
||||
int if_afdata_initialized;
|
||||
struct rwlock if_afdata_lock;
|
||||
struct task if_starttask; /* task for IFF_NEEDSGIANT */
|
||||
struct task if_linktask; /* task for link change events */
|
||||
struct mtx if_addr_mtx; /* mutex to protect address lists */
|
||||
|
||||
@ -379,16 +378,6 @@ EVENTHANDLER_DECLARE(group_change_event, group_change_event_handler_t);
|
||||
#define IF_AFDATA_LOCK_ASSERT(ifp) rw_assert(&(ifp)->if_afdata_lock, RA_LOCKED)
|
||||
#define IF_AFDATA_UNLOCK_ASSERT(ifp) rw_assert(&(ifp)->if_afdata_lock, RA_UNLOCKED)
|
||||
|
||||
#define IFF_LOCKGIANT(ifp) do { \
|
||||
if ((ifp)->if_flags & IFF_NEEDSGIANT) \
|
||||
mtx_lock(&Giant); \
|
||||
} while (0)
|
||||
|
||||
#define IFF_UNLOCKGIANT(ifp) do { \
|
||||
if ((ifp)->if_flags & IFF_NEEDSGIANT) \
|
||||
mtx_unlock(&Giant); \
|
||||
} while (0)
|
||||
|
||||
int if_handoff(struct ifqueue *ifq, struct mbuf *m, struct ifnet *ifp,
|
||||
int adjust);
|
||||
#define IF_HANDOFF(ifq, m, ifp) \
|
||||
|
@ -397,10 +397,8 @@ in_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp,
|
||||
oldaddr = ia->ia_dstaddr;
|
||||
ia->ia_dstaddr = *(struct sockaddr_in *)&ifr->ifr_dstaddr;
|
||||
if (ifp->if_ioctl != NULL) {
|
||||
IFF_LOCKGIANT(ifp);
|
||||
error = (*ifp->if_ioctl)(ifp, SIOCSIFDSTADDR,
|
||||
(caddr_t)ia);
|
||||
IFF_UNLOCKGIANT(ifp);
|
||||
if (error) {
|
||||
ia->ia_dstaddr = oldaddr;
|
||||
return (error);
|
||||
@ -507,10 +505,7 @@ in_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp,
|
||||
default:
|
||||
if (ifp == NULL || ifp->if_ioctl == NULL)
|
||||
return (EOPNOTSUPP);
|
||||
IFF_LOCKGIANT(ifp);
|
||||
error = (*ifp->if_ioctl)(ifp, cmd, data);
|
||||
IFF_UNLOCKGIANT(ifp);
|
||||
return (error);
|
||||
return ((*ifp->if_ioctl)(ifp, cmd, data));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -531,7 +526,6 @@ in_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp,
|
||||
IFP_TO_IA(ifp, oia);
|
||||
if (oia == NULL) {
|
||||
ii = ((struct in_ifinfo *)ifp->if_afdata[AF_INET]);
|
||||
IFF_LOCKGIANT(ifp);
|
||||
IN_MULTI_LOCK();
|
||||
if (ii->ii_allhosts) {
|
||||
(void)in_leavegroup_locked(ii->ii_allhosts,
|
||||
@ -539,7 +533,6 @@ in_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp,
|
||||
ii->ii_allhosts = NULL;
|
||||
}
|
||||
IN_MULTI_UNLOCK();
|
||||
IFF_UNLOCKGIANT(ifp);
|
||||
}
|
||||
}
|
||||
IFAFREE(&ia->ia_ifa);
|
||||
@ -753,9 +746,7 @@ in_ifinit(struct ifnet *ifp, struct in_ifaddr *ia, struct sockaddr_in *sin,
|
||||
* and to validate the address if necessary.
|
||||
*/
|
||||
if (ifp->if_ioctl != NULL) {
|
||||
IFF_LOCKGIANT(ifp);
|
||||
error = (*ifp->if_ioctl)(ifp, SIOCSIFADDR, (caddr_t)ia);
|
||||
IFF_UNLOCKGIANT(ifp);
|
||||
if (error) {
|
||||
splx(s);
|
||||
/* LIST_REMOVE(ia, ia_hash) is done in in_control */
|
||||
|
@ -1100,11 +1100,9 @@ in_joingroup(struct ifnet *ifp, const struct in_addr *gina,
|
||||
{
|
||||
int error;
|
||||
|
||||
IFF_LOCKGIANT(ifp);
|
||||
IN_MULTI_LOCK();
|
||||
error = in_joingroup_locked(ifp, gina, imf, pinm);
|
||||
IN_MULTI_UNLOCK();
|
||||
IFF_UNLOCKGIANT(ifp);
|
||||
|
||||
return (error);
|
||||
}
|
||||
@ -1181,20 +1179,14 @@ int
|
||||
in_leavegroup(struct in_multi *inm, /*const*/ struct in_mfilter *imf)
|
||||
{
|
||||
struct ifnet *ifp;
|
||||
int detached, error;
|
||||
int error;
|
||||
|
||||
detached = inm_is_ifp_detached(inm);
|
||||
ifp = inm->inm_ifp;
|
||||
if (!detached)
|
||||
IFF_LOCKGIANT(ifp);
|
||||
|
||||
IN_MULTI_LOCK();
|
||||
error = in_leavegroup_locked(inm, imf);
|
||||
IN_MULTI_UNLOCK();
|
||||
|
||||
if (!detached)
|
||||
IFF_UNLOCKGIANT(ifp);
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
@ -1396,8 +1388,6 @@ inp_block_unblock_source(struct inpcb *inp, struct sockopt *sopt)
|
||||
if (!IN_MULTICAST(ntohl(gsa->sin.sin_addr.s_addr)))
|
||||
return (EINVAL);
|
||||
|
||||
IFF_LOCKGIANT(ifp);
|
||||
|
||||
/*
|
||||
* Check if we are actually a member of this group.
|
||||
*/
|
||||
@ -1486,7 +1476,6 @@ out_imf_rollback:
|
||||
|
||||
out_inp_locked:
|
||||
INP_WUNLOCK(inp);
|
||||
IFF_UNLOCKGIANT(ifp);
|
||||
return (error);
|
||||
}
|
||||
|
||||
@ -1978,8 +1967,6 @@ inp_join_group(struct inpcb *inp, struct sockopt *sopt)
|
||||
if (ifp == NULL || (ifp->if_flags & IFF_MULTICAST) == 0)
|
||||
return (EADDRNOTAVAIL);
|
||||
|
||||
IFF_LOCKGIANT(ifp);
|
||||
|
||||
/*
|
||||
* MCAST_JOIN_SOURCE on an exclusive membership is an error.
|
||||
* On an existing inclusive membership, it just adds the
|
||||
@ -2102,7 +2089,6 @@ out_imo_free:
|
||||
|
||||
out_inp_locked:
|
||||
INP_WUNLOCK(inp);
|
||||
IFF_UNLOCKGIANT(ifp);
|
||||
return (error);
|
||||
}
|
||||
|
||||
@ -2215,9 +2201,6 @@ inp_leave_group(struct inpcb *inp, struct sockopt *sopt)
|
||||
if (!IN_MULTICAST(ntohl(gsa->sin.sin_addr.s_addr)))
|
||||
return (EINVAL);
|
||||
|
||||
if (ifp)
|
||||
IFF_LOCKGIANT(ifp);
|
||||
|
||||
/*
|
||||
* Find the membership in the membership array.
|
||||
*/
|
||||
@ -2312,8 +2295,6 @@ out_imf_rollback:
|
||||
|
||||
out_inp_locked:
|
||||
INP_WUNLOCK(inp);
|
||||
if (ifp)
|
||||
IFF_UNLOCKGIANT(ifp);
|
||||
return (error);
|
||||
}
|
||||
|
||||
@ -2432,8 +2413,6 @@ inp_set_source_filters(struct inpcb *inp, struct sockopt *sopt)
|
||||
if (ifp == NULL)
|
||||
return (EADDRNOTAVAIL);
|
||||
|
||||
IFF_LOCKGIANT(ifp);
|
||||
|
||||
/*
|
||||
* Take the INP write lock.
|
||||
* Check if this socket is a member of this group.
|
||||
@ -2551,7 +2530,6 @@ out_imf_rollback:
|
||||
|
||||
out_inp_locked:
|
||||
INP_WUNLOCK(inp);
|
||||
IFF_UNLOCKGIANT(ifp);
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
@ -1516,9 +1516,7 @@ in6_ifinit(struct ifnet *ifp, struct in6_ifaddr *ia,
|
||||
ia->ia_addr = *sin6;
|
||||
|
||||
if (ifacount <= 1 && ifp->if_ioctl) {
|
||||
IFF_LOCKGIANT(ifp);
|
||||
error = (*ifp->if_ioctl)(ifp, SIOCSIFADDR, (caddr_t)ia);
|
||||
IFF_UNLOCKGIANT(ifp);
|
||||
if (error) {
|
||||
splx(s);
|
||||
return (error);
|
||||
|
@ -906,10 +906,8 @@ in6_purgemaddrs(struct ifnet *ifp)
|
||||
struct in6_multi *in6m;
|
||||
struct in6_multi *oin6m;
|
||||
|
||||
IFF_LOCKGIANT(ifp);
|
||||
LIST_FOREACH_SAFE(in6m, &in6_multihead, in6m_entry, oin6m) {
|
||||
if (in6m->in6m_ifp == ifp)
|
||||
in6_delmulti(in6m);
|
||||
}
|
||||
IFF_UNLOCKGIANT(ifp);
|
||||
}
|
||||
|
@ -550,7 +550,6 @@ in6_addmulti(struct in6_addr *maddr6, struct ifnet *ifp,
|
||||
*errorp = 0;
|
||||
in6m = NULL;
|
||||
|
||||
IFF_LOCKGIANT(ifp);
|
||||
/*IN6_MULTI_LOCK();*/
|
||||
|
||||
IN6_LOOKUP_MULTI(*maddr6, ifp, in6m);
|
||||
@ -622,7 +621,6 @@ in6_addmulti(struct in6_addr *maddr6, struct ifnet *ifp,
|
||||
} while (0);
|
||||
|
||||
/*IN6_MULTI_UNLOCK();*/
|
||||
IFF_UNLOCKGIANT(ifp);
|
||||
|
||||
return (in6m);
|
||||
}
|
||||
|
@ -221,13 +221,9 @@ natm_usr_connect(struct socket *so, struct sockaddr *nam, d_thread_t *p)
|
||||
op.param.traffic = ATMIO_TRAFFIC_UBR;
|
||||
NATM_UNLOCK();
|
||||
|
||||
IFF_LOCKGIANT(ifp);
|
||||
if (ifp->if_ioctl == NULL ||
|
||||
ifp->if_ioctl(ifp, SIOCATMOPENVCC, (caddr_t)&op) != 0) {
|
||||
IFF_UNLOCKGIANT(ifp);
|
||||
ifp->if_ioctl(ifp, SIOCATMOPENVCC, (caddr_t)&op) != 0)
|
||||
return (EIO);
|
||||
}
|
||||
IFF_UNLOCKGIANT(ifp);
|
||||
soisconnected(so);
|
||||
return (error);
|
||||
}
|
||||
@ -259,11 +255,8 @@ natm_usr_disconnect(struct socket *so)
|
||||
cl.vpi = npcb->npcb_vpi;
|
||||
cl.vci = npcb->npcb_vci;
|
||||
NATM_UNLOCK();
|
||||
if (ifp->if_ioctl != NULL) {
|
||||
IFF_LOCKGIANT(ifp);
|
||||
if (ifp->if_ioctl != NULL)
|
||||
ifp->if_ioctl(ifp, SIOCATMCLOSEVCC, (caddr_t)&cl);
|
||||
IFF_UNLOCKGIANT(ifp);
|
||||
}
|
||||
soisdisconnected(so);
|
||||
return (error);
|
||||
}
|
||||
@ -342,17 +335,13 @@ natm_usr_control(struct socket *so, u_long cmd, caddr_t arg,
|
||||
struct ifnet *ifp, d_thread_t *p)
|
||||
{
|
||||
struct natmpcb *npcb;
|
||||
int error;
|
||||
|
||||
npcb = (struct natmpcb *)so->so_pcb;
|
||||
KASSERT(npcb != NULL, ("natm_usr_control: npcb == NULL"));
|
||||
|
||||
if (ifp == NULL || ifp->if_ioctl == NULL)
|
||||
return (EOPNOTSUPP);
|
||||
IFF_LOCKGIANT(ifp);
|
||||
error = ((*ifp->if_ioctl)(ifp, cmd, arg));
|
||||
IFF_UNLOCKGIANT(ifp);
|
||||
return (error);
|
||||
return ((*ifp->if_ioctl)(ifp, cmd, arg));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -372,8 +372,6 @@ hint.mse.0.irq="13"
|
||||
# Network interfaces:
|
||||
#
|
||||
|
||||
# ar: Arnet SYNC/570i hdlc sync 2/4 port V.35/X.21 serial driver
|
||||
# (requires sppp)
|
||||
# ce: Cronyx Tau-PCI/32 sync single/dual port G.703/E1 serial adaptor
|
||||
# with 32 HDLC subchannels (requires sppp (default), or NETGRAPH if
|
||||
# NETGRAPH_CRONYX is configured)
|
||||
@ -391,13 +389,11 @@ hint.mse.0.irq="13"
|
||||
# ral: Ralink Technology IEEE 802.11 wireless adapter
|
||||
# sbni: Granch SBNI12-xx ISA and PCI adapters
|
||||
# snc: National Semiconductor DP8393X SONIC Ethernet adapter driver
|
||||
# sr: RISCom/N2 hdlc sync 1/2 port V.35/X.21 serial driver (requires sppp)
|
||||
# ural: Ralink Technology RT2500USB IEEE 802.11 wireless adapter
|
||||
# ath: Atheros a/b/g WiFi adapters (requires ath_hal and wlan)
|
||||
|
||||
# Order for ISA/EISA devices is important here
|
||||
|
||||
device ar
|
||||
device ce
|
||||
device cp
|
||||
device cs
|
||||
@ -427,7 +423,6 @@ hint.snc.0.at="isa"
|
||||
hint.snc.0.port="0x888"
|
||||
hint.snc.0.irq="6"
|
||||
hint.snc.0.maddr="0xc0000"
|
||||
device sr
|
||||
device ural
|
||||
|
||||
device ath # Atheros pci/cardbus NIC's
|
||||
|
Loading…
x
Reference in New Issue
Block a user