git: 570685971c6a - main - lagg: propagate up/down to the children
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 06 May 2024 22:27:51 UTC
The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=570685971c6ad30c75103453a38fdb2dff432bef commit 570685971c6ad30c75103453a38fdb2dff432bef Author: Gleb Smirnoff <glebius@FreeBSD.org> AuthorDate: 2024-05-06 22:25:53 +0000 Commit: Gleb Smirnoff <glebius@FreeBSD.org> CommitDate: 2024-05-06 22:27:32 +0000 lagg: propagate up/down to the children Based on the old submission from asomers@. With modern state of locking in lagg(4), the patch got much simplier. Enable the test that was waiting for this change. PR: 226144 Reviewed by: asomers Differential Revision: https://reviews.freebsd.org/D44605 --- sys/net/if_lagg.c | 24 ++++++++++++++++++++++++ tests/sys/net/if_lagg_test.sh | 1 - 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/sys/net/if_lagg.c b/sys/net/if_lagg.c index 554d8c2c1bcb..1f169ee32696 100644 --- a/sys/net/if_lagg.c +++ b/sys/net/if_lagg.c @@ -137,6 +137,7 @@ static void lagg_port_ifdetach(void *arg __unused, struct ifnet *); static int lagg_port_checkstacking(struct lagg_softc *); #endif static void lagg_port2req(struct lagg_port *, struct lagg_reqport *); +static void lagg_if_updown(struct lagg_softc *, bool); static void lagg_init(void *); static void lagg_stop(struct lagg_softc *); static int lagg_ioctl(struct ifnet *, u_long, caddr_t); @@ -1265,6 +1266,25 @@ lagg_watchdog_infiniband(void *arg) callout_reset(&sc->sc_watchdog, hz, &lagg_watchdog_infiniband, arg); } +static void +lagg_if_updown(struct lagg_softc *sc, bool up) +{ + struct ifreq ifr = {}; + struct lagg_port *lp; + + LAGG_XLOCK_ASSERT(sc); + + CK_SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) { + if (up) + if_up(lp->lp_ifp); + else + if_down(lp->lp_ifp); + + if (lp->lp_ioctl != NULL) + lp->lp_ioctl(lp->lp_ifp, SIOCSIFFLAGS, (caddr_t)&ifr); + } +} + static void lagg_init(void *xsc) { @@ -1291,6 +1311,8 @@ lagg_init(void *xsc) if_setlladdr(lp->lp_ifp, IF_LLADDR(ifp), ifp->if_addrlen); } + lagg_if_updown(sc, true); + lagg_proto_init(sc); if (ifp->if_type == IFT_INFINIBAND) { @@ -1320,6 +1342,8 @@ lagg_stop(struct lagg_softc *sc) callout_stop(&sc->sc_watchdog); mtx_unlock(&sc->sc_mtx); + lagg_if_updown(sc, false); + callout_drain(&sc->sc_watchdog); } diff --git a/tests/sys/net/if_lagg_test.sh b/tests/sys/net/if_lagg_test.sh index 6b99aaedfbbf..1e07d4db294d 100755 --- a/tests/sys/net/if_lagg_test.sh +++ b/tests/sys/net/if_lagg_test.sh @@ -358,7 +358,6 @@ updown_body() { local TAP0 TAP1 LAGG MAC - atf_expect_fail "PR 226144 Upping a lagg interrface should automatically up its children" # Configure the lagg interface to use an RFC5737 nonrouteable addresses ADDR="192.0.2.2" MASK="24"