On Mon, Apr 23, 2018 at 07:51:00PM +0000, Sean Bruno wrote: > Author: sbruno > Date: Mon Apr 23 19:51:00 2018 > New Revision: 332894 > URL: https://svnweb.freebsd.org/changeset/base/332894 > > Log: > Load balance sockets with new SO_REUSEPORT_LB option > > This patch adds a new socket option, SO_REUSEPORT_LB, which allow multiple > programs or threads to bind to the same port and incoming connections will > be > load balanced using a hash function. > > Most of the code was copied from a similar patch for DragonflyBSD. > > However, in DragonflyBSD, load balancing is a global on/off setting and can > not > be set per socket. This patch allows for simultaneous use of both the > current > SO_REUSEPORT and the new SO_REUSEPORT_LB options on the same system. > > Required changes to structures > Globally change so_options from 16 to 32 bit value to allow for more > options. > Add hashtable in pcbinfo to hold all SO_REUSEPORT_LB sockets. > > Limitations > As DragonflyBSD, a load balance group is limited to 256 pcbs > (256 programs or threads sharing the same socket). > > Submitted by: Johannes Lundberg <johanl...@gmail.com> > Sponsored by: Limelight Networks > Differential Revision: https://reviews.freebsd.org/D11003 > > Modified: > head/cddl/lib/libdtrace/tcp.d > head/sys/kern/uipc_debug.c > head/sys/kern/uipc_socket.c > head/sys/netinet/in_pcb.c > head/sys/netinet/in_pcb.h > head/sys/netinet/ip_output.c > head/sys/netinet/tcp_subr.c > head/sys/netinet/udp_usrreq.c > head/sys/netinet6/in6_pcb.c > head/sys/netinet6/in6_src.c > head/sys/netinet6/ip6_output.c > head/sys/netinet6/udp6_usrreq.c > head/sys/sys/socket.h > head/sys/sys/socketvar.h > > Modified: head/cddl/lib/libdtrace/tcp.d > ============================================================================== > --- head/cddl/lib/libdtrace/tcp.d Mon Apr 23 18:33:26 2018 > (r332893) > +++ head/cddl/lib/libdtrace/tcp.d Mon Apr 23 19:51:00 2018 > (r332894) > @@ -192,12 +192,12 @@ translator tcpsinfo_t < struct tcpcb *p > { > tcps_rport = p == NULL ? 0 : > ntohs(p->t_inpcb->inp_inc.inc_ie.ie_fport); > tcps_laddr = p == NULL ? 0 : > p->t_inpcb->inp_vflag == INP_IPV4 ? > - > inet_ntoa(&p->t_inpcb->inp_inc.inc_ie.ie_dependladdr.ie46_local.ia46_addr4.s_addr) > : > - inet_ntoa6(&p->t_inpcb->inp_inc.inc_ie.ie_dependladdr.ie6_local); > + > inet_ntoa(&p->t_inpcb->inp_inc.inc_ie.ie_dependladdr.id46_addr.ia46_addr4.s_addr) > : > + inet_ntoa6(&p->t_inpcb->inp_inc.inc_ie.ie_dependladdr.id6_addr); > tcps_raddr = p == NULL ? 0 : > p->t_inpcb->inp_vflag == INP_IPV4 ? > - > inet_ntoa(&p->t_inpcb->inp_inc.inc_ie.ie_dependfaddr.ie46_foreign.ia46_addr4.s_addr) > : > - inet_ntoa6(&p->t_inpcb->inp_inc.inc_ie.ie_dependfaddr.ie6_foreign); > + > inet_ntoa(&p->t_inpcb->inp_inc.inc_ie.ie_dependfaddr.id46_addr.ia46_addr4.s_addr) > : > + inet_ntoa6(&p->t_inpcb->inp_inc.inc_ie.ie_dependfaddr.id6_addr); > tcps_state = p == NULL ? -1 : p->t_state; > tcps_iss = p == NULL ? 0 : p->iss; > tcps_irs = p == NULL ? 0 : p->irs;
A similar change is needed in udp.d. Without it, libdtrace fails to compile its libraries when initializing a consumer, so dtrace(1) is currently unusable on head without "-x nolibs". _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"