a port here is a physical interface used by an aggr.
this leaves the low bits for a physical interface to use to pick a
tx ring. without this, aggr used low bits for port selection, which
takes bits away from the ring selection, which can lead to uneven
distribution of packets over tx rings.
ive been running this in production for well over a year now.
-/* $OpenBSD: if_aggr.c,v 1.43 2024/03/04 04:44:12 dlg Exp $ */
+/* $OpenBSD: if_aggr.c,v 1.44 2024/03/18 06:05:23 dlg Exp $ */
/*
* Copyright (c) 2019 The University of Queensland
* aggr interface
*/
-#define AGGR_MAX_PORTS 32
+#define AGGR_PORT_BITS 5
+#define AGGR_FLOWID_SHIFT (16 - AGGR_PORT_BITS)
+
+#define AGGR_MAX_PORTS (1 << AGGR_PORT_BITS)
#define AGGR_MAX_SLOW_PKTS (AGGR_MAX_PORTS * 3)
struct aggr_multiaddr {
#endif
if (ISSET(m->m_pkthdr.csum_flags, M_FLOWID))
- flow = m->m_pkthdr.ph_flowid;
+ flow = m->m_pkthdr.ph_flowid >> AGGR_FLOWID_SHIFT;
ifp0 = map->m_ifp0s[flow % AGGR_MAX_PORTS];