[[!template id=project
title="Fast protocol and port demultiplexing"
contact="""
[tech-kern](mailto:tech-kern@NetBSD.org),
[tech-net](mailto:tech-net@NetBSD.org),
[board](mailto:board@NetBSD.org),
[core](mailto:core@NetBSD.org)
"""
category="networking"
difficulty="hard"
description="""
This project proposal is a subtask of [[smp_networking]].
The goal of this project is to enhance the networking protocols to process
incoming packets more efficiently. The basic idea is the following: when a
packet is received and it is destined for a socket, simply place the packet
in the socket's receive PCQ (see [[atomic_pcq]]) and wake the blocking
socket. Then, the protocol is able to process the next packet.
The typical packet flow from `ip_input` is to `{rip,tcp,udp}_input` which:
* Does the lookup to locate the socket which takes a reader lock on the
appropriate pcbtable's hash bucket.
* If found and in the proper state:
* Do not lock the socket since that would might block and therefore stop
packet demultiplexing.
* `pcq_put` the packet to the pcb's pcq.
* `kcont_schedule` the worker continuation with small delay (~100ms).
See [[kernel_continuations]].
* Lock the socket's `cvmutex`.
* Release the pcbtable lock.
* If TCP and in sequence, then if we need to send an immediate ACK:
* Try to lock the socket.
* If successful, send an ACK.
* Set a flag to process the PCQ.
* `cv_signal` the socket's cv.
* Release the cvmutex.
* If not found or not in the proper state:
* Release the pcb hash table lock.
"""
]]
[[!tag smp_networking]]
CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb