File:  [NetBSD Developer Wiki] / wikisrc / projects / project / fast_protocol.mdwn
Revision 1.2: download - view: text, annotated - select for diffs
Tue Jan 3 20:51:24 2017 UTC (2 years, 10 months ago) by riastradh
Branches: MAIN
CVS tags: HEAD
Remove preapproved funding designations.

Per discussion between board and core, these stale designations will
be replaced by something we hope to be more lively and maintained.

[[!template id=project

title="Fast protocol and port demultiplexing"



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 <> software: FreeBSD-CVSweb