The branch stable/15 has been updated by kib:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=b86eb36f28dbcf3abcd256dcad8b36ab19843162

commit b86eb36f28dbcf3abcd256dcad8b36ab19843162
Author:     Andrew Gallatin <[email protected]>
AuthorDate: 2025-12-15 16:52:48 +0000
Commit:     Konstantin Belousov <[email protected]>
CommitDate: 2026-07-06 01:35:53 +0000

    lacp: Sort port map by interface index
    
    (cherry picked from commit 7ff3b13f12d97b7f67f09ecb9141e6dbaa1ad007)
---
 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 72c49997f475..02aa1aaa0eee 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);

Reply via email to