From owner-svn-src-all@FreeBSD.ORG Tue Jul 31 23:54:16 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9ED7C106564A; Tue, 31 Jul 2012 23:54:16 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 897208FC21; Tue, 31 Jul 2012 23:54:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6VNsGqq086931; Tue, 31 Jul 2012 23:54:16 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6VNsGfa086926; Tue, 31 Jul 2012 23:54:16 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201207312354.q6VNsGfa086926@svn.freebsd.org> From: Adrian Chadd Date: Tue, 31 Jul 2012 23:54:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238961 - in head/sys/dev/ath: . ath_rate/sample X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Jul 2012 23:54:16 -0000 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 */