Date: Tue, 7 Oct 2014 08:19:22 +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-9@freebsd.org Subject: svn commit: r272681 - stable/9/sys/net Message-ID: <201410070819.s978JMlw033929@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410070819.s978JMlw033929>