Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net/lagg Switch ifp->if_output along with configuring if...
details: https://anonhg.NetBSD.org/src/rev/c2adfd4661e2
branches: trunk
changeset: 364592:c2adfd4661e2
user: yamaguchi <yamaguchi%NetBSD.org@localhost>
date: Thu Mar 31 01:46:25 2022 +0000
description:
Switch ifp->if_output along with configuring ifp->if_lagg
lagg_port_output stored to ifp->if_output uses ifp->if_lagg.
Therefore, ifp->if_output switches to lagg_port_output after
ifp->if_lagg is configured, and restores in reverse order.
This missing order is pointed out by k-goda@IIJ
diffstat:
sys/net/lagg/if_lagg.c | 33 +++++++++++++++++++--------------
1 files changed, 19 insertions(+), 14 deletions(-)
diffs (106 lines):
diff -r 32b95a287fae -r c2adfd4661e2 sys/net/lagg/if_lagg.c
--- a/sys/net/lagg/if_lagg.c Thu Mar 31 01:43:48 2022 +0000
+++ b/sys/net/lagg/if_lagg.c Thu Mar 31 01:46:25 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_lagg.c,v 1.33 2022/03/31 01:43:48 yamaguchi Exp $ */
+/* $NetBSD: if_lagg.c,v 1.34 2022/03/31 01:46:25 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.33 2022/03/31 01:43:48 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_lagg.c,v 1.34 2022/03/31 01:46:25 yamaguchi Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -2352,7 +2352,6 @@
ifp_port->if_type = if_type;
ifp_port->if_ioctl = lagg_port_ioctl;
- ifp_port->if_output = lagg_port_output;
iftype_changed = (lp->lp_iftype != ifp_port->if_type);
@@ -2388,15 +2387,16 @@
lagg_port_syncmulti(sc, lp);
lagg_port_syncvlan(sc, lp);
+ IFNET_LOCK(ifp_port);
+ ifp_port->if_output = lagg_port_output;
if (stopped) {
- IFNET_LOCK(ifp_port);
if (!ISSET(ifp_port->if_flags, IFF_RUNNING)) {
error = if_init(ifp_port);
if (error != 0)
goto remove_port;
}
- IFNET_UNLOCK(ifp_port);
}
+ IFNET_UNLOCK(ifp_port);
lagg_config_promisc(sc, lp);
lagg_proto_startport(sc, lp);
@@ -2407,6 +2407,9 @@
remove_port:
SIMPLEQ_REMOVE(&sc->sc_ports, lp, lagg_port, lp_entry);
sc->sc_nports--;
+ IFNET_LOCK(ifp_port);
+ ifp_port->if_output = lp->lp_output;
+ IFNET_UNLOCK(ifp_port);
atomic_store_release(&ifp_port->if_lagg, NULL);
pserialize_perform(sc->sc_psz);
lagg_port_purgemulti(sc, lp);
@@ -2432,7 +2435,6 @@
ifp_port->if_type = lp->lp_iftype;
if (ifp_port->if_ioctl == lagg_port_ioctl)
ifp_port->if_ioctl = lp->lp_ioctl;
- ifp_port->if_output = lp->lp_output;
IFNET_UNLOCK(ifp_port);
@@ -2465,6 +2467,17 @@
return;
}
+ lagg_proto_stopport(sc, lp);
+
+ IFNET_LOCK(ifp_port);
+ if (ISSET(ifp_port->if_flags, IFF_RUNNING) &&
+ ifp_port->if_init != NULL) {
+ if_stop(ifp_port, 0);
+ stopped = true;
+ }
+ ifp_port->if_output = lp->lp_output;
+ IFNET_UNLOCK(ifp_port);
+
SIMPLEQ_REMOVE(&sc->sc_ports, lp, lagg_port, lp_entry);
sc->sc_nports--;
atomic_store_release(&ifp_port->if_lagg, NULL);
@@ -2473,7 +2486,6 @@
if_linkstate_change_disestablish(ifp_port,
lp->lp_linkstate_hook, NULL);
- lagg_proto_stopport(sc, lp);
psref_target_destroy(&lp->lp_psref, lagg_port_psref_class);
lagg_port_purgemulti(sc, lp);
@@ -2481,16 +2493,9 @@
lagg_teardown_lladdr(sc, lp);
IFNET_LOCK(ifp_port);
- if (ISSET(ifp_port->if_flags, IFF_RUNNING) &&
- ifp_port->if_init != NULL) {
- if_stop(ifp_port, 0);
- stopped = true;
- }
-
ifp_port->if_type = lp->lp_iftype;
if (ifp_port->if_ioctl == lagg_port_ioctl)
ifp_port->if_ioctl = lp->lp_ioctl;
- ifp_port->if_output = lp->lp_output;
lagg_teardown_mtu(sc, lp);
if (stopped) {
Home |
Main Index |
Thread Index |
Old Index