freebsd-dev/sys/netinet/ipfw
Robert Watson 52cd27cb58 Implement a CPU-affine TCP and UDP connection lookup data structure,
struct inpcbgroup.  pcbgroups, or "connection groups", supplement the
existing inpcbinfo connection hash table, which when pcbgroups are
enabled, might now be thought of more usefully as a per-protocol
4-tuple reservation table.

Connections are assigned to connection groups base on a hash of their
4-tuple; wildcard sockets require special handling, and are members
of all connection groups.  During a connection lookup, a
per-connection group lock is employed rather than the global pcbinfo
lock.  By aligning connection groups with input path processing,
connection groups take on an effective CPU affinity, especially when
aligned with RSS work placement (see a forthcoming commit for
details).  This eliminates cache line migration associated with
global, protocol-layer data structures in steady state TCP and UDP
processing (with the exception of protocol-layer statistics; further
commit to follow).

Elements of this approach were inspired by Willman, Rixner, and Cox's
2006 USENIX paper, "An Evaluation of Network Stack Parallelization
Strategies in Modern Operating Systems".  However, there are also
significant differences: we maintain the inpcb lock, rather than using
the connection group lock for per-connection state.

Likewise, the focus of this implementation is alignment with NIC
packet distribution strategies such as RSS, rather than pure software
strategies.  Despite that focus, software distribution is supported
through the parallel netisr implementation, and works well in
configurations where the number of hardware threads is greater than
the number of NIC input queues, such as in the RMI XLR threaded MIPS
architecture.

Another important difference is the continued maintenance of existing
hash tables as "reservation tables" -- these are useful both to
distinguish the resource allocation aspect of protocol name management
and the more common-case lookup aspect.  In configurations where
connection tables are aligned with hardware hashes, it is desirable to
use the traditional lookup tables for loopback or encapsulated traffic
rather than take the expense of hardware hashes that are hard to
implement efficiently in software (such as RSS Toeplitz).

Connection group support is enabled by compiling "options PCBGROUP"
into your kernel configuration; for the time being, this is an
experimental feature, and hence is not enabled by default.

Subject to the limited MFCability of change dependencies in inpcb,
and its change to the inpcbinfo init function signature, this change
in principle could be merged to FreeBSD 8.x.

Reviewed by:    bz
Sponsored by:   Juniper Networks, Inc.
2011-06-06 12:55:02 +00:00
..
test Add a priority-based packet scheduler. 2010-03-21 16:30:32 +00:00
dn_heap.c fix a comment and final empty line 2010-07-15 14:37:02 +00:00
dn_heap.h don't use C++ keywords as variable names 2010-03-08 11:27:08 +00:00
dn_sched_fifo.c Bring in the most recent version of ipfw and dummynet, developed 2010-03-02 17:40:48 +00:00
dn_sched_prio.c Add a priority-based packet scheduler. 2010-03-21 16:30:32 +00:00
dn_sched_qfq.c Whitespace changes to reduce diffs wrt the most recent ipfw/dummynet code: 2010-09-28 22:46:13 +00:00
dn_sched_rr.c whitespace fixes (trailing whitespace, bad indentation 2010-04-19 16:17:30 +00:00
dn_sched_wf2q.c whitespace changes in preparation for future commits 2010-09-29 09:40:20 +00:00
dn_sched.h whitespace changes in preparation for future commits 2010-09-29 09:40:20 +00:00
dummynet.txt Bring in the most recent version of ipfw and dummynet, developed 2010-03-02 17:40:48 +00:00
ip_dn_glue.c Convert delay parameter back to ms when reporting to user. 2011-05-06 07:13:34 +00:00
ip_dn_io.c Add sysctl handlers for net.inet.ip.dummynet.hash_size, .pipe_byte_limit 2011-04-19 11:33:39 +00:00
ip_dn_private.h Whitespace changes to reduce diffs wrt the most recent ipfw/dummynet code: 2010-09-28 22:46:13 +00:00
ip_dummynet.c Hide some debug messages under debug macro. 2011-06-01 12:33:05 +00:00
ip_fw2.c Implement a CPU-affine TCP and UDP connection lookup data structure, 2011-06-06 12:55:02 +00:00
ip_fw_dynamic.c Hide useless warning under debug macro. 2011-06-01 12:05:35 +00:00
ip_fw_log.c o Some programs could send broadcast/multicast traffic to ipfw 2010-08-30 09:29:51 +00:00
ip_fw_nat.c Use size_t for sopt_valsize. 2011-04-21 08:18:55 +00:00
ip_fw_pfil.c After some off-list discussion, revert a number of changes to the 2010-11-22 19:32:54 +00:00
ip_fw_private.h - Rewrite functions that copyin/out NAT configuration, so that they 2011-04-19 15:06:33 +00:00
ip_fw_sockopt.c Do not return EINVAL when user does ipfw set N flush on an empty set. 2011-06-06 10:39:38 +00:00
ip_fw_table.c no need for ipfw_flush_tables(), we just need ipfw_destroy_tables() 2010-03-21 15:54:07 +00:00