Date: Tue, 7 Oct 2014 07:52:47 +0000 (UTC) From: "Andrey V. Elsukov" <ae@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r272680 - stable/10/sys/net Message-ID: <201410070752.s977qljP023141@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ae Date: Tue Oct 7 07:52:47 2014 New Revision: 272680 URL: https://svnweb.freebsd.org/changeset/base/272680 Log: MFC r272176: Keep list of lagg ports sorted by if_index. Modified: stable/10/sys/net/if_lagg.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/net/if_lagg.c ============================================================================== --- stable/10/sys/net/if_lagg.c Tue Oct 7 06:34:05 2014 (r272679) +++ stable/10/sys/net/if_lagg.c Tue Oct 7 07:52:47 2014 (r272680) @@ -565,7 +565,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); @@ -672,8 +672,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 */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410070752.s977qljP023141>