diff options
| author | Andrew Gallatin <gallatin@FreeBSD.org> | 2025-12-15 16:52:48 +0000 |
|---|---|---|
| committer | Andrew Gallatin <gallatin@FreeBSD.org> | 2025-12-15 17:08:59 +0000 |
| commit | 7ff3b13f12d97b7f67f09ecb9141e6dbaa1ad007 (patch) | |
| tree | d6482792ef0515f3c98ad1e7b7fe14f776078f86 | |
| parent | 1291523fde5f953f1c12b7ab4e15bc8b4cd4c3d2 (diff) | |
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
| -rw-r--r-- | sys/net/ieee8023ad_lacp.c | 26 |
1 files changed, 25 insertions, 1 deletions
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); |
