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
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user