This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
[PATCH v2 33/45] Load balance sockets with new SO_REUSEPORT_LB option
- From: Sebastian Huber <sebastian dot huber at embedded-brains dot de>
- To: newlib at sourceware dot org
- Date: Fri, 10 Aug 2018 07:54:28 +0200
- Subject: [PATCH v2 33/45] Load balance sockets with new SO_REUSEPORT_LB option
- References: <20180810055440.22127-1-sebastian.huber@embedded-brains.de>
From: sbruno <sbruno@FreeBSD.org>
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 <johanlun0@gmail.com>
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D11003
---
newlib/libc/sys/rtems/include/sys/socket.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/newlib/libc/sys/rtems/include/sys/socket.h b/newlib/libc/sys/rtems/include/sys/socket.h
index 345eaa83f..19062c5ee 100644
--- a/newlib/libc/sys/rtems/include/sys/socket.h
+++ b/newlib/libc/sys/rtems/include/sys/socket.h
@@ -147,6 +147,9 @@ typedef __uintptr_t uintptr_t;
#define SO_NO_OFFLOAD 0x4000 /* socket cannot be offloaded */
#define SO_NO_DDP 0x8000 /* disable direct data placement */
+// XXX: so_options was only 16 bit, now globally increased to 32 bit
+#define SO_REUSEPORT_LB 0x00010000 /* reuse with load balancing */
+
/*
* Additional options, not kept in so_options.
*/
--
2.13.7