Main index | Section 9 | Options |
#include <sys/param.h>
#include <netinet/in.h>
#include <netinet/in_pcb.h>
#include <netinet6/in6_pcb.h>
Internet protocols like UDP and TCP register to use connection groups by providing an ipi_hashfields value other than IPI_HASHFIELDS_NONE. This indicates to the connection group code whether a 2-tuple or 4-tuple is used as an argument to hashes that assign a connection to a particular group. This must be aligned with any hardware-offloaded distribution model, such as RSS or similar approaches taken in embedded network boards. Wildcard sockets require special handling, as in Willmann 2006, and are shared between connection groups while being protected by group-local locks. Connection establishment and teardown can be signficantly more expensive than without connection groups, but that steady-state processing can be significantly faster.
Enabling PCBGROUP in the kernel only provides the infrastructure required to create and manage multiple PCB groups. An implementation needs to fill in a few functions to provide PCB group hash information in order for PCBs to be placed in a PCB group.
Add a connection to a PCBGROUP with in_pcbgroup_update(). Connections are removed by with in_pcbgroup_remove(). These in turn will determine which PCBGROUP bucket the given PCB is placed into and calculate the hash value appropriately.
Wildcard PCBs are hashed differently and placed in a single wildcard PCB list. If RSS(9) is enabled and in use, RSS-aware wildcard PCBs are placed in a single PCBGROUP based on RSS information. Protocols may look up the PCB entry in a PCBGROUP by using the lookup functions in_pcbgroup_byhash() and in_pcbgroup_byinpcb().
An implementor wishing to experiment or modify the PCBGROUP assignment should modify this set of functions:
in_pcbgroup_getbucket() andin6_pcbgroup_getbucket() | |
Map a given 32 bit hash value to a PCBGROUP. By default this is hash % number_of_pcbgroups. However, this distribution may not align with NIC receive queues or the netisr(9) configuration. | |
in_pcbgroup_byhash() andin6_pcbgroup_byhash() | |
Map a 32 bit hash value and a hash type identifier to a PCBGROUP. By default, this simply returns NULL. This function is used by the mbuf(9) receive path in sys/netinet/in_pcb.c to map an mbuf to a PCBGROUP. | |
in_pcbgroup_bytuple() andin6_pcbgroup_bytuple() | |
Map the source and destination address and port details to a PCBGROUP. By default, this does a very simple XOR hash. This function is used by both the PCB lookup code and as a fallback in the mbuf(9) receive path in sys/netinet/in_pcb.c. | |
2006 USENIX Annual Technical Conference, An Evaluation of Network Stack Parallelization Strategies in Modern Operating Systems, 2006.
, , ,This manual page written by Adrian Chadd <Mt adrian@FreeBSD.org>.
There is currently no support for re-balancing the PCBGROUP assignment, nor is there any support for overriding which PCBGROUP a socket/PCB should be in.
No statistics are kept to indicate how often PCBGROUP lookups succeed or fail.
PCBGROUP (9) | July 23, 2014 |
Main index | Section 9 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.
“ | How do you pronounce UNIX ? You Nix ! | ” |