From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 15:17:55 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2762856C7A6; Tue, 2 Mar 2021 15:17:54 +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 4Dqgjs3D5Dz4Wt8; Tue, 2 Mar 2021 15:17:52 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 3942518FC6; Tue, 2 Mar 2021 15:17:52 +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 122FHqLR039648; Tue, 2 Mar 2021 15:17:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122FHqaD039647; Tue, 2 Mar 2021 15:17:52 GMT (envelope-from git) Date: Tue, 2 Mar 2021 15:17:52 GMT Message-Id: <202103021517.122FHqaD039647@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: eaba3fe1483f - stable/13 - bridge/stp: Ensure we enter NET_EPOCH whenever we can send traffic MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: eaba3fe1483fe82baccb6d3930347bbd548c6fcd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Mar 2021 15:17:56 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=eaba3fe1483fe82baccb6d3930347bbd548c6fcd commit eaba3fe1483fe82baccb6d3930347bbd548c6fcd Author: Kristof Provost AuthorDate: 2021-02-21 20:18:46 +0000 Commit: Kristof Provost CommitDate: 2021-03-02 14:50:21 +0000 bridge/stp: Ensure we enter NET_EPOCH whenever we can send traffic Reviewed by: donner@ MFC after: 1 week Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D28858 (cherry picked from commit 89fa9c34d76bbf85cd7cda60c1868f5e3dba4ec7) --- sys/net/bridgestp.c | 9 +++++++++ sys/net/if_bridge.c | 9 ++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/sys/net/bridgestp.c b/sys/net/bridgestp.c index c36dc61d1397..82524440c241 100644 --- a/sys/net/bridgestp.c +++ b/sys/net/bridgestp.c @@ -154,6 +154,8 @@ static void bstp_reinit(struct bstp_state *); static void bstp_transmit(struct bstp_state *bs, struct bstp_port *bp) { + NET_EPOCH_ASSERT(); + if (bs->bs_running == 0) return; @@ -346,6 +348,7 @@ bstp_send_bpdu(struct bstp_state *bs, struct bstp_port *bp, struct ether_header *eh; BSTP_LOCK_ASSERT(bs); + NET_EPOCH_ASSERT(); ifp = bp->bp_ifp; @@ -923,6 +926,8 @@ bstp_update_state(struct bstp_state *bs, struct bstp_port *bp) static void bstp_update_roles(struct bstp_state *bs, struct bstp_port *bp) { + NET_EPOCH_ASSERT(); + switch (bp->bp_role) { case BSTP_ROLE_DISABLED: /* Clear any flags if set */ @@ -1862,6 +1867,7 @@ bstp_disable_port(struct bstp_state *bs, struct bstp_port *bp) static void bstp_tick(void *arg) { + struct epoch_tracker et; struct bstp_state *bs = arg; struct bstp_port *bp; @@ -1870,6 +1876,7 @@ bstp_tick(void *arg) if (bs->bs_running == 0) return; + NET_EPOCH_ENTER(et); CURVNET_SET(bs->bs_vnet); /* poll link events on interfaces that do not support linkstate */ @@ -1908,6 +1915,7 @@ bstp_tick(void *arg) } CURVNET_RESTORE(); + NET_EPOCH_EXIT(et); callout_reset(&bs->bs_bstpcallout, hz, bstp_tick, bs); } @@ -2229,6 +2237,7 @@ bstp_enable(struct bstp_port *bp) struct ifnet *ifp = bp->bp_ifp; KASSERT(bp->bp_active == 0, ("already a bstp member")); + NET_EPOCH_ASSERT(); /* Because bstp_update_roles() causes traffic. */ switch (ifp->if_type) { case IFT_ETHER: /* These can do spanning tree. */ diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index 24338267229b..3e6b5ba8e0c2 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -1351,6 +1351,7 @@ bridge_ioctl_gifflags(struct bridge_softc *sc, void *arg) static int bridge_ioctl_sifflags(struct bridge_softc *sc, void *arg) { + struct epoch_tracker et; struct ifbreq *req = arg; struct bridge_iflist *bif; struct bstp_port *bp; @@ -1365,11 +1366,15 @@ bridge_ioctl_sifflags(struct bridge_softc *sc, void *arg) /* SPAN is readonly */ return (EINVAL); + NET_EPOCH_ENTER(et); + if (req->ifbr_ifsflags & IFBIF_STP) { if ((bif->bif_flags & IFBIF_STP) == 0) { error = bstp_enable(&bif->bif_stp); - if (error) + if (error) { + NET_EPOCH_EXIT(et); return (error); + } } } else { if ((bif->bif_flags & IFBIF_STP) != 0) @@ -1385,6 +1390,8 @@ bridge_ioctl_sifflags(struct bridge_softc *sc, void *arg) /* Save the bits relating to the bridge */ bif->bif_flags = req->ifbr_ifsflags & IFBIFMASK; + NET_EPOCH_EXIT(et); + return (0); }