From owner-svn-src-stable@freebsd.org Thu Nov 5 15:27:38 2020 Return-Path: Delivered-To: svn-src-stable@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 A924B46A4C0; Thu, 5 Nov 2020 15:27:38 +0000 (UTC) (envelope-from bz@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 "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CRnT64SnPz4nNm; Thu, 5 Nov 2020 15:27:38 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 87CF51585F; Thu, 5 Nov 2020 15:27:38 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A5FRcn1048296; Thu, 5 Nov 2020 15:27:38 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A5FRcoD048295; Thu, 5 Nov 2020 15:27:38 GMT (envelope-from bz@FreeBSD.org) Message-Id: <202011051527.0A5FRcoD048295@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 5 Nov 2020 15:27:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367385 - stable/12/sys/dev/rtwn/usb X-SVN-Group: stable-12 X-SVN-Commit-Author: bz X-SVN-Commit-Paths: stable/12/sys/dev/rtwn/usb X-SVN-Commit-Revision: 367385 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2020 15:27:38 -0000 Author: bz Date: Thu Nov 5 15:27:38 2020 New Revision: 367385 URL: https://svnweb.freebsd.org/changeset/base/367385 Log: MFC r366268 (and epoch parts of r357093): rtwn: narrow the epoch area Rather than placing the epoch around the entire receive loop which might call into rtwn_rx_frame() and USB and sleep, split the loop into two and leave us with one unlock/lock cycle as well. PR: 249925 Modified: stable/12/sys/dev/rtwn/usb/rtwn_usb_rx.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/rtwn/usb/rtwn_usb_rx.c ============================================================================== --- stable/12/sys/dev/rtwn/usb/rtwn_usb_rx.c Thu Nov 5 15:08:56 2020 (r367384) +++ stable/12/sys/dev/rtwn/usb/rtwn_usb_rx.c Thu Nov 5 15:27:38 2020 (r367385) @@ -363,11 +363,12 @@ rtwn_rx_frame(struct rtwn_softc *sc, struct mbuf *m) void rtwn_bulk_rx_callback(struct usb_xfer *xfer, usb_error_t error) { + struct epoch_tracker et; struct rtwn_usb_softc *uc = usbd_xfer_softc(xfer); struct rtwn_softc *sc = &uc->uc_sc; struct ieee80211com *ic = &sc->sc_ic; struct ieee80211_node *ni; - struct mbuf *m = NULL, *next; + struct mbuf *m0, *m = NULL, *next; struct rtwn_data *data; RTWN_ASSERT_LOCKED(sc); @@ -399,23 +400,31 @@ tr_setup: * ieee80211_input() because here is at the end of a USB * callback and safe to unlock. */ + m0 = m; while (m != NULL) { + M_ASSERTPKTHDR(m); + m->m_pkthdr.PH_loc.ptr = rtwn_rx_frame(sc, m); + m = m->m_nextpkt; + } + NET_EPOCH_ENTER_ET(et); + RTWN_UNLOCK(sc); + m = m0; + while (m != NULL) { next = m->m_nextpkt; m->m_nextpkt = NULL; - ni = rtwn_rx_frame(sc, m); - - RTWN_UNLOCK(sc); - + ni = m->m_pkthdr.PH_loc.ptr; + m->m_pkthdr.PH_loc.ptr = NULL; if (ni != NULL) { (void)ieee80211_input_mimo(ni, m); ieee80211_free_node(ni); } else { (void)ieee80211_input_mimo_all(ic, m); } - RTWN_LOCK(sc); m = next; } + RTWN_LOCK(sc); + NET_EPOCH_EXIT_ET(et); break; default: /* needs it to the inactive queue due to a error. */