Author: adrian
Date: Wed Feb 27 00:49:32 2013
New Revision: 247368
URL: http://svnweb.freebsd.org/changeset/base/247368

Log:
  Enable STBC for the given rate series if it's negotiated:
  
  * If both ends have negotiated (at least) one stream;
  * Only if it's a single stream rate (MCS0-7);
  * Only if there's more than one TX chain enabled.
  
  Tested:
  
  * AR9280 STA mode -> Atheros AP; tested both MCS2 (STBC) and MCS12 (no STBC.)
    Verified using athalq to inspect the TX descriptors.
  
  TODO:
  
  * Test AR5416 - no STBC should be enabled;
  * Test AR9280 with one TX chain enabled - no STBC should be enabled.

Modified:
  head/sys/dev/ath/if_ath_tx_ht.c

Modified: head/sys/dev/ath/if_ath_tx_ht.c
==============================================================================
--- head/sys/dev/ath/if_ath_tx_ht.c     Wed Feb 27 00:35:40 2013        
(r247367)
+++ head/sys/dev/ath/if_ath_tx_ht.c     Wed Feb 27 00:49:32 2013        
(r247368)
@@ -536,17 +536,30 @@ ath_rateseries_setup(struct ath_softc *s
                        series[i].RateFlags |= HAL_RATESERIES_HALFGI;
 
                /*
-                * XXX TODO: STBC if it's possible
+                * Setup rate and TX power cap for this series.
                 */
+               series[i].Rate = rt->info[rc[i].rix].rateCode;
+               series[i].RateIndex = rc[i].rix;
+               series[i].tx_power_cap = 0x3f;  /* XXX for now */
+
+
+               /*
+                * If we have STBC TX enabled and the receiver
+                * can receive (at least) 1 stream STBC, AND it's
+                * MCS 0-7, AND we have at least two chains enabled,
+                * enable STBC.
+                */
+               if (ic->ic_htcaps & IEEE80211_HTCAP_TXSTBC &&
+                   ni->ni_htcap & IEEE80211_HTCAP_RXSTBC_1STREAM &&
+                   (sc->sc_cur_txchainmask > 1) &&
+                   HT_RC_2_STREAMS(series[i].Rate) == 1) {
+                       series[i].RateFlags |= HAL_RATESERIES_STBC;
+               }
 
                /*
                 * XXX TODO: LDPC if it's possible
                 */
 
-               series[i].Rate = rt->info[rc[i].rix].rateCode;
-               series[i].RateIndex = rc[i].rix;
-               series[i].tx_power_cap = 0x3f;  /* XXX for now */
-
                /*
                 * PktDuration doesn't include slot, ACK, RTS, etc timing -
                 * it's just the packet duration
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to