Make all network interrupt service routines MPSAFE part 1/3.
authorMatthew Dillon <dillon@dragonflybsd.org>
Mon, 28 Nov 2005 17:13:47 +0000 (17:13 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Mon, 28 Nov 2005 17:13:47 +0000 (17:13 +0000)
commit78195a764d5e70464a6d4f49bc08332a2a8bb4d0
tree147cf7cd02fd207987f092ef9315b5c373473232
parent7795c2fe496d5d2a4d2a77c424b0f4e20648fed0
Make all network interrupt service routines MPSAFE part 1/3.

Replace the critical section that was previously used to serialize access
with the LWKT serializer.  Integrate the serializer into the IFNET structure.
Note that kern.intr_mpsafe must be set to 1 for network interrupts to actually
run MPSAFE.  Also note that any interrupts shared with othre non-MP drivers
will cause all drivers on that interrupt to run with the Big Giant Lock.

Network interrupt - Each network driver then simply passes that serializer
to bus_setup_intr() so only a single serializer is required to process the
entire interrupt path.  LWKT serialization support is already 100% integrated
into the interrupt subsystem so it will already be held as of when the
registered interrupt procedure is called.

Ioctl and if_* functions - All callers of if_* functions (such as if_start,
if_ioctl, etc) now obtain the IFNET serializer before making the call.  Thus
all of these entry points into the driver will now be serialized.

if_input - All code that calls if_input now ensures that the serializer
is held.  It will either already be held (when called from a driver), or
the serializer will be wrapped around the call.  When packets are forwarded
or bridged between interfaces, the target interface serializer will be
dropped temporarily to avoid a deadlock.

Device Driver access - dev_* entry points into certain pseudo-network
devices now obtain and release the serializer.  This had to be done on
a device-by-device basis (but there are only a few such devices).

Thanks to several people for helping test the patch, in particular
Sepherosa Ziehau.
161 files changed:
sys/bus/usb/usb_ethersubr.c
sys/bus/usb/usb_port.h
sys/conf/files.i386
sys/contrib/ipfilter/netinet/ip_fil.c
sys/dev/atm/en/midway.c
sys/dev/netif/an/if_an.c
sys/dev/netif/an/if_an_isa.c
sys/dev/netif/an/if_an_pccard.c
sys/dev/netif/an/if_an_pci.c
sys/dev/netif/ar/if_ar.c
sys/dev/netif/aue/if_aue.c
sys/dev/netif/awi/awi.c
sys/dev/netif/awi/awivar.h
sys/dev/netif/awi/if_awi_pccard.c
sys/dev/netif/axe/if_axe.c
sys/dev/netif/bfe/if_bfe.c
sys/dev/netif/bge/if_bge.c
sys/dev/netif/cm/if_cm_isa.c
sys/dev/netif/cm/smc90cx6.c
sys/dev/netif/cs/if_cs.c
sys/dev/netif/cue/if_cue.c
sys/dev/netif/cx/if_cx.c
sys/dev/netif/dc/if_dc.c
sys/dev/netif/de/if_de.c
sys/dev/netif/de/if_devar.h
sys/dev/netif/ed/if_ed.c
sys/dev/netif/ed/if_ed_isa.c
sys/dev/netif/ed/if_ed_pccard.c
sys/dev/netif/ed/if_ed_pci.c
sys/dev/netif/el/if_el.c
sys/dev/netif/em/if_em.c
sys/dev/netif/em/if_em.h
sys/dev/netif/ep/if_ep.c
sys/dev/netif/ep/if_ep_eisa.c
sys/dev/netif/ep/if_ep_isa.c
sys/dev/netif/ep/if_ep_pccard.c
sys/dev/netif/ex/if_ex.c
sys/dev/netif/ex/if_ex_isa.c
sys/dev/netif/ex/if_ex_pccard.c
sys/dev/netif/fe/if_fe.c
sys/dev/netif/fe/if_fe_pccard.c
sys/dev/netif/fea/if_fea.c
sys/dev/netif/fpa/if_fpa.c
sys/dev/netif/fwe/if_fwe.c
sys/dev/netif/fxp/if_fxp.c
sys/dev/netif/gx/if_gx.c
sys/dev/netif/ic/if_ic.c
sys/dev/netif/ie/if_ie.c
sys/dev/netif/kue/if_kue.c
sys/dev/netif/le/if_le.c
sys/dev/netif/lge/if_lge.c
sys/dev/netif/lnc/if_lnc.c
sys/dev/netif/lnc/if_lnc_isa.c
sys/dev/netif/lnc/if_lnc_pci.c
sys/dev/netif/mn/if_mn.c
sys/dev/netif/my/if_my.c
sys/dev/netif/my/if_myreg.h
sys/dev/netif/ndis/if_ndis.c
sys/dev/netif/nge/if_nge.c
sys/dev/netif/nv/if_nv.c
sys/dev/netif/nv/if_nvreg.h
sys/dev/netif/owi/if_owi.c
sys/dev/netif/pcn/if_pcn.c
sys/dev/netif/pdq_layer/pdq_ifsubr.c
sys/dev/netif/plip/if_plip.c
sys/dev/netif/ray/if_ray.c
sys/dev/netif/rdp/if_rdp.c
sys/dev/netif/re/if_re.c
sys/dev/netif/rl/if_rl.c
sys/dev/netif/rue/if_rue.c
sys/dev/netif/sbni/Makefile
sys/dev/netif/sbni/if_sbni.c
sys/dev/netif/sbni/if_sbni_isa.c [deleted file]
sys/dev/netif/sbni/if_sbni_pci.c
sys/dev/netif/sbsh/if_sbsh.c
sys/dev/netif/sf/if_sf.c
sys/dev/netif/sis/if_sis.c
sys/dev/netif/sk/if_sk.c
sys/dev/netif/sn/if_sn.c
sys/dev/netif/sr/if_sr.c
sys/dev/netif/ste/if_ste.c
sys/dev/netif/ti/if_ti.c
sys/dev/netif/tl/if_tl.c
sys/dev/netif/tx/if_tx.c
sys/dev/netif/txp/if_txp.c
sys/dev/netif/vr/if_vr.c
sys/dev/netif/vx/if_vx.c
sys/dev/netif/vx/if_vx_eisa.c
sys/dev/netif/vx/if_vx_pci.c
sys/dev/netif/wb/if_wb.c
sys/dev/netif/wl/if_wl.c
sys/dev/netif/xe/if_xe.c
sys/dev/netif/xl/if_xl.c
sys/kern/kern_poll.c
sys/net/altq/altq_rmclass.c
sys/net/altq/altq_subr.c
sys/net/bpf.c
sys/net/bridge/bridge.c
sys/net/disc/if_disc.c
sys/net/dummynet/ip_dummynet.c
sys/net/ef/if_ef.c
sys/net/faith/if_faith.c
sys/net/gif/if_gif.c
sys/net/gre/if_gre.c
sys/net/i4b/driver/i4b_ipr.c
sys/net/i4b/driver/i4b_isppp.c
sys/net/if.c
sys/net/if_arc.h
sys/net/if_arcsubr.c
sys/net/if_atm.h
sys/net/if_atmsubr.c
sys/net/if_ethersubr.c
sys/net/if_fddisubr.c
sys/net/if_iso88025subr.c
sys/net/if_loop.c
sys/net/if_media.c
sys/net/if_var.h
sys/net/ifq_var.h
sys/net/iso88025.h
sys/net/oldbridge/bridge.c
sys/net/pf/if_pflog.c
sys/net/pf/if_pfsync.c
sys/net/pf/pf.c
sys/net/ppp/if_ppp.c
sys/net/sl/if_sl.c
sys/net/sppp/if_spppsubr.c
sys/net/stf/if_stf.c
sys/net/tap/if_tap.c
sys/net/tun/if_tun.c
sys/net/vlan/if_vlan.c
sys/netgraph/eiface/ng_eiface.c
sys/netgraph/ether/ng_ether.c
sys/netgraph/fec/ng_fec.c
sys/netgraph/iface/ng_iface.c
sys/netinet/if_atm.c
sys/netinet/if_ether.c
sys/netinet/if_fddi.h
sys/netinet/in.c
sys/netinet/in_var.h
sys/netinet/ip_flow.c
sys/netinet/ip_output.c
sys/netinet6/in6.c
sys/netinet6/ip6_mroute.c
sys/netinet6/nd6.c
sys/netproto/802_11/ieee80211.c
sys/netproto/802_11/ieee80211_input.c
sys/netproto/802_11/wlan/ieee80211.c
sys/netproto/802_11/wlan/ieee80211_input.c
sys/netproto/atalk/aarp.c
sys/netproto/atalk/at_control.c
sys/netproto/atalk/ddp_output.c
sys/netproto/atm/atm_if.c
sys/netproto/atm/atm_var.h
sys/netproto/ipx/ipx.c
sys/netproto/ipx/ipx_ip.c
sys/netproto/ipx/ipx_outputfl.c
sys/netproto/natm/natm.c
sys/netproto/ns/ns.c
sys/netproto/ns/ns_ip.c
sys/netproto/ns/ns_output.c
sys/sys/bus.h