Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Sep 2015 04:45:30 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r287901 - head/sys/dev/usb/wlan
Message-ID:  <201509170445.t8H4jU2C087527@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Thu Sep 17 04:45:29 2015
New Revision: 287901
URL: https://svnweb.freebsd.org/changeset/base/287901

Log:
  Bring over the QoS logic from the Linux r92su driver.
  
  * the tx descriptor TID is priority, not TID.
  * the tx descriptor queue id mapping is separate from the
    TID/priority; rather than just "BE".
  
  TODO:
  
  * go and re-re-re-verify the queue mappings; the linux and openbsd
    mappings aren't exactly the same.  I need to verify all of this
    before I try to flip on 11n RX.

Modified:
  head/sys/dev/usb/wlan/if_rsu.c

Modified: head/sys/dev/usb/wlan/if_rsu.c
==============================================================================
--- head/sys/dev/usb/wlan/if_rsu.c	Thu Sep 17 04:43:07 2015	(r287900)
+++ head/sys/dev/usb/wlan/if_rsu.c	Thu Sep 17 04:45:29 2015	(r287901)
@@ -425,6 +425,7 @@ rsu_attach(device_t self)
 	    IEEE80211_C_BGSCAN |	/* Background scan. */
 #endif
 	    IEEE80211_C_SHPREAMBLE |	/* Short preamble supported. */
+	    IEEE80211_C_WME |		/* WME/QoS */
 	    IEEE80211_C_SHSLOT |	/* Short slot time supported. */
 	    IEEE80211_C_WPA;		/* WPA/RSN. */
 
@@ -1752,10 +1753,11 @@ rsu_tx_start(struct rsu_softc *sc, struc
 	struct ieee80211_key *k = NULL;
 	struct r92s_tx_desc *txd;
 	uint8_t type;
-	uint8_t tid = 0;
+	int prio = 0;
 	uint8_t which;
 	int hasqos;
 	int xferlen;
+	int qid;
 
 	RSU_ASSERT_LOCKED(sc);
 
@@ -1776,6 +1778,23 @@ rsu_tx_start(struct rsu_softc *sc, struc
 		}
 		wh = mtod(m0, struct ieee80211_frame *);
 	}
+	/* If we have QoS then use it */
+	/* XXX TODO: mbuf WME/PRI versus TID? */
+	if (IEEE80211_QOS_HAS_SEQ(wh)) {
+		/* Has QoS */
+		prio = M_WME_GETAC(m0);
+		which = rsu_wme_ac_xfer_map[prio];
+		hasqos = 1;
+	} else {
+		/* Non-QoS TID */
+		/* XXX TODO: tid=0 for non-qos TID? */
+		which = rsu_wme_ac_xfer_map[WME_AC_BE];
+		hasqos = 0;
+		prio = 0;
+	}
+
+	qid = rsu_ac2qid[prio];
+#if 0
 	switch (type) {
 	case IEEE80211_FC0_TYPE_CTL:
 	case IEEE80211_FC0_TYPE_MGT:
@@ -1786,7 +1805,7 @@ rsu_tx_start(struct rsu_softc *sc, struc
 		break;
 	}
 	hasqos = 0;
-
+#endif
 	/* Fill Tx descriptor. */
 	txd = (struct r92s_tx_desc *)data->buf;
 	memset(txd, 0, sizeof(*txd));
@@ -1797,8 +1816,7 @@ rsu_tx_start(struct rsu_softc *sc, struc
 	    R92S_TXDW0_OWN | R92S_TXDW0_FSG | R92S_TXDW0_LSG);
 
 	txd->txdw1 |= htole32(
-	    SM(R92S_TXDW1_MACID, R92S_MACID_BSS) |
-	    SM(R92S_TXDW1_QSEL, R92S_TXDW1_QSEL_BE));
+	    SM(R92S_TXDW1_MACID, R92S_MACID_BSS) | SM(R92S_TXDW1_QSEL, qid));
 	if (!hasqos)
 		txd->txdw1 |= htole32(R92S_TXDW1_NONQOS);
 #ifdef notyet
@@ -1826,9 +1844,9 @@ rsu_tx_start(struct rsu_softc *sc, struc
 		txd->txdw2 |= htole32(R92S_TXDW2_BMCAST);
 	/*
 	 * Firmware will use and increment the sequence number for the
-	 * specified TID.
+	 * specified priority.
 	 */
-	txd->txdw3 |= htole32(SM(R92S_TXDW3_SEQ, tid));
+	txd->txdw3 |= htole32(SM(R92S_TXDW3_SEQ, prio));
 
 	if (ieee80211_radiotap_active_vap(vap)) {
 		struct rsu_tx_radiotap_header *tap = &sc->sc_txtap;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201509170445.t8H4jU2C087527>