From owner-svn-src-head@freebsd.org Mon Sep 28 01:09:49 2015 Return-Path: Delivered-To: svn-src-head@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 26751A0ACD7; Mon, 28 Sep 2015 01:09:49 +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 1765AAA4; Mon, 28 Sep 2015 01:09:49 +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 t8S19mMM083337; Mon, 28 Sep 2015 01:09:48 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8S19mH8083335; Mon, 28 Sep 2015 01:09:48 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201509280109.t8S19mH8083335@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Mon, 28 Sep 2015 01:09:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288319 - head/sys/dev/otus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Sep 2015 01:09:49 -0000 Author: adrian Date: Mon Sep 28 01:09:48 2015 New Revision: 288319 URL: https://svnweb.freebsd.org/changeset/base/288319 Log: if_otus fixes; add fast-frames support. Fast-frames: * include opt_wlan.h ; tsk to not doing it earlier; * add a tx pending tracking counter for seeing how deep the hardware TX queue is; * add the frame aging code from if_ath; * add fast-frames capability to the driver setup. Bugs: * free the buffers (and node references) before detaching net80211 state. This prevents a use-after-free in the node free path where we've destroyed net80211 underneath it. Modified: head/sys/dev/otus/if_otus.c head/sys/dev/otus/if_otusreg.h Modified: head/sys/dev/otus/if_otus.c ============================================================================== --- head/sys/dev/otus/if_otus.c Mon Sep 28 00:59:07 2015 (r288318) +++ head/sys/dev/otus/if_otus.c Mon Sep 28 01:09:48 2015 (r288319) @@ -24,6 +24,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_wlan.h" + #include #include #include @@ -60,6 +62,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef IEEE80211_SUPPORT_SUPERG +#include +#endif #include #include @@ -340,6 +345,7 @@ otus_detach(device_t self) taskqueue_drain(taskqueue_thread, &sc->tx_task); taskqueue_drain(taskqueue_thread, &sc->wme_update_task); + otus_close_pipes(sc); #if 0 /* Wait for all queued asynchronous commands to complete. */ usb_rem_wait_task(sc->sc_udev, &sc->sc_task); @@ -348,7 +354,6 @@ otus_detach(device_t self) #endif ieee80211_ifdetach(ic); - otus_close_pipes(sc); mtx_destroy(&sc->sc_mtx); return 0; } @@ -949,9 +954,12 @@ fail: otus_close_pipes(sc); void otus_close_pipes(struct otus_softc *sc) { + + OTUS_LOCK(sc); otus_free_tx_cmd_list(sc); otus_free_tx_list(sc); otus_free_rx_list(sc); + OTUS_UNLOCK(sc); usbd_transfer_unsetup(sc->sc_xfer, OTUS_N_XFER); } @@ -1838,6 +1846,9 @@ tr_setup: } else (void)ieee80211_input_mimo_all(ic, m, NULL); } +#ifdef IEEE80211_SUPPORT_SUPERG + ieee80211_ff_age_all(ic, 100); +#endif OTUS_LOCK(sc); break; default: @@ -1866,6 +1877,14 @@ otus_txeof(struct usb_xfer *xfer, struct OTUS_LOCK_ASSERT(sc); + if (sc->sc_tx_n_active == 0) { + device_printf(sc->sc_dev, + "%s: completed but tx_active=0\n", + __func__); + } else { + sc->sc_tx_n_active--; + } + if (data->m) { /* XXX status? */ /* XXX we get TX status via the RX path.. */ @@ -1926,6 +1945,7 @@ tr_setup: if (data == NULL) { OTUS_DPRINTF(sc, OTUS_DEBUG_XMIT, "%s: empty pending queue sc %p\n", __func__, sc); + sc->sc_tx_n_active = 0; goto finish; } STAILQ_REMOVE_HEAD(&sc->sc_tx_pending[which], next); @@ -1934,6 +1954,7 @@ tr_setup: OTUS_DPRINTF(sc, OTUS_DEBUG_XMIT, "%s: submitting transfer %p\n", __func__, data); usbd_transfer_submit(xfer); + sc->sc_tx_n_active++; break; default: data = STAILQ_FIRST(&sc->sc_tx_active[which]); @@ -1952,6 +1973,22 @@ tr_setup: } finish: +#ifdef IEEE80211_SUPPORT_SUPERG + /* + * If the TX active queue drops below a certain + * threshold, ensure we age fast-frames out so they're + * transmitted. + */ + if (sc->sc_tx_n_active < 2) { + /* XXX ew - net80211 should defer this for us! */ + OTUS_UNLOCK(sc); + ieee80211_ff_flush(ic, WME_AC_VO); + ieee80211_ff_flush(ic, WME_AC_VI); + ieee80211_ff_flush(ic, WME_AC_BE); + ieee80211_ff_flush(ic, WME_AC_BK); + OTUS_LOCK(sc); + } +#endif /* Kick TX */ otus_tx_start(sc); } Modified: head/sys/dev/otus/if_otusreg.h ============================================================================== --- head/sys/dev/otus/if_otusreg.h Mon Sep 28 00:59:07 2015 (r288318) +++ head/sys/dev/otus/if_otusreg.h Mon Sep 28 01:09:48 2015 (r288319) @@ -984,6 +984,10 @@ struct otus_softc { /* current noisefloor, from SET_FREQUENCY */ int sc_nf[OTUS_NUM_CHAINS]; + /* How many pending, active transmit frames */ + int sc_tx_n_pending; + int sc_tx_n_active; + const uint32_t *phy_vals; struct {