CPU localize dummynet(4) step 1/2
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Fri, 16 Nov 2007 02:45:45 +0000 (02:45 +0000)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Fri, 16 Nov 2007 02:45:45 +0000 (02:45 +0000)
commit84a3e25a9678d1a49d321533d3aa0620bbe87a7c
treed403b848d4599e2844920d6995cf3451269bfa4f
parentbb1a3ed4754e83c8acd06c84106b79584843f8ca
CPU localize dummynet(4) step 1/2

       CPU ip_dn_cpu                             CPU n1
+--------------------------+            +---------------------+
|          netisr          |            |                     |
|            |             |            |                     |
|            +<---------------dn_descX----[ip_fw_dn_io_ptr()] |
|            |             |            |                     |
| [ip_dn_io_ptr(dn_descX)] |            |                     |
|            |             |            |                     |
|            |             |            |                     |
|            |             |            |                     |
| [transmit_event() begin  |            |                     |
|            +----------------dn_descY------>[ip_output()]    |
|            :             |            |                     |
|            :             |            |                     |
|            :             |            +---------------------+
|            :             |
|            :             |
|            :             |                     CPU n2
|            :             |            +---------------------+
|            :             |            |                     |
|            +----------------dn_descZ------>[ip_input()]     |
|            :             |            |                     |
|  transmit_event() end]   |            +---------------------+
|            |             |
+--------------------------+

NOTE: transmit_event() is triggered by dummynet systimer on CPU ip_dn_cpu

- Add flow id field, which is packet filter independent, in dummynet
  descriptor, so that we can record the flow id realted information on the
  originator's stack.  In this way, dummynet descriptor and its associated
  mbuf could be dispatched to different thread for further processing.
- Add packet filter private data and private data unreference function
  pointer in dummynet descriptor.
- All of the dummynet descriptor is allocated and filled by packet filter
  (only ipfw(4) currently), so things like route entry reference is updated
  on the CPU to which it belongs.
- All packets are dispatched to netisr on CPU ip_dn_cpu to be queued on the
  target flow queue.  Netisr on CPU ip_dn_cpu is also where various dummynet
  events got processed.
- DUMMYNET_LOADED is not checked before dispatching a packet; it is checked
  in netisr before the packet is handed to dummynet.  This paves the way for
  step 2/2.
- ip_{output,input}/ether_{demux,output_frame} is no longer called directly
  in dummynet, they are called after packet dispatched back to the originator
  CPU, so that ip_input() will be called on the same CPU (as determined by
  ip_mport()) and things like route entry reference will be updated on the
  CPU to which it belongs.
- If the packet is to be dispatched back to ip_output(), the recorded route
  entry is checked to make sure that it is still up.
- Dummynet discriptor and its associated mbuf is freed on their originator CPU.
- Reference count the ipfw(4) rule if it is going to be associated with a
  dummynet descriptor, so we would not have a dangling rule pointer if the
  rule was deleted when the dummynet descriptor was in transit state.
Suggested-by: dillon@
- If ipfw(4) is compiled and loaded as module, reference count the ipfw(4)
  module usage, if a rule is associated with a dummynet descriptor.
- Add net/dummynet/ip_dummynet_glue.c, which contains various netisr dispatch
  function.  This file will be compiled into kernel if 'options INET' is set,
  so that we will not have a dangling function pointer in transitting dummynet
  descriptor.
- Add DUMMYNET_MBUF_TAGGED mbuf fw_flag, which may be used later.
- Nuke dummynet's dependency on ipfw(4).
sys/conf/files
sys/net/dummynet/Makefile
sys/net/dummynet/ip_dummynet.c
sys/net/dummynet/ip_dummynet.h
sys/net/dummynet/ip_dummynet_glue.c [new file with mode: 0644]
sys/net/if_ethersubr.c
sys/net/ipfw/ip_fw2.c
sys/net/ipfw/ip_fw2.h
sys/netinet/ip_input.c
sys/netinet/ip_output.c
sys/sys/mbuf.h