TODO.smpnet revision 1.13
1$NetBSD: TODO.smpnet,v 1.13 2017/08/10 09:26:55 ozaki-r Exp $
2
3MP-safe components
4==================
5
6 - Device drivers
7   - vioif(4)
8   - vmx(4)
9   - wm(4)
10   - ixg(4)
11   - ixv(4)
12 - Layer 2
13   - Ethernet (if_ethersubr.c)
14   - bridge(4)
15     - STP
16   - Fast forward (ipflow)
17 - Layer 3
18   - All except for items in the below section
19 - Interfaces
20   - gif(4)
21   - l2tp(4)
22   - pppoe(4)
23     - if_spppsubr.c
24   - tun(4)
25   - vlan(4)
26 - Packet filters
27   - npf(7)
28 - Others
29   - bpf(4)
30   - ipsec(4)
31   - opencrypto(9)
32   - pfil(9)
33
34Non MP-safe components and kernel options
35=========================================
36
37 - Device drivers
38   - Most drivers other than ones listed in the above section
39 - Layer 2
40   - ARCNET (if_arcsubr.c)
41   - ATM (if_atmsubr.c)
42   - BRIDGE_IPF
43   - if_ecosubr.c
44   - FDDI (if_fddisubr.c)
45   - HIPPI (if_hippisubr.c)
46   - IEEE 1394 (if_ieee1394subr.c)
47   - IEEE 802.11 (ieee80211(4))
48   - Token ring (if_tokensubr.c)
49 - Layer 3
50   - IPSELSRC
51   - MROUTING
52   - PIM
53   - MPLS (mpls(4))
54 - Layer 4
55   - DCCP
56   - SCTP
57   - TCP
58   - UDP
59 - Interfaces
60   - agr(4)
61   - carp(4)
62   - etherip(4)
63   - faith(4)
64   - gre(4)
65   - ppp(4)
66   - sl(4)
67   - stf(4)
68   - strip(4)
69   - if_srt
70   - tap(4)
71 - Packet filters
72   - ipf(4)
73   - pf(4)
74 - Others
75   - AppleTalk (sys/netatalk/)
76   - ATM (sys/netnatm/)
77   - Bluetooth (sys/netbt/)
78   - altq(4)
79   - CIFS (sys/netsmb/)
80   - ISDN (sys/netisbn/)
81   - kttcp(4)
82   - NFS
83
84Know issues
85===========
86
87bpf
88---
89
90MP-ification of bpf requires all of bpf_mtap* are called in normal LWP context
91or softint context, i.e., not in hardware interrupt context.  For Tx, all
92bpf_mtap satisfy the requrement.  For Rx, most of bpf_mtap are called in softint.
93Unfortunately some bpf_mtap on Rx are still called in hardware interrupt context.
94
95This is the list of the functions that have such bpf_mtap:
96
97 - sca_frame_process() @ sys/dev/ic/hd64570.c
98 - en_intr() @ sys/dev/ic/midway.c
99 - rxintr_cleanup() and txintr_cleanup() @ sys/dev/pci/if_lmc.c
100 - ipr_rx_data_rdy() @ sys/netisdn/i4b_ipr.c
101
102Ideally we should make the functions run in softint somehow, but we don't have
103actual devices, no time (or interest/love) to work on the task, so instead we
104provide a deferred bpf_mtap mechanism that forcibly runs bpf_mtap in softint
105context.  It's a workaround and once the functions run in softint, we should use
106the original bpf_mtap again.
107
108Lingering obsolete variables
109-----------------------------
110
111Some obsolete global variables and member variables of structures remain to
112avoid breaking old userland programs which directly access such variables via
113kvm(3).
114
115The following programs still use kvm(3) to get some information related to
116the network stack.
117
118 - netstat(1)
119 - vmstat(1)
120 - fstat(1)
121
122netstat(1) accesses ifnet_list, the head of a list of interface objects
123(struct ifnet), and traverses each object through ifnet#if_list member variable.
124ifnet_list and ifnet#if_list is obsoleted by ifnet_pslist and
125ifnet#if_pslist_entry respectively. netstat also accesses the IP address list
126of an interface throught ifnet#if_addrlist. struct ifaddr, struct in_ifaddr
127and struct in6_ifaddr are accessed and the following obsolete member variables
128are stuck: ifaddr#ifa_list, in_ifaddr#ia_hash, in_ifaddr#ia_list,
129in6_ifaddr#ia_next and in6_ifaddr#_ia6_multiaddrs. Note that netstat already
130implements alternative methods to fetch the above information via sysctl(3).
131
132vmstat(1) shows statistics of hash tables created by hashinit(9) in the kernel.
133The statistic information is retrieved via kvm(3). The global variables
134in_ifaddrhash and in_ifaddrhashtbl, which are for a hash table of IPv4
135addresses and obsoleted by in_ifaddrhash_pslist and in_ifaddrhashtbl_pslist,
136are kept for this purpose. We should provide a means to fetch statistics of
137hash tables via sysctl(3).
138
139fstat(1) shows information of bpf instances. Each bpf instance (struct bpf) is
140obtained via kvm(3). bpf_d#_bd_next, bpf_d#_bd_filter and bpf_d#_bd_list
141member variables are obsolete but remain. ifnet#if_xname is also accessed
142via struct bpf_if and obsolete ifnet#if_list is required to remain to not change
143the offset of ifnet#if_xname. The statistic counters (bpf#bd_rcount,
144bpf#bd_dcount and bpf#bd_ccount) are also victims of this restriction; for
145scalability the statistic counters should be per-CPU and we should stop using
146atomic operations for them however we have to remain the counters and atomic
147operations.
148
149Scalability
150-----------
151
152 - Per-CPU rtcaches (used in say IP forwarding) aren't scalable on multiple
153   flows per CPU
154 - ipsec(4) isn't scalable on the number of SA/SP; the cost of a look-up
155   is O(n)
156