From owner-svn-src-all@freebsd.org Sun Oct 4 05:22:18 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1B98AA0E69F; Sun, 4 Oct 2015 05:22:18 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0CACC1CFE; Sun, 4 Oct 2015 05:22:18 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t945MH8b019913; Sun, 4 Oct 2015 05:22:17 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t945MH5F019912; Sun, 4 Oct 2015 05:22:17 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510040522.t945MH5F019912@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 4 Oct 2015 05:22:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288649 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Oct 2015 05:22:18 -0000 Author: adrian Date: Sun Oct 4 05:22:17 2015 New Revision: 288649 URL: https://svnweb.freebsd.org/changeset/base/288649 Log: Fix run(4) mbuf queue flushing / freeing. Ensure things are freed during interface stop, or start may end up never being able to transmit a full queue. Modified: head/sys/dev/usb/wlan/if_run.c Modified: head/sys/dev/usb/wlan/if_run.c ============================================================================== --- head/sys/dev/usb/wlan/if_run.c Sun Oct 4 04:44:06 2015 (r288648) +++ head/sys/dev/usb/wlan/if_run.c Sun Oct 4 05:22:17 2015 (r288649) @@ -831,6 +831,21 @@ detach: return (ENXIO); } +static void +run_drain_mbufq(struct run_softc *sc) +{ + struct mbuf *m; + struct ieee80211_node *ni; + + RUN_LOCK_ASSERT(sc, MA_OWNED); + while ((m = mbufq_dequeue(&sc->sc_snd)) != NULL) { + ni = (struct ieee80211_node *)m->m_pkthdr.rcvif; + m->m_pkthdr.rcvif = NULL; + ieee80211_free_node(ni); + m_freem(m); + } +} + static int run_detach(device_t self) { @@ -852,6 +867,9 @@ run_detach(device_t self) /* free TX list, if any */ for (i = 0; i != RUN_EP_QUEUES; i++) run_unsetup_tx_list(sc, &sc->sc_epq[i]); + + /* Free TX queue */ + run_drain_mbufq(sc); RUN_UNLOCK(sc); if (sc->sc_ic.ic_softc == sc) { @@ -862,7 +880,6 @@ run_detach(device_t self) ieee80211_ifdetach(ic); } - mbufq_drain(&sc->sc_snd); mtx_destroy(&sc->sc_mtx); return (0); @@ -6172,6 +6189,8 @@ run_stop(void *arg) RUN_LOCK(sc); + run_drain_mbufq(sc); + if (sc->rx_m != NULL) { m_free(sc->rx_m); sc->rx_m = NULL;