From owner-cvs-src-old@FreeBSD.ORG Mon Jun 6 12:55:37 2011 Return-Path: Delivered-To: cvs-src-old@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BE8FC1065781 for ; Mon, 6 Jun 2011 12:55:37 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 900FA8FC1E for ; Mon, 6 Jun 2011 12:55:37 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.4/8.14.4) with ESMTP id p56Ctb1h061414 for ; Mon, 6 Jun 2011 12:55:37 GMT (envelope-from rwatson@repoman.freebsd.org) Received: (from svn2cvs@localhost) by repoman.freebsd.org (8.14.4/8.14.4/Submit) id p56Ctbog061413 for cvs-src-old@freebsd.org; Mon, 6 Jun 2011 12:55:37 GMT (envelope-from rwatson@repoman.freebsd.org) Message-Id: <201106061255.p56Ctbog061413@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: svn2cvs set sender to rwatson@repoman.freebsd.org using -f From: Robert Watson Date: Mon, 6 Jun 2011 12:55:02 +0000 (UTC) To: cvs-src-old@freebsd.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/sys/conf files options src/sys/netinet in_pcb.c in_pcb.h in_pcbgroup.c ip_divert.c raw_ip.c tcp_subr.c tcp_syncache.c udp_usrreq.c src/sys/netinet/ipfw ip_fw2.c src/sys/netinet6 in6_pcb.c in6_pcb.h in6_pcbgroup.c X-BeenThere: cvs-src-old@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: **OBSOLETE** CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Jun 2011 12:55:37 -0000 rwatson 2011-06-06 12:55:02 UTC FreeBSD src repository Modified files: sys/conf files options sys/netinet in_pcb.c in_pcb.h ip_divert.c raw_ip.c tcp_subr.c tcp_syncache.c udp_usrreq.c sys/netinet/ipfw ip_fw2.c sys/netinet6 in6_pcb.c in6_pcb.h Added files: sys/netinet in_pcbgroup.c sys/netinet6 in6_pcbgroup.c Log: SVN rev 222748 on 2011-06-06 12:55:02Z by rwatson 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. Revision Changes Path 1.1605 +2 -0 src/sys/conf/files 1.731 +1 -0 src/sys/conf/options 1.281 +225 -4 src/sys/netinet/in_pcb.c 1.151 +82 -4 src/sys/netinet/in_pcb.h 1.1 +457 -0 src/sys/netinet/in_pcbgroup.c (new) 1.171 +2 -1 src/sys/netinet/ip_divert.c 1.56 +4 -0 src/sys/netinet/ipfw/ip_fw2.c 1.237 +2 -1 src/sys/netinet/raw_ip.c 1.380 +2 -1 src/sys/netinet/tcp_subr.c 1.190 +8 -1 src/sys/netinet/tcp_syncache.c 1.280 +2 -1 src/sys/netinet/udp_usrreq.c 1.127 +167 -0 src/sys/netinet6/in6_pcb.c 1.28 +10 -0 src/sys/netinet6/in6_pcb.h 1.1 +103 -0 src/sys/netinet6/in6_pcbgroup.c (new)