Commit b62d0f3
committed
net: sharded PCB hash table, kill TCP_DEMUX (Phase 6b)
Replace the single-lock PcbTable + shadow TcpDemuxTable with a unified
sharded design: 16 independently-locked TcpShard instances for
established connections (SYN_SENT, SYN_RECV, DATA, TIME_WAIT) plus a
separate ListenerTable for LISTEN sockets.
Architecture:
- TCP_SHARDS: [IrqMutex<TcpShard>; 16], each with 8 PCB + 8 buffer slots
- TCP_LISTENERS: IrqMutex<ListenerTable> with 16 slots, linear scan
- FNV-1a hash on the full 4-tuple selects the shard; O(8) scan within
- ConnId encodes (shard, slot) or (listener, slot) in a u32
- All locks at LOCK_LEVEL_RESOURCE; never hold two simultaneously
- input() locks one shard for established, falls back to listener table
for SYNs, then locks the child's shard to install — three sequential
lock acquisitions, never nested
Deleted: TcpDemuxTable, TcpDemuxBucket, TcpEstablishedEntry,
TcpListenerEntry, TCP_DEMUX, TCP_DEMUX_BUCKETS_TABLE, tcp_demux_hash,
and all register/unregister/lookup calls in socket.rs and ipv4.rs
(~300 lines removed from listener.rs, ~35 from ipv4.rs, ~25 from
socket.rs). The sharded table is the single source of truth.
Zero unsafe blocks throughout.1 parent aa5de6a commit b62d0f3
10 files changed
Lines changed: 805 additions & 1089 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | 211 | | |
246 | 212 | | |
247 | 213 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
894 | 894 | | |
895 | 895 | | |
896 | 896 | | |
897 | | - | |
898 | | - | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
899 | 901 | | |
900 | | - | |
901 | | - | |
902 | | - | |
903 | | - | |
904 | | - | |
905 | | - | |
906 | | - | |
907 | | - | |
908 | | - | |
909 | | - | |
910 | | - | |
911 | | - | |
912 | | - | |
913 | | - | |
914 | | - | |
915 | | - | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
916 | 905 | | |
917 | 906 | | |
918 | 907 | | |
| |||
1409 | 1398 | | |
1410 | 1399 | | |
1411 | 1400 | | |
1412 | | - | |
1413 | | - | |
1414 | | - | |
1415 | | - | |
1416 | | - | |
1417 | 1401 | | |
| 1402 | + | |
1418 | 1403 | | |
1419 | 1404 | | |
1420 | 1405 | | |
| |||
2126 | 2111 | | |
2127 | 2112 | | |
2128 | 2113 | | |
2129 | | - | |
| 2114 | + | |
2130 | 2115 | | |
2131 | 2116 | | |
2132 | 2117 | | |
| |||
2173 | 2158 | | |
2174 | 2159 | | |
2175 | 2160 | | |
2176 | | - | |
2177 | | - | |
2178 | | - | |
2179 | | - | |
| 2161 | + | |
| 2162 | + | |
2180 | 2163 | | |
2181 | | - | |
2182 | | - | |
2183 | | - | |
2184 | | - | |
2185 | 2164 | | |
2186 | 2165 | | |
2187 | 2166 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
151 | | - | |
152 | | - | |
| 151 | + | |
| 152 | + | |
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
| |||
0 commit comments