svn commit: r288329 - in user/ngie/more-tests/sys: dev/otus dev/usb/wlan net80211
Garrett Cooper
ngie at FreeBSD.org
Mon Sep 28 03:31:04 UTC 2015
Author: ngie
Date: Mon Sep 28 03:31:01 2015
New Revision: 288329
URL: https://svnweb.freebsd.org/changeset/base/288329
Log:
MFhead at r288328
Modified:
user/ngie/more-tests/sys/dev/otus/if_otus.c
user/ngie/more-tests/sys/dev/otus/if_otusreg.h
user/ngie/more-tests/sys/dev/usb/wlan/if_rsu.c
user/ngie/more-tests/sys/net80211/ieee80211_ht.c
user/ngie/more-tests/sys/net80211/ieee80211_ht.h
user/ngie/more-tests/sys/net80211/ieee80211_node.h
user/ngie/more-tests/sys/net80211/ieee80211_output.c
user/ngie/more-tests/sys/net80211/ieee80211_superg.c
Directory Properties:
user/ngie/more-tests/ (props changed)
user/ngie/more-tests/etc/ (props changed)
user/ngie/more-tests/sys/ (props changed)
Modified: user/ngie/more-tests/sys/dev/otus/if_otus.c
==============================================================================
--- user/ngie/more-tests/sys/dev/otus/if_otus.c Mon Sep 28 03:28:22 2015 (r288328)
+++ user/ngie/more-tests/sys/dev/otus/if_otus.c Mon Sep 28 03:31:01 2015 (r288329)
@@ -24,6 +24,8 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include "opt_wlan.h"
+
#include <sys/param.h>
#include <sys/endian.h>
#include <sys/sockio.h>
@@ -60,6 +62,9 @@ __FBSDID("$FreeBSD$");
#include <net80211/ieee80211_radiotap.h>
#include <net80211/ieee80211_ratectl.h>
#include <net80211/ieee80211_input.h>
+#ifdef IEEE80211_SUPPORT_SUPERG
+#include <net80211/ieee80211_superg.h>
+#endif
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
@@ -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: user/ngie/more-tests/sys/dev/otus/if_otusreg.h
==============================================================================
--- user/ngie/more-tests/sys/dev/otus/if_otusreg.h Mon Sep 28 03:28:22 2015 (r288328)
+++ user/ngie/more-tests/sys/dev/otus/if_otusreg.h Mon Sep 28 03:31:01 2015 (r288329)
@@ -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 {
Modified: user/ngie/more-tests/sys/dev/usb/wlan/if_rsu.c
==============================================================================
--- user/ngie/more-tests/sys/dev/usb/wlan/if_rsu.c Mon Sep 28 03:28:22 2015 (r288328)
+++ user/ngie/more-tests/sys/dev/usb/wlan/if_rsu.c Mon Sep 28 03:31:01 2015 (r288329)
@@ -28,6 +28,8 @@ __FBSDID("$FreeBSD$");
* o power-save operation
*/
+#include "opt_wlan.h"
+
#include <sys/param.h>
#include <sys/endian.h>
#include <sys/sockio.h>
Modified: user/ngie/more-tests/sys/net80211/ieee80211_ht.c
==============================================================================
--- user/ngie/more-tests/sys/net80211/ieee80211_ht.c Mon Sep 28 03:28:22 2015 (r288328)
+++ user/ngie/more-tests/sys/net80211/ieee80211_ht.c Mon Sep 28 03:31:01 2015 (r288329)
@@ -1081,7 +1081,7 @@ ieee80211_ht_node_init(struct ieee80211_
tap = &ni->ni_tx_ampdu[tid];
tap->txa_tid = tid;
tap->txa_ni = ni;
- tap->txa_lastsample = ticks;
+ ieee80211_txampdu_init_pps(tap);
/* NB: further initialization deferred */
}
ni->ni_flags |= IEEE80211_NODE_HT | IEEE80211_NODE_AMPDU;
@@ -1251,7 +1251,7 @@ ieee80211_ht_wds_init(struct ieee80211_n
for (tid = 0; tid < WME_NUM_TID; tid++) {
tap = &ni->ni_tx_ampdu[tid];
tap->txa_tid = tid;
- tap->txa_lastsample = ticks;
+ ieee80211_txampdu_init_pps(tap);
}
/* NB: AMPDU tx/rx governed by IEEE80211_FHT_AMPDU_{TX,RX} */
ni->ni_flags |= IEEE80211_NODE_HT | IEEE80211_NODE_AMPDU;
@@ -1752,8 +1752,7 @@ ampdu_tx_stop(struct ieee80211_tx_ampdu
/*
* Reset packet estimate.
*/
- tap->txa_lastsample = ticks;
- tap->txa_avgpps = 0;
+ ieee80211_txampdu_init_pps(tap);
/* NB: clearing NAK means we may re-send ADDBA */
tap->txa_flags &= ~(IEEE80211_AGGR_SETUP | IEEE80211_AGGR_NAK);
Modified: user/ngie/more-tests/sys/net80211/ieee80211_ht.h
==============================================================================
--- user/ngie/more-tests/sys/net80211/ieee80211_ht.h Mon Sep 28 03:28:22 2015 (r288328)
+++ user/ngie/more-tests/sys/net80211/ieee80211_ht.h Mon Sep 28 03:31:01 2015 (r288329)
@@ -84,8 +84,19 @@ struct ieee80211_tx_ampdu {
*/
static __inline void
+ieee80211_txampdu_init_pps(struct ieee80211_tx_ampdu *tap)
+{
+ /*
+ * Reset packet estimate.
+ */
+ tap->txa_lastsample = ticks;
+ tap->txa_avgpps = 0;
+}
+
+static __inline void
ieee80211_txampdu_update_pps(struct ieee80211_tx_ampdu *tap)
{
+
/* NB: scale factor of 2 was picked heuristically */
tap->txa_avgpps = ((tap->txa_avgpps << 2) -
tap->txa_avgpps + tap->txa_pkts) >> 2;
@@ -97,6 +108,7 @@ ieee80211_txampdu_update_pps(struct ieee
static __inline void
ieee80211_txampdu_count_packet(struct ieee80211_tx_ampdu *tap)
{
+
/* XXX bound loop/do more crude estimate? */
while (ticks - tap->txa_lastsample >= hz) {
ieee80211_txampdu_update_pps(tap);
Modified: user/ngie/more-tests/sys/net80211/ieee80211_node.h
==============================================================================
--- user/ngie/more-tests/sys/net80211/ieee80211_node.h Mon Sep 28 03:28:22 2015 (r288328)
+++ user/ngie/more-tests/sys/net80211/ieee80211_node.h Mon Sep 28 03:31:01 2015 (r288329)
@@ -219,6 +219,9 @@ struct ieee80211_node {
struct ieee80211_tx_ampdu ni_tx_ampdu[WME_NUM_TID];
struct ieee80211_rx_ampdu ni_rx_ampdu[WME_NUM_TID];
+ /* fast-frames state */
+ struct mbuf * ni_tx_superg[WME_NUM_TID];
+
/* others */
short ni_inact; /* inactivity mark count */
short ni_inact_reload;/* inactivity reload value */
Modified: user/ngie/more-tests/sys/net80211/ieee80211_output.c
==============================================================================
--- user/ngie/more-tests/sys/net80211/ieee80211_output.c Mon Sep 28 03:28:22 2015 (r288328)
+++ user/ngie/more-tests/sys/net80211/ieee80211_output.c Mon Sep 28 03:31:01 2015 (r288329)
@@ -213,6 +213,22 @@ ieee80211_vap_pkt_send_dest(struct ieee8
}
}
+ /*
+ * XXX If we aren't doing AMPDU TX then we /could/ do
+ * fast-frames encapsulation, however right now this
+ * output logic doesn't handle that case.
+ *
+ * So we'll be limited to "fast-frames" xmit for non-11n STA
+ * and "no fast frames" xmit for 11n STAs.
+ * It'd be nice to eventually test fast-frames out by
+ * gracefully falling from failing A-MPDU transmission
+ * (driver says no, fail to negotiate it with peer) to
+ * using fast-frames.
+ *
+ * Note: we can actually put A-MSDU's inside an A-MPDU,
+ * so hopefully we can figure out how to make that particular
+ * combination work right.
+ */
#ifdef IEEE80211_SUPPORT_SUPERG
else if (IEEE80211_ATH_CAP(vap, ni, IEEE80211_NODE_FF)) {
m = ieee80211_ff_check(ni, m);
@@ -230,6 +246,11 @@ ieee80211_vap_pkt_send_dest(struct ieee8
*/
IEEE80211_TX_LOCK(ic);
+ /*
+ * XXX make the encap and transmit code a separate function
+ * so things like the FF (and later A-MSDU) path can just call
+ * it for flushed frames.
+ */
if (__predict_true((vap->iv_caps & IEEE80211_C_8023ENCAP) == 0)) {
/*
* Encapsulate the packet in prep for transmission.
Modified: user/ngie/more-tests/sys/net80211/ieee80211_superg.c
==============================================================================
--- user/ngie/more-tests/sys/net80211/ieee80211_superg.c Mon Sep 28 03:28:22 2015 (r288328)
+++ user/ngie/more-tests/sys/net80211/ieee80211_superg.c Mon Sep 28 03:31:01 2015 (r288329)
@@ -530,7 +530,6 @@ ieee80211_ff_age(struct ieee80211com *ic
{
struct mbuf *m, *head;
struct ieee80211_node *ni;
- struct ieee80211_tx_ampdu *tap;
#if 0
KASSERT(sq->head != NULL, ("stageq empty"));
@@ -541,11 +540,10 @@ ieee80211_ff_age(struct ieee80211com *ic
while ((m = sq->head) != NULL && M_AGE_GET(m) < quanta) {
int tid = WME_AC_TO_TID(M_WME_GETAC(m));
- /* clear tap ref to frame */
+ /* clear staging ref to frame */
ni = (struct ieee80211_node *) m->m_pkthdr.rcvif;
- tap = &ni->ni_tx_ampdu[tid];
- KASSERT(tap->txa_private == m, ("staging queue empty"));
- tap->txa_private = NULL;
+ KASSERT(ni->ni_tx_superg[tid] == m, ("staging queue empty"));
+ ni->ni_tx_superg[tid] = NULL;
sq->head = m->m_nextpkt;
sq->depth--;
@@ -658,7 +656,12 @@ ieee80211_ff_check(struct ieee80211_node
*/
IEEE80211_LOCK(ic);
tap = &ni->ni_tx_ampdu[WME_AC_TO_TID(pri)];
- mstaged = tap->txa_private; /* NB: we reuse AMPDU state */
+ mstaged = ni->ni_tx_superg[WME_AC_TO_TID(pri)];
+ /* XXX NOTE: reusing packet counter state from A-MPDU */
+ /*
+ * XXX NOTE: this means we're double-counting; it should just
+ * be done in ieee80211_output.c once for both superg and A-MPDU.
+ */
ieee80211_txampdu_count_packet(tap);
/*
@@ -676,6 +679,8 @@ ieee80211_ff_check(struct ieee80211_node
* If there is no frame to combine with and the pps is
* too low; then do not attempt to aggregate this frame.
*/
+ IEEE80211_DPRINTF(vap, IEEE80211_MSG_SUPERG,
+ "%s: staged: %p; pps: %d\n", __func__, mstaged, ieee80211_txampdu_getpps(tap));
if (mstaged == NULL &&
ieee80211_txampdu_getpps(tap) < ieee80211_ffppsmin) {
IEEE80211_UNLOCK(ic);
@@ -698,7 +703,7 @@ ieee80211_ff_check(struct ieee80211_node
"%s: txtime %u exceeds txop limit %u\n",
__func__, txtime, limit);
- tap->txa_private = NULL;
+ ni->ni_tx_superg[WME_AC_TO_TID(pri)] = NULL;
if (mstaged != NULL)
stageq_remove(ic, sq, mstaged);
IEEE80211_UNLOCK(ic);
@@ -721,7 +726,7 @@ ieee80211_ff_check(struct ieee80211_node
* hold their node reference.
*/
if (mstaged != NULL) {
- tap->txa_private = NULL;
+ ni->ni_tx_superg[WME_AC_TO_TID(pri)] = NULL;
stageq_remove(ic, sq, mstaged);
IEEE80211_UNLOCK(ic);
@@ -739,9 +744,10 @@ ieee80211_ff_check(struct ieee80211_node
mstaged->m_nextpkt = m;
mstaged->m_flags |= M_FF; /* NB: mark for encap work */
} else {
- KASSERT(tap->txa_private == NULL,
- ("txa_private %p", tap->txa_private));
- tap->txa_private = m;
+ KASSERT(ni->ni_tx_superg[WME_AC_TO_TID(pri)]== NULL,
+ ("ni_tx_superg[]: %p",
+ ni->ni_tx_superg[WME_AC_TO_TID(pri)]));
+ ni->ni_tx_superg[WME_AC_TO_TID(pri)] = m;
stageq_add(ic, sq, m);
IEEE80211_UNLOCK(ic);
@@ -769,7 +775,6 @@ ieee80211_ff_node_cleanup(struct ieee802
{
struct ieee80211com *ic = ni->ni_ic;
struct ieee80211_superg *sg = ic->ic_superg;
- struct ieee80211_tx_ampdu *tap;
struct mbuf *m, *next_m, *head;
int tid;
@@ -777,11 +782,16 @@ ieee80211_ff_node_cleanup(struct ieee802
head = NULL;
for (tid = 0; tid < WME_NUM_TID; tid++) {
int ac = TID_TO_WME_AC(tid);
-
- tap = &ni->ni_tx_ampdu[tid];
- m = tap->txa_private;
+ /*
+ * XXX Initialise the packet counter.
+ *
+ * This may be double-work for 11n stations;
+ * but without it we never setup things.
+ */
+ ieee80211_txampdu_init_pps(&ni->ni_tx_ampdu[tid]);
+ m = ni->ni_tx_superg[tid];
if (m != NULL) {
- tap->txa_private = NULL;
+ ni->ni_tx_superg[tid] = NULL;
stageq_remove(ic, &sg->ff_stageq[ac], m);
m->m_nextpkt = head;
head = m;
More information about the svn-src-user
mailing list