aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2024-05-06 22:25:53 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2024-05-06 22:27:32 +0000
commit570685971c6ad30c75103453a38fdb2dff432bef (patch)
tree875b075681211a0040028d5b35cb76c306eecce5
parent1d425ef3414cdb0362c982f1820e659f2deb81a3 (diff)
downloadsrc-570685971c6ad30c75103453a38fdb2dff432bef.tar.gz
src-570685971c6ad30c75103453a38fdb2dff432bef.zip
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
-rw-r--r--sys/net/if_lagg.c24
-rwxr-xr-xtests/sys/net/if_lagg_test.sh1
2 files changed, 24 insertions, 1 deletions
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);
@@ -1266,6 +1267,25 @@ lagg_watchdog_infiniband(void *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)
{
struct lagg_softc *sc = (struct lagg_softc *)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"