Compare the partner system priority when choosing the aggregator.

This commit is contained in:
Andrew Thompson 2007-05-19 09:37:04 +00:00
parent ad08d9331d
commit fe45e65f10
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=169741
2 changed files with 11 additions and 1 deletions

View File

@ -935,7 +935,15 @@ lacp_select_active_aggregator(struct lacp_softc *lsc)
LACP_DPRINTF((NULL, "%s, speed=%jd, nports=%d\n",
lacp_format_lagid_aggregator(la, buf, sizeof(buf)),
speed, la->la_nports));
if (speed > best_speed ||
/* This aggregator is chosen if
* the partner has a better system priority
* or, the total aggregated speed is higher
* or, it is already the chosen aggregator
*/
if ((best_la != NULL && LACP_SYS_PRI(la->la_partner) <
LACP_SYS_PRI(best_la->la_partner)) ||
speed > best_speed ||
(speed == best_speed &&
la == lsc->lsc_active_aggregator)) {
best_la = la;

View File

@ -265,6 +265,8 @@ int tlv_check(const void *, size_t, const struct tlvhdr *,
#define LACP_STATE_EQ(s1, s2, mask) \
((((s1) ^ (s2)) & (mask)) == 0)
#define LACP_SYS_PRI(peer) (peer).lip_systemid.lsi_prio
#define LACP_PORT(_lp) ((struct lacp_port *)(_lp)->lp_psc)
#define LACP_SOFTC(_sc) ((struct lacp_softc *)(_sc)->sc_psc)