From nobody Fri Jun 03 04:49:26 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 7DF0F1B66B1D; Fri, 3 Jun 2022 04:49:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LDr5L38jPz4Vhl; Fri, 3 Jun 2022 04:49:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654231766; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1tQk94rBVCQvWYqp6H0dvFD4wFU8PmWBhLCNg7ok4Jg=; b=pZcSoaWdurhXapSGc0BPUpNznunTybzX8pcC2mIGYVpQdJCGy5Dq7FpKM02UYA/OeJ0yyk YckwCGZRTAcx/Uh04fUISolluutcf3euJlHX1kdDjTifJUHoCSYs+mTBHQE0ZfIKHRU/li 1IyTCW+TmSLW3FaowtD9gjhlUqNrVsPdo0cEV5OUYrZWWMfcDi7zZFIjgNwraXeZwCREaO CJoUdz+cWS2/lk/npoMIgZoIY6TI3vHFTwsgR9308Gns29zsSuNlolcS/3AWKI0YFLYPQU E8QLztOyMksCeX9ud9snLfWJQNEodqaeRhHsCG9mg3BJptdv9EVLqLzkjZex0w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4C7052271D; Fri, 3 Jun 2022 04:49:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2534nQ5g036813; Fri, 3 Jun 2022 04:49:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2534nQxB036812; Fri, 3 Jun 2022 04:49:26 GMT (envelope-from git) Date: Fri, 3 Jun 2022 04:49:26 GMT Message-Id: <202206030449.2534nQxB036812@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Wojciech Macek Subject: git: 067a4b656b9b - stable/13 - [vlan + lagg] add IFNET_EVENT_UPDATE_BAUDRATE event List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 067a4b656b9bf19873e8acf6b25ed9e07442cc83 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654231766; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1tQk94rBVCQvWYqp6H0dvFD4wFU8PmWBhLCNg7ok4Jg=; b=VinfmSTK/4UOyv/qOPYwbo/pruBTQCt1TWJq4DzvgyDALazGkLy4Pc6BX2UVHAXZWKVwaF 14VpOX37tqHhf2jmKfdFITvrowN2gdOaeu6PH4omI2k0NNYkda+ivNT3n3nbkBCJWgAVLR 6htselEvVMgPNDrYMY2idFG+Ra3Yfuxct1LFlRanY4hAb8CYof6pMBo4Fcmj57PiMLwaxw c4vZor4b+ASBr7XLyexIbDbYpQV1SPETqrbvLgHpkzOK8VNerRmplhTezWDnFS610Thj+I ZrM2eWURZmXLkYQsESfrIoxk5HXifFSZLTueuU9qdzhQpvQ1iirGbwppUNotUQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1654231766; a=rsa-sha256; cv=none; b=WWKLIA8zj83Keb3KtqBlSTBBZhjwNTwyrpeTdDiZUPID78we8NnIKXXdx4Bctpd/rwtsdK MTIimzroDcqnrxPth7pxUzq+NYXH49tDVQA6MX9ljNvIU9RDQG6vc67GsxRZB5EjjRAj98 LkxrtNn4zs2fXsXYDilPjeggqAU6dFEwzrdW6haLmHVPZ8tus+2NmOJJmHfDZEouPvu8Pz COEcpNgY4RbZm+r5RPLJlfYC+r0p/LiQgkoRcrc089zr0Dx2HPEXtvFc00IsAPEa7/vdd5 KQvdPf2AxJFJ6iSL7pfBlz5VKQVLG95GnwhKdKvfhM3/iY2FvMR2VRMTYMyTng== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=067a4b656b9bf19873e8acf6b25ed9e07442cc83 commit 067a4b656b9bf19873e8acf6b25ed9e07442cc83 Author: Andrey V. Elsukov AuthorDate: 2022-05-19 06:02:27 +0000 Commit: Wojciech Macek CommitDate: 2022-06-03 04:48:31 +0000 [vlan + lagg] add IFNET_EVENT_UPDATE_BAUDRATE event use it to update if_baudrate for vlan interfaces created on the LACP lagg. Differential revision: https://reviews.freebsd.org/D33405 (cherry picked from commit f2ab91608440338e5574eff098ad4f69e4541a1d) --- sys/net/ieee8023ad_lacp.c | 2 ++ sys/net/if_var.h | 1 + sys/net/if_vlan.c | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+) diff --git a/sys/net/ieee8023ad_lacp.c b/sys/net/ieee8023ad_lacp.c index a683669de5dc..d1ee6eab4b35 100644 --- a/sys/net/ieee8023ad_lacp.c +++ b/sys/net/ieee8023ad_lacp.c @@ -1089,6 +1089,8 @@ lacp_update_portmap(struct lacp_softc *lsc) speed = lacp_aggregator_bandwidth(la); } sc->sc_ifp->if_baudrate = speed; + EVENTHANDLER_INVOKE(ifnet_event, sc->sc_ifp, + IFNET_EVENT_UPDATE_BAUDRATE); /* switch the active portmap over */ atomic_store_rel_int(&lsc->lsc_activemap, newmap); diff --git a/sys/net/if_var.h b/sys/net/if_var.h index 05751c640392..48da169fd1d6 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -484,6 +484,7 @@ EVENTHANDLER_DECLARE(ifnet_link_event, ifnet_link_event_handler_t); #define IFNET_EVENT_UP 0 #define IFNET_EVENT_DOWN 1 #define IFNET_EVENT_PCP 2 /* priority code point, PCP */ +#define IFNET_EVENT_UPDATE_BAUDRATE 3 typedef void (*ifnet_event_fn)(void *, struct ifnet *ifp, int event); EVENTHANDLER_DECLARE(ifnet_event, ifnet_event_fn); diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index 10a254d22440..79f2834e50ff 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -220,6 +220,7 @@ static MALLOC_DEFINE(M_VLAN, vlanname, "802.1Q Virtual LAN Interface"); static eventhandler_tag ifdetach_tag; static eventhandler_tag iflladdr_tag; +static eventhandler_tag ifevent_tag; /* * if_vlan uses two module-level synchronizations primitives to allow concurrent @@ -326,6 +327,7 @@ static int vlan_clone_destroy(struct if_clone *, struct ifnet *); static void vlan_ifdetach(void *arg, struct ifnet *ifp); static void vlan_iflladdr(void *arg, struct ifnet *ifp); +static void vlan_ifevent(void *arg, struct ifnet *ifp, int event); static void vlan_lladdr_fn(void *arg, int pending); @@ -634,6 +636,34 @@ vlan_setmulti(struct ifnet *ifp) return (0); } +/* + * A handler for interface ifnet events. + */ +static void +vlan_ifevent(void *arg __unused, struct ifnet *ifp, int event) +{ + struct epoch_tracker et; + struct ifvlan *ifv; + struct ifvlantrunk *trunk; + + if (event != IFNET_EVENT_UPDATE_BAUDRATE) + return; + + NET_EPOCH_ENTER(et); + trunk = ifp->if_vlantrunk; + if (trunk == NULL) { + NET_EPOCH_EXIT(et); + return; + } + + TRUNK_WLOCK(trunk); + VLAN_FOREACH(ifv, trunk) { + ifv->ifv_ifp->if_baudrate = ifp->if_baudrate; + } + TRUNK_WUNLOCK(trunk); + NET_EPOCH_EXIT(et); +} + /* * A handler for parent interface link layer address changes. * If the parent interface link layer address is changed we @@ -847,6 +877,10 @@ vlan_modevent(module_t mod, int type, void *data) vlan_iflladdr, NULL, EVENTHANDLER_PRI_ANY); if (iflladdr_tag == NULL) return (ENOMEM); + ifevent_tag = EVENTHANDLER_REGISTER(ifnet_event, + vlan_ifevent, NULL, EVENTHANDLER_PRI_ANY); + if (ifevent_tag == NULL) + return (ENOMEM); VLAN_LOCKING_INIT(); vlan_input_p = vlan_input; vlan_link_state_p = vlan_link_state; @@ -877,6 +911,7 @@ vlan_modevent(module_t mod, int type, void *data) #endif EVENTHANDLER_DEREGISTER(ifnet_departure_event, ifdetach_tag); EVENTHANDLER_DEREGISTER(iflladdr_event, iflladdr_tag); + EVENTHANDLER_DEREGISTER(ifnet_event, ifevent_tag); vlan_input_p = NULL; vlan_link_state_p = NULL; vlan_trunk_cap_p = NULL;