Bug 170302 - [ath] 802.11n frames are not being transmitted with multiple rates
Summary: [ath] 802.11n frames are not being transmitted with multiple rates
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: wireless (show other bugs)
Version: 9.0-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-wireless (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-01 00:50 UTC by Adrian Chadd
Modified: 2019-01-20 01:28 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Chadd freebsd_committer freebsd_triage 2012-08-01 00:50:09 UTC
When doing some debugging, I noticed that the rate control code is not transmitting frames with multiple rate retries.

For example, with 'sysctl dev.ath.0.debug=2' set (TX descriptor debugging):


Q1[  0] (DS.V:0xea739000 DS.P:0x1d29c000) L:00000000 D:3958d82c F:0005
        Seq: 1904 swtry: 0 ADDBAW?: 0 DOBAW?: 0
        417f0242 00008240 00048000 0000008f 0000803a 00000000
        00000000 0090000f 00000000 3f000000 3f000000 3f000000 0080292c 00000101
        4ccfdabf ffffffff ffffffff 2d80282a 80808080 80808080 80808080 0000056b
  [end]
Q1[  0] (DS.V:0xea739000 DS.P:0x1d29c000) L:00000000 D:3958d82c F:0005 *
        Seq: 1904 swtry: 0 ADDBAW?: 0 DOBAW?: 0
        417f0242 00008240 00048000 0000008f 0000803a 00000000
        00000000 0090000f 00000000 3f000000 3f000000 3f000000 0080292c 00000101
        4ccfdabf ffffffff ffffffff 2d80282a 80808080 80808080 80808080 0000056b
  [end]

. descriptor field 3 is 0x8f, which shows only one 11n rate (rate attempt #0) is set.

Fix: 

The TX and rate control paths assume that if RTS/CTS is enabled, multi-rate retry should be disabled.

This is because of a limitation with the pre-11n chips - the AR5212 supports multi-rate retry but not with RTS/CTS enabled.
How-To-Repeat: associate to an 802.11n AP.
Comment 1 Adrian Chadd freebsd_committer freebsd_triage 2012-08-01 00:51:48 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-wireless

Punt to maintainer
Comment 2 dfilter service freebsd_committer freebsd_triage 2012-08-01 00:54:31 UTC
Author: adrian
Date: Tue Jul 31 23:54:15 2012
New Revision: 238961
URL: http://svn.freebsd.org/changeset/base/238961

Log:
  Allow 802.11n hardware to support multi-rate retry when RTS/CTS is
  enabled.
  
  The legacy (pre-802.11n) hardware doesn't support this - although
  the AR5212 era hardware supports MRR, it doesn't have all the bits
  needed to support MRR + RTS/CTS.  The AR5416 and later support
  a packet duration and RTS/CTS flags per rate scenario, so we should
  support it.
  
  Tested:
  
  * AR9280, STA
  
  PR:		kern/170302

Modified:
  head/sys/dev/ath/ath_rate/sample/sample.c
  head/sys/dev/ath/if_ath.c
  head/sys/dev/ath/if_ath_tx.c
  head/sys/dev/ath/if_athvar.h

Modified: head/sys/dev/ath/ath_rate/sample/sample.c
==============================================================================
--- head/sys/dev/ath/ath_rate/sample/sample.c	Tue Jul 31 23:34:06 2012	(r238960)
+++ head/sys/dev/ath/ath_rate/sample/sample.c	Tue Jul 31 23:54:15 2012	(r238961)
@@ -502,8 +502,10 @@ ath_rate_findrate(struct ath_softc *sc, 
 		goto done;
 	}
 
-	/* XXX TODO: this doesn't know about 11gn vs 11g protection; teach it */
-	mrr = sc->sc_mrretry && !(ic->ic_flags & IEEE80211_F_USEPROT);
+	mrr = sc->sc_mrretry;
+	/* XXX check HT protmode too */
+	if (mrr && (ic->ic_flags & IEEE80211_F_USEPROT) && !sc->sc_mrrprot)
+		mrr = 0;
 
 	best_rix = pick_best_rate(an, rt, size_bin, !mrr);
 	if (best_rix >= 0) {
@@ -910,7 +912,11 @@ ath_rate_tx_complete(struct ath_softc *s
 		    short_tries, long_tries);
 		return;
 	}
-	mrr = sc->sc_mrretry && !(ic->ic_flags & IEEE80211_F_USEPROT);
+	mrr = sc->sc_mrretry;
+	/* XXX check HT protmode too */
+	if (mrr && (ic->ic_flags & IEEE80211_F_USEPROT) && !sc->sc_mrrprot)
+		mrr = 0;
+
 	if (!mrr || ts->ts_finaltsi == 0) {
 		if (!IS_RATE_DEFINED(sn, final_rix)) {
 			badrate(ifp, 0, ts->ts_rate, long_tries, status);

Modified: head/sys/dev/ath/if_ath.c
==============================================================================
--- head/sys/dev/ath/if_ath.c	Tue Jul 31 23:34:06 2012	(r238960)
+++ head/sys/dev/ath/if_ath.c	Tue Jul 31 23:54:15 2012	(r238961)
@@ -705,6 +705,12 @@ ath_attach(u_int16_t devid, struct ath_s
 		(void) ath_hal_settxchainmask(sc->sc_ah, tx_chainmask);
 	}
 
+	/*
+	 * Disable MRR with protected frames by default.
+	 * Only 802.11n series NICs can handle this.
+	 */
+	sc->sc_mrrprot = 0;	/* XXX should be a capability */
+
 #ifdef	ATH_ENABLE_11N
 	/*
 	 * Query HT capabilities
@@ -714,6 +720,9 @@ ath_attach(u_int16_t devid, struct ath_s
 		int rxs, txs;
 
 		device_printf(sc->sc_dev, "[HT] enabling HT modes\n");
+
+		sc->sc_mrrprot = 1;	/* XXX should be a capability */
+
 		ic->ic_htcaps = IEEE80211_HTC_HT	/* HT operation */
 			    | IEEE80211_HTC_AMPDU	/* A-MPDU tx/rx */
 			    | IEEE80211_HTC_AMSDU	/* A-MSDU tx/rx */

Modified: head/sys/dev/ath/if_ath_tx.c
==============================================================================
--- head/sys/dev/ath/if_ath_tx.c	Tue Jul 31 23:34:06 2012	(r238960)
+++ head/sys/dev/ath/if_ath_tx.c	Tue Jul 31 23:54:15 2012	(r238961)
@@ -1051,11 +1051,12 @@ ath_tx_set_rtscts(struct ath_softc *sc, 
 	
 	/*
 	 * Must disable multi-rate retry when using RTS/CTS.
-	 * XXX TODO: only for pre-11n NICs.
 	 */
-	bf->bf_state.bfs_ismrr = 0;
-	bf->bf_state.bfs_try0 =
-	    bf->bf_state.bfs_rc[0].tries = ATH_TXMGTTRY;	/* XXX ew */
+	if (!sc->sc_mrrprot) {
+		bf->bf_state.bfs_ismrr = 0;
+		bf->bf_state.bfs_try0 =
+		    bf->bf_state.bfs_rc[0].tries = ATH_TXMGTTRY; /* XXX ew */
+	}
 }
 
 /*

Modified: head/sys/dev/ath/if_athvar.h
==============================================================================
--- head/sys/dev/ath/if_athvar.h	Tue Jul 31 23:34:06 2012	(r238960)
+++ head/sys/dev/ath/if_athvar.h	Tue Jul 31 23:54:15 2012	(r238961)
@@ -463,6 +463,7 @@ struct ath_softc {
 	void			(*sc_setdefantenna)(struct ath_softc *, u_int);
 	unsigned int		sc_invalid  : 1,/* disable hardware accesses */
 				sc_mrretry  : 1,/* multi-rate retry support */
+				sc_mrrprot  : 1,/* MRR + protection support */
 				sc_softled  : 1,/* enable LED gpio status */
 				sc_hardled  : 1,/* enable MAC LED status */
 				sc_splitmic : 1,/* split TKIP MIC keys */
_______________________________________________
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-unsubscribe@freebsd.org"
Comment 3 dfilter service freebsd_committer freebsd_triage 2012-08-01 01:18:17 UTC
Author: adrian
Date: Wed Aug  1 00:18:02 2012
New Revision: 238962
URL: http://svn.freebsd.org/changeset/base/238962

Log:
  Fix a case of "mis-located braces".
  
  PR:		kern/170302

Modified:
  head/sys/dev/ath/ath_rate/sample/sample.c

Modified: head/sys/dev/ath/ath_rate/sample/sample.c
==============================================================================
--- head/sys/dev/ath/ath_rate/sample/sample.c	Tue Jul 31 23:54:15 2012	(r238961)
+++ head/sys/dev/ath/ath_rate/sample/sample.c	Wed Aug  1 00:18:02 2012	(r238962)
@@ -504,7 +504,7 @@ ath_rate_findrate(struct ath_softc *sc, 
 
 	mrr = sc->sc_mrretry;
 	/* XXX check HT protmode too */
-	if (mrr && (ic->ic_flags & IEEE80211_F_USEPROT) && !sc->sc_mrrprot)
+	if (mrr && (ic->ic_flags & IEEE80211_F_USEPROT && !sc->sc_mrrprot))
 		mrr = 0;
 
 	best_rix = pick_best_rate(an, rt, size_bin, !mrr);
@@ -914,7 +914,7 @@ ath_rate_tx_complete(struct ath_softc *s
 	}
 	mrr = sc->sc_mrretry;
 	/* XXX check HT protmode too */
-	if (mrr && (ic->ic_flags & IEEE80211_F_USEPROT) && !sc->sc_mrrprot)
+	if (mrr && (ic->ic_flags & IEEE80211_F_USEPROT && !sc->sc_mrrprot))
 		mrr = 0;
 
 	if (!mrr || ts->ts_finaltsi == 0) {
_______________________________________________
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-unsubscribe@freebsd.org"
Comment 4 Eitan Adler freebsd_committer freebsd_triage 2018-05-28 19:47:15 UTC
batch change:

For bugs that match the following
-  Status Is In progress 
AND
- Untouched since 2018-01-01.
AND
- Affects Base System OR Documentation

DO:

Reset to open status.


Note:
I did a quick pass but if you are getting this email it might be worthwhile to double check to see if this bug ought to be closed.
Comment 5 Oleksandr Tymoshenko freebsd_committer freebsd_triage 2019-01-20 01:28:20 UTC
There was a commit referencing this bug, but it's still not closed and has been inactive for some time. Closing as fixed. Please re-open it if the issue hasn't been completely resolved.