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
This commit is contained in:
Gleb Smirnoff 2024-05-06 15:25:53 -07:00
parent 1d425ef341
commit 570685971c
2 changed files with 24 additions and 1 deletions

View file

@ -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);
}

View file

@ -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"