diff --git a/sys/net/ieee8023ad_lacp.c b/sys/net/ieee8023ad_lacp.c --- a/sys/net/ieee8023ad_lacp.c +++ b/sys/net/ieee8023ad_lacp.c @@ -1036,6 +1036,18 @@ } } +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 @@ #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);