Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net/lagg lagg: Notify the changes of capenables of inter...
details: https://anonhg.NetBSD.org/src/rev/8b49e84aca34
branches: trunk
changeset: 1025544:8b49e84aca34
user: yamaguchi <yamaguchi%NetBSD.org@localhost>
date: Fri Nov 12 05:34:45 2021 +0000
description:
lagg: Notify the changes of capenables of interface
to child interfaces
diffstat:
sys/net/lagg/if_lagg.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 63 insertions(+), 2 deletions(-)
diffs (107 lines):
diff -r 9454f38c0c8e -r 8b49e84aca34 sys/net/lagg/if_lagg.c
--- a/sys/net/lagg/if_lagg.c Thu Nov 11 19:37:30 2021 +0000
+++ b/sys/net/lagg/if_lagg.c Fri Nov 12 05:34:45 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_lagg.c,v 1.21 2021/11/11 01:10:09 yamaguchi Exp $ */
+/* $NetBSD: if_lagg.c,v 1.22 2021/11/12 05:34:45 yamaguchi Exp $ */
/*
* Copyright (c) 2005, 2006 Reyk Floeter <reyk%openbsd.org@localhost>
@@ -20,7 +20,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_lagg.c,v 1.21 2021/11/11 01:10:09 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_lagg.c,v 1.22 2021/11/12 05:34:45 yamaguchi Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -198,6 +198,8 @@
static void lagg_port_purgevlan(struct lagg_softc *, struct lagg_port *);
static void lagg_lladdr_update(struct lagg_softc *);
static void lagg_capabilities_update(struct lagg_softc *);
+static void lagg_sync_ifcaps(struct lagg_softc *);
+static void lagg_sync_ethcaps(struct lagg_softc *);
static struct if_clone lagg_cloner =
IF_CLONE_INITIALIZER("lagg", lagg_clone_create, lagg_clone_destroy);
@@ -780,6 +782,16 @@
error = EPROTONOSUPPORT;
}
break;
+ case SIOCSIFCAP:
+ error = ether_ioctl(ifp, cmd, data);
+ if (error == 0)
+ lagg_sync_ifcaps(sc);
+ break;
+ case SIOCSETHERCAP:
+ error = ether_ioctl(ifp, cmd, data);
+ if (error == 0)
+ lagg_sync_ethcaps(sc);
+ break;
default:
error = ether_ioctl(ifp, cmd, data);
}
@@ -1837,6 +1849,29 @@
return error;
}
+static void
+lagg_sync_ifcaps(struct lagg_softc *sc)
+{
+ struct lagg_port *lp;
+ struct ifnet *ifp;
+ int error = 0;
+
+ ifp = (struct ifnet *)&sc->sc_if;
+
+ LAGG_LOCK(sc);
+ LAGG_PORTS_FOREACH(sc, lp) {
+ error = lagg_setifcaps(lp, ifp->if_capenable);
+
+ if (error != 0) {
+ lagg_log(sc, LOG_WARNING,
+ "failed to update capabilities "
+ "of %s, error=%d",
+ lp->lp_ifp->if_xname, error);
+ }
+ }
+ LAGG_UNLOCK(sc);
+}
+
static int
lagg_setethcaps(struct lagg_port *lp, int cap)
{
@@ -1861,6 +1896,32 @@
}
static void
+lagg_sync_ethcaps(struct lagg_softc *sc)
+{
+ struct ethercom *ec;
+ struct lagg_port *lp;
+ int error;
+
+ ec = (struct ethercom *)&sc->sc_if;
+
+ LAGG_LOCK(sc);
+ LAGG_PORTS_FOREACH(sc, lp) {
+ if (lp->lp_iftype != IFT_ETHER)
+ continue;
+
+ error = lagg_setethcaps(lp, ec->ec_capenable);
+ if (error != 0) {
+ lagg_log(sc, LOG_WARNING,
+ "failed to update ether "
+ "capabilities"" of %s, error=%d",
+ lp->lp_ifp->if_xname, error);
+ }
+
+ }
+ LAGG_UNLOCK(sc);
+}
+
+static void
lagg_ifcap_update(struct lagg_softc *sc)
{
struct ifnet *ifp;
Home |
Main Index |
Thread Index |
Old Index