svn commit: r272681 - stable/9/sys/net
Andrey V. Elsukov
ae at FreeBSD.org
Tue Oct 7 08:19:22 UTC 2014
Author: ae
Date: Tue Oct 7 08:19:21 2014
New Revision: 272681
URL: https://svnweb.freebsd.org/changeset/base/272681
Log:
MFC r272176:
Keep list of lagg ports sorted by if_index.
Modified:
stable/9/sys/net/if_lagg.c
Directory Properties:
stable/9/sys/ (props changed)
stable/9/sys/net/ (props changed)
Modified: stable/9/sys/net/if_lagg.c
==============================================================================
--- stable/9/sys/net/if_lagg.c Tue Oct 7 07:52:47 2014 (r272680)
+++ stable/9/sys/net/if_lagg.c Tue Oct 7 08:19:21 2014 (r272681)
@@ -523,7 +523,7 @@ static int
lagg_port_create(struct lagg_softc *sc, struct ifnet *ifp)
{
struct lagg_softc *sc_ptr;
- struct lagg_port *lp;
+ struct lagg_port *lp, *tlp;
int error = 0;
LAGG_WLOCK_ASSERT(sc);
@@ -630,8 +630,18 @@ lagg_port_create(struct lagg_softc *sc,
lagg_port_lladdr(lp, IF_LLADDR(sc->sc_ifp));
}
- /* Insert into the list of ports */
- SLIST_INSERT_HEAD(&sc->sc_ports, lp, lp_entries);
+ /* Insert into the list of ports. Keep ports sorted by if_index. */
+ SLIST_FOREACH(tlp, &sc->sc_ports, lp_entries) {
+ if (tlp->lp_ifp->if_index < ifp->if_index && (
+ SLIST_NEXT(tlp, lp_entries) == NULL ||
+ SLIST_NEXT(tlp, lp_entries)->lp_ifp->if_index <
+ ifp->if_index))
+ break;
+ }
+ if (tlp != NULL)
+ SLIST_INSERT_AFTER(tlp, lp, lp_entries);
+ else
+ SLIST_INSERT_HEAD(&sc->sc_ports, lp, lp_entries);
sc->sc_count++;
/* Update lagg capabilities */
More information about the svn-src-stable
mailing list