svn commit: r318966 - head/sys/net
Alexander Motin
mav at FreeBSD.org
Fri May 26 20:15:35 UTC 2017
Author: mav
Date: Fri May 26 20:15:33 2017
New Revision: 318966
URL: https://svnweb.freebsd.org/changeset/base/318966
Log:
Improve applying unified capabilities to the lagg ports.
Some NICs have some capabilities dependent, so that disabling one require
disabling some other (TXCSUM/RXCSUM on em). This code tries to reach the
consensus more insistently.
PR: 219453
MFC after: 1 week
Modified:
head/sys/net/if_lagg.c
Modified: head/sys/net/if_lagg.c
==============================================================================
--- head/sys/net/if_lagg.c Fri May 26 19:19:47 2017 (r318965)
+++ head/sys/net/if_lagg.c Fri May 26 20:15:33 2017 (r318966)
@@ -572,24 +572,41 @@ static void
lagg_capabilities(struct lagg_softc *sc)
{
struct lagg_port *lp;
- int cap = ~0, ena = ~0;
- u_long hwa = ~0UL;
+ int cap, ena, pena;
+ uint64_t hwa;
struct ifnet_hw_tsomax hw_tsomax;
LAGG_XLOCK_ASSERT(sc);
- memset(&hw_tsomax, 0, sizeof(hw_tsomax));
+ /* Get common enabled capabilities for the lagg ports */
+ ena = ~0;
+ SLIST_FOREACH(lp, &sc->sc_ports, lp_entries)
+ ena &= lp->lp_ifp->if_capenable;
+ ena = (ena == ~0 ? 0 : ena);
+
+ /*
+ * Apply common enabled capabilities back to the lagg ports.
+ * May require several iterations if they are dependent.
+ */
+ do {
+ pena = ena;
+ SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) {
+ lagg_setcaps(lp, ena);
+ ena &= lp->lp_ifp->if_capenable;
+ }
+ } while (pena != ena);
- /* Get capabilities from the lagg ports */
+ /* Get other capabilities from the lagg ports */
+ cap = ~0;
+ hwa = ~(uint64_t)0;
+ memset(&hw_tsomax, 0, sizeof(hw_tsomax));
SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) {
cap &= lp->lp_ifp->if_capabilities;
- ena &= lp->lp_ifp->if_capenable;
hwa &= lp->lp_ifp->if_hwassist;
if_hw_tsomax_common(lp->lp_ifp, &hw_tsomax);
}
cap = (cap == ~0 ? 0 : cap);
- ena = (ena == ~0 ? 0 : ena);
- hwa = (hwa == ~0 ? 0 : hwa);
+ hwa = (hwa == ~(uint64_t)0 ? 0 : hwa);
if (sc->sc_ifp->if_capabilities != cap ||
sc->sc_ifp->if_capenable != ena ||
@@ -604,10 +621,6 @@ lagg_capabilities(struct lagg_softc *sc)
if_printf(sc->sc_ifp,
"capabilities 0x%08x enabled 0x%08x\n", cap, ena);
}
-
- /* Apply unified capabilities back to the lagg ports. */
- SLIST_FOREACH(lp, &sc->sc_ports, lp_entries)
- lagg_setcaps(lp, ena);
}
static int
More information about the svn-src-head
mailing list