The branch main has been updated by gallatin: URL: https://cgit.FreeBSD.org/src/commit/?id=7ff3b13f12d97b7f67f09ecb9141e6dbaa1ad007
commit 7ff3b13f12d97b7f67f09ecb9141e6dbaa1ad007 Author: Andrew Gallatin <[email protected]> AuthorDate: 2025-12-15 16:52:48 +0000 Commit: Andrew Gallatin <[email protected]> CommitDate: 2025-12-15 17:08:59 +0000 lacp: Sort port map by interface index This makes it easier to reason about system topology, and to potentially map applications to NIC queues by (ab)using the mbuf flowid to select egress NIC and queue in a predictable fashion. Differential Revision: https://reviews.freebsd.org/D54053 Reviewed by: glebius, kbowling Sponsored by: Netflix --- sys/net/ieee8023ad_lacp.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/sys/net/ieee8023ad_lacp.c b/sys/net/ieee8023ad_lacp.c index 77b5a5d53a67..281d16bc6c05 100644 --- a/sys/net/ieee8023ad_lacp.c +++ b/sys/net/ieee8023ad_lacp.c @@ -1036,6 +1036,18 @@ lacp_select_active_aggregator(struct lacp_softc *lsc) } } +static int +lacp_pm_compare(const void *p1, const void *p2) +{ + struct lacp_port *const *a = p1; + struct lacp_port *const *b = p2; + int left, right; + + left = (*a)->lp_ifp->if_index; + right = (*b)->lp_ifp->if_index; + return ((left > right) - (left < right)); +} + /* * Updated the inactive portmap array with the new list of ports and * make it live. @@ -1079,12 +1091,24 @@ lacp_update_portmap(struct lacp_softc *lsc) #ifdef NUMA for (i = 0; i < MAXMEMDOM; i++) { - if (p->pm_numa[i].count != 0) + if (p->pm_numa[i].count != 0) { p->pm_num_dom++; + if (p->pm_numa[i].count > 1) { + qsort(&p->pm_numa[i].map[0], + p->pm_numa[i].count, + sizeof(p->pm_numa[i].map[0]), + lacp_pm_compare); + } + } } #endif speed = lacp_aggregator_bandwidth(la); } + + if (p->pm_count > 1) { + qsort(&p->pm_map[0], p->pm_count, + sizeof(p->pm_map[0]), lacp_pm_compare); + } sc->sc_ifp->if_baudrate = speed; EVENTHANDLER_INVOKE(ifnet_event, sc->sc_ifp, IFNET_EVENT_UPDATE_BAUDRATE);
