Add following three network protocol threads running mode:
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Tue, 23 Sep 2008 11:28:50 +0000 (11:28 +0000)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Tue, 23 Sep 2008 11:28:50 +0000 (11:28 +0000)
commit92db3805bd7a1f247cdbdcfd50157ca600010b24
tree2d9a29181a690e44eac6e228831c3b3bf1bddf22
parent18c8d34ce615a98325b2d2a09ea83248a14b4360
Add following three network protocol threads running mode:
1) BGL (default)
2) Adaptive BGL.  Protocol threads run without BGL by default.  BGL will be
   held if the received msg does not have MSGF_MPSAFE turned on the ms_flags
   field
3) No BGL (experimental)

The code on the main path is done by dillon@

Following three sysctls and tunables are added to adjust the "mode":
net.netisr.mpsafe_thread
net.inet.tcp.mpsafe_thread
net.inet.udp.mpsafe_thread

They have same set of values,
0 (default) -- BGL
1      -- Adaptive BGL
2      -- No BGL

NETISR_FLAG_MPSAFE is added (netisr.ni_flags), so that:
- netisr_queue() and schednetisr() could set MSGF_MPSAFE during msg
  initialization
- netisr_run() (called by ether_input_oncpu()) could hold BGL based on this flag
  before calling netisr's handler

PR_MPSAFE is added (protosw.pr_flags), so that tranport_processing_oncpu() could
hold BGL before calling protocol's input handler

Kernel API changes:
- The thread parameter to netmsg_service_loop() must be supplied (running mode)
  and it must have the type of "int *"
- netisr_register() takes additional flags parameter to indicate whether its
  handler is MPSAFE (NETISR_FLAG_MPSAFE) or not

Reviewed-by: dillon@
23 files changed:
sys/bus/usb/usb_ethersubr.c
sys/net/bpf.c
sys/net/if.c
sys/net/netisr.c
sys/net/netisr.h
sys/net/netmsg.h
sys/net/ppp/if_ppp.c
sys/netbt/bt_proto.c
sys/netgraph/netgraph/ng_base.c
sys/netgraph7/ng_base.c
sys/netinet/if_ether.c
sys/netinet/ip_demux.c
sys/netinet/ip_input.c
sys/netinet/tcp_subr.c
sys/netinet/udp_usrreq.c
sys/netinet6/ip6_input.c
sys/netproto/atalk/ddp_usrreq.c
sys/netproto/atm/atm_subr.c
sys/netproto/ipx/ipx_input.c
sys/netproto/mpls/mpls_input.c
sys/netproto/natm/natm.c
sys/netproto/ns/ns_input.c
sys/sys/protosw.h