NetBSD/sys/net
ozaki-r fe6d427551 Avoid storing a pointer of an interface in a mbuf
Having a pointer of an interface in a mbuf isn't safe if we remove big
kernel locks; an interface object (ifnet) can be destroyed anytime in any
packet processing and accessing such object via a pointer is racy. Instead
we have to get an object from the interface collection (ifindex2ifnet) via
an interface index (if_index) that is stored to a mbuf instead of an
pointer.

The change provides two APIs: m_{get,put}_rcvif_psref that use psref(9)
for sleep-able critical sections and m_{get,put}_rcvif that use
pserialize(9) for other critical sections. The change also adds another
API called m_get_rcvif_NOMPSAFE, that is NOT MP-safe and for transition
moratorium, i.e., it is intended to be used for places where are not
planned to be MP-ified soon.

The change adds some overhead due to psref to performance sensitive paths,
however the overhead is not serious, 2% down at worst.

Proposed on tech-kern and tech-net.
2016-06-10 13:31:43 +00:00
..
agr Introduce m_set_rcvif and m_reset_rcvif 2016-06-10 13:27:10 +00:00
npf Protect ifnet list with psz and psref 2016-05-12 02:24:16 +00:00
bpf_filter.c Create separate modules for i2c_bitbang and bpf_filter so these files 2016-06-07 01:06:27 +00:00
bpf_stub.c
bpf.c Avoid storing a pointer of an interface in a mbuf 2016-06-10 13:31:43 +00:00
bpf.h Uses _IOR/_IOW/etc. and thus needs sys/ioccom.h. PR 41200 2015-09-05 20:01:21 +00:00
bpfdesc.h
bpfjit.c Adapt to the new version of sljit@r313. 2016-05-29 17:20:22 +00:00
bpfjit.h Fix copyright years. 2014-06-25 19:32:37 +00:00
bridgestp.c Introduce m_set_rcvif and m_reset_rcvif 2016-06-10 13:27:10 +00:00
bsd-comp.c
dl_print.c pretty-print link addresses. 2016-04-06 18:04:58 +00:00
dlt.h update with new entries from libpcap-1.7.2 2015-03-31 21:42:16 +00:00
ethertypes.h
files.net Update dependency: zlib is only needed for the swcrypto device, not for 2016-04-05 22:51:01 +00:00
files.pf
if_arc.h
if_arcsubr.c Constify remaining rtentry of if_output (fix build) 2016-04-28 14:40:09 +00:00
if_arp.h Replace ARP cache (llinfo) with lltable/llentry 2015-08-31 08:05:20 +00:00
if_atm.h Constify rtentry of if_output 2016-04-28 00:16:56 +00:00
if_atmsubr.c Introduce m_set_rcvif and m_reset_rcvif 2016-06-10 13:27:10 +00:00
if_bridge.c Avoid storing a pointer of an interface in a mbuf 2016-06-10 13:31:43 +00:00
if_bridgevar.h Constify rtentry of if_output 2016-04-28 00:16:56 +00:00
if_dl.h add DL_PRINT macro 2014-12-03 01:31:37 +00:00
if_eco.h
if_ecosubr.c IFQ_ENQUEUE refactor (3/3) : eliminate pktattr argument from IFQ_ENQUEUE caller 2016-04-20 09:01:03 +00:00
if_ether.h Add handling of VLAN packets in if_bridge where the parent interface supports 2015-11-19 16:23:54 +00:00
if_etherip.c sprinkle _KERNEL_OPT 2015-08-24 22:21:26 +00:00
if_etherip.h
if_ethersubr.c Constify rtentry of if_output 2016-04-28 00:16:56 +00:00
if_faith.c Introduce m_set_rcvif and m_reset_rcvif 2016-06-10 13:27:10 +00:00
if_faith.h
if_fddi.h
if_fddisubr.c Constify rtentry of if_output 2016-04-28 00:16:56 +00:00
if_gif.c Introduce m_set_rcvif and m_reset_rcvif 2016-06-10 13:27:10 +00:00
if_gif.h modify some functions static. no functional change. 2016-05-31 03:52:40 +00:00
if_gre.c Introduce m_set_rcvif and m_reset_rcvif 2016-06-10 13:27:10 +00:00
if_gre.h More on PR 41200: headers that declare ioctls should include sys/ioccom.h. 2015-09-06 06:00:59 +00:00
if_hippi.h
if_hippisubr.c Constify rtentry of if_output 2016-04-28 00:16:56 +00:00
if_ieee1394.h
if_ieee1394subr.c introduce new ifnet MP-scalable sending interface "if_transmit". 2016-04-28 01:37:17 +00:00
if_llatbl.c Fill rtm_addrs properly 2016-04-06 08:45:46 +00:00
if_llatbl.h Separate nexthop caches from the routing table 2016-04-04 07:37:07 +00:00
if_llc.h Don't use class as a structure member. 2014-09-05 05:32:07 +00:00
if_loop.c Introduce m_set_rcvif and m_reset_rcvif 2016-06-10 13:27:10 +00:00
if_media.c
if_media.h
if_mpls.c Avoid storing a pointer of an interface in a mbuf 2016-06-10 13:31:43 +00:00
if_mpls.h
if_ppp.c Introduce m_set_rcvif and m_reset_rcvif 2016-06-10 13:27:10 +00:00
if_ppp.h More on PR 41200: headers that declare ioctls should include sys/ioccom.h. 2015-09-06 06:00:59 +00:00
if_pppoe.c Avoid storing a pointer of an interface in a mbuf 2016-06-10 13:31:43 +00:00
if_pppoe.h Hide PPPoE variables from if_ethersubr.c 2016-04-15 01:31:29 +00:00
if_pppvar.h Constify rtentry of if_output 2016-04-28 00:16:56 +00:00
if_sl.c Introduce m_set_rcvif and m_reset_rcvif 2016-06-10 13:27:10 +00:00
if_slvar.h
if_sppp.h More on PR 41200: headers that declare ioctls should include sys/ioccom.h. 2015-09-06 06:00:59 +00:00
if_spppsubr.c Introduce m_set_rcvif and m_reset_rcvif 2016-06-10 13:27:10 +00:00
if_spppvar.h
if_srt.c Constify rtentry of if_output 2016-04-28 00:16:56 +00:00
if_srt.h More on PR 41200: headers that declare ioctls should include sys/ioccom.h. 2015-09-06 06:00:59 +00:00
if_stf.c Avoid storing a pointer of an interface in a mbuf 2016-06-10 13:31:43 +00:00
if_stf.h fix my wrong modification 2016-01-28 00:28:11 +00:00
if_strip.c Introduce m_set_rcvif and m_reset_rcvif 2016-06-10 13:27:10 +00:00
if_stripvar.h
if_tap.c Introduce m_set_rcvif and m_reset_rcvif 2016-06-10 13:27:10 +00:00
if_tap.h More on PR 41200: headers that declare ioctls should include sys/ioccom.h. 2015-09-06 06:00:59 +00:00
if_token.h Fix token_rif extractions from llentry 2015-12-16 05:44:59 +00:00
if_tokensubr.c Constify rtentry of if_output 2016-04-28 00:16:56 +00:00
if_tun.c Introduce m_set_rcvif and m_reset_rcvif 2016-06-10 13:27:10 +00:00
if_tun.h More on PR 41200: headers that declare ioctls should include sys/ioccom.h. 2015-09-06 06:00:59 +00:00
if_types.h
if_vlan.c Introduce m_set_rcvif and m_reset_rcvif 2016-06-10 13:27:10 +00:00
if_vlanvar.h
if.c Avoid storing a pointer of an interface in a mbuf 2016-06-10 13:31:43 +00:00
if.h Avoid storing a pointer of an interface in a mbuf 2016-06-10 13:31:43 +00:00
link_proto.c Revert previous: ran cvs commit when I meant cvs diff. Sorry! 2016-01-21 15:41:29 +00:00
Makefile
net_osdep.h
net_stats.c
net_stats.h Cast return value of _NET_STAT_GETREF 2014-09-05 06:01:24 +00:00
netisr_dispatch.h - Implement pktqueue interface for lockless IP input queue. 2014-06-05 23:48:16 +00:00
netisr.h Remove leftover IPX-related stuffs 2015-05-25 08:29:01 +00:00
pfil.c
pfil.h
pfkeyv2.h
pktqueue.c Fix pktq_enqueue for rump 2014-07-04 01:50:22 +00:00
pktqueue.h Move sysctl_pktq_{maxlen,count} to pktqueue.c and make them global 2014-06-16 00:40:10 +00:00
ppp_defs.h
ppp_tty.c Introduce m_set_rcvif and m_reset_rcvif 2016-06-10 13:27:10 +00:00
ppp-comp.h
ppp-deflate.c Add modular dependency on zlib module. 2016-04-05 23:44:05 +00:00
radix.c sprinkle _KERNEL_OPT 2015-08-24 22:21:26 +00:00
radix.h
raw_cb.c raw_detach: rawpcb may be embedded, free using the real size (saved in rcb). 2014-05-21 20:43:56 +00:00
raw_cb.h Eliminate struct protosw::pr_output. 2016-01-20 21:43:59 +00:00
raw_usrreq.c Eliminate struct protosw::pr_output. 2016-01-20 21:43:59 +00:00
route.c Constify rtentry of if_output 2016-04-28 00:16:56 +00:00
route.h Constify rtentry of if_output 2016-04-28 00:16:56 +00:00
rtbl.c Don't use radix tree API directly 2016-04-11 09:21:18 +00:00
rtsock.c Introduce m_set_rcvif and m_reset_rcvif 2016-06-10 13:27:10 +00:00
slcompress.c sprinkle _KERNEL_OPT 2015-08-24 22:21:26 +00:00
slcompress.h
slip.h More on PR 41200: headers that declare ioctls should include sys/ioccom.h. 2015-09-06 06:00:59 +00:00
zlib.c
zlib.h