icmp: Asynchonize ctlinput/mtudisc/redirect processing
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Mon, 24 Nov 2014 01:59:41 +0000 (09:59 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Wed, 17 Dec 2014 13:34:07 +0000 (21:34 +0800)
commit130b7902de98ca52e39d03d35a30d759df0cc2fc
tree48093708e433f1b4cb4bd75e1bf42cc4948f04c2
parent7f515ee3e81bc8ee2d01adbd3ed2f7071d6f65c5
icmp: Asynchonize ctlinput/mtudisc/redirect processing

Supportive facilities added:
- Embed netmsg_ctlinput into mbuf (used by input ICMP datagram) so that
  we don't need to do additional memory allocation to forward the
  pr_ctlinput to all netisrs for certain types of ICMP datagrams.
- Add/Expose so_pr_ctlport().
- Return target netisr's cpuid from pr_ctlport.  If the returned cpuid
  equals to ncpus, it means that pr_ctlinput needs to be run in all
  netisrs.
- Support 'direct' mode for TCP/UDP's pr_ctlinput.  The caller of the
  'direct' mode pr_ctlinput will do the message forwarding.

ICMP pr_ctlinput/mtudisc/redirect processing changes:
- For mtudisc and redirect we unconditionally forward the message
  embedded in input ICMP datagram to all netisrs, and call pr_ctlinput
  in 'direct' mode.
- For pr_ctlinput, we first call so_pr_ctlport() to see whether we need
  to forward the message embedded in input ICMP datagram to all netisrs,
  and act accordingly.
- Once pr_ctlinput/mtudisc/redirect processing is done, the message
  embedded in the input ICMP datagram is forwarded back to the netisr0
  to run rip_input().

After this commit, netisr0 will not be blocked for ICMP pr_ctlinput/
mtudisc/redirect processing.  This also fixes the mtudisc (originally
only cpu0's routes get mtu updates).
15 files changed:
sys/kern/uipc_domain.c
sys/kern/uipc_msg.c
sys/net/netisr.c
sys/net/netmsg.h
sys/net/route.c
sys/net/route.h
sys/netinet/ip_demux.c
sys/netinet/ip_icmp.c
sys/netinet/tcp_subr.c
sys/netinet/tcp_var.h
sys/netinet/udp_usrreq.c
sys/netinet/udp_var.h
sys/sys/mbuf.h
sys/sys/protosw.h
sys/sys/socketops.h