From owner-svn-src-head@FreeBSD.ORG Thu Feb 3 20:30:18 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1859E106564A; Thu, 3 Feb 2011 20:30:18 +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 0810A8FC12; Thu, 3 Feb 2011 20:30:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p13KUHJ9057587; Thu, 3 Feb 2011 20:30:17 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p13KUH9B057585; Thu, 3 Feb 2011 20:30:17 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201102032030.p13KUH9B057585@svn.freebsd.org> From: Adrian Chadd Date: Thu, 3 Feb 2011 20:30:17 +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: r218240 - head/sys/dev/ath X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Feb 2011 20:30:18 -0000 Author: adrian Date: Thu Feb 3 20:30:17 2011 New Revision: 218240 URL: http://svn.freebsd.org/changeset/base/218240 Log: Modify the TX path to set and use the 11n rate scenario bits. This isn't strictly required to TX (at least non-agg and non-HT40, non-short-GI) frames; but as it needs to be done anyway, just get it done. Linux ath9k uses the rate scenario style path for -all- packets, legacy or otherwise. This code does much the same. Beacon TX still uses the legacy, non-rate-scenario TX descriptor setup. Ath9k also does this. This 11n rate scenario path is only called for chips in the AR5416 HAL; legacy chips use the previous interface for TX'ing. Modified: head/sys/dev/ath/if_ath_tx.c Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Thu Feb 3 20:27:20 2011 (r218239) +++ head/sys/dev/ath/if_ath_tx.c Thu Feb 3 20:30:17 2011 (r218240) @@ -97,6 +97,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include /* * Whether to use the 11n rate scenario functions or not @@ -482,6 +483,10 @@ ath_tx_start(struct ath_softc *sc, struc HAL_BOOL shortPreamble; struct ath_node *an; u_int pri; + uint8_t try[4], rate[4]; + + bzero(try, sizeof(try)); + bzero(rate, sizeof(rate)); wh = mtod(m0, struct ieee80211_frame *); iswep = wh->i_fc[1] & IEEE80211_FC1_WEP; @@ -768,10 +773,17 @@ ath_tx_start(struct ath_softc *sc, struc txq->axq_intrcnt = 0; } + if (ath_tx_is_11n(sc)) { + rate[0] = rix; + try[0] = try0; + } + /* * Formulate first tx descriptor with tx controls. */ /* XXX check return value? */ + /* XXX is this ok to call for 11n descriptors? */ + /* XXX or should it go through the first, next, last 11n calls? */ ath_hal_setuptxdesc(ah, ds , pktlen /* packet length */ , hdrlen /* header length */ @@ -792,8 +804,16 @@ ath_tx_start(struct ath_softc *sc, struc * when the hardware supports multi-rate retry and * we don't use it. */ - if (ismrr) - ath_rate_setupxtxdesc(sc, an, ds, shortPreamble, rix); + if (ismrr) { + if (ath_tx_is_11n(sc)) + ath_rate_getxtxrates(sc, an, rix, rate, try); + else + ath_rate_setupxtxdesc(sc, an, ds, shortPreamble, rix); + } + + if (ath_tx_is_11n(sc)) { + ath_buf_set_rate(sc, ni, bf, pktlen, flags, ctsrate, rate, try); + } ath_tx_handoff(sc, txq, bf); return 0; @@ -817,6 +837,10 @@ ath_tx_raw_start(struct ath_softc *sc, s const HAL_RATE_TABLE *rt; struct ath_desc *ds; u_int pri; + uint8_t try[4], rate[4]; + + bzero(try, sizeof(try)); + bzero(rate, sizeof(rate)); wh = mtod(m0, struct ieee80211_frame *); ismcast = IEEE80211_IS_MULTICAST(wh->i_addr1); @@ -925,30 +949,56 @@ ath_tx_raw_start(struct ath_softc *sc, s ); bf->bf_txflags = flags; - if (ismrr) { - rix = ath_tx_findrix(sc, params->ibp_rate1); - rate1 = rt->info[rix].rateCode; - if (params->ibp_flags & IEEE80211_BPF_SHORTPRE) - rate1 |= rt->info[rix].shortPreamble; - if (params->ibp_try2) { - rix = ath_tx_findrix(sc, params->ibp_rate2); - rate2 = rt->info[rix].rateCode; - if (params->ibp_flags & IEEE80211_BPF_SHORTPRE) - rate2 |= rt->info[rix].shortPreamble; - } else - rate2 = 0; - if (params->ibp_try3) { - rix = ath_tx_findrix(sc, params->ibp_rate3); - rate3 = rt->info[rix].rateCode; + if (ath_tx_is_11n(sc)) { + rate[0] = ath_tx_findrix(sc, params->ibp_rate0); + try[0] = params->ibp_try0; + + if (ismrr) { + /* Remember, rate[] is actually an array of rix's -adrian */ + rate[0] = ath_tx_findrix(sc, params->ibp_rate0); + rate[1] = ath_tx_findrix(sc, params->ibp_rate1); + rate[2] = ath_tx_findrix(sc, params->ibp_rate2); + rate[3] = ath_tx_findrix(sc, params->ibp_rate3); + + try[0] = params->ibp_try0; + try[1] = params->ibp_try1; + try[2] = params->ibp_try2; + try[3] = params->ibp_try3; + } + } else { + if (ismrr) { + rix = ath_tx_findrix(sc, params->ibp_rate1); + rate1 = rt->info[rix].rateCode; if (params->ibp_flags & IEEE80211_BPF_SHORTPRE) - rate3 |= rt->info[rix].shortPreamble; - } else - rate3 = 0; - ath_hal_setupxtxdesc(ah, ds - , rate1, params->ibp_try1 /* series 1 */ - , rate2, params->ibp_try2 /* series 2 */ - , rate3, params->ibp_try3 /* series 3 */ - ); + rate1 |= rt->info[rix].shortPreamble; + if (params->ibp_try2) { + rix = ath_tx_findrix(sc, params->ibp_rate2); + rate2 = rt->info[rix].rateCode; + if (params->ibp_flags & IEEE80211_BPF_SHORTPRE) + rate2 |= rt->info[rix].shortPreamble; + } else + rate2 = 0; + if (params->ibp_try3) { + rix = ath_tx_findrix(sc, params->ibp_rate3); + rate3 = rt->info[rix].rateCode; + if (params->ibp_flags & IEEE80211_BPF_SHORTPRE) + rate3 |= rt->info[rix].shortPreamble; + } else + rate3 = 0; + ath_hal_setupxtxdesc(ah, ds + , rate1, params->ibp_try1 /* series 1 */ + , rate2, params->ibp_try2 /* series 2 */ + , rate3, params->ibp_try3 /* series 3 */ + ); + } + } + + if (ath_tx_is_11n(sc)) { + /* + * notice that rix doesn't include any of the "magic" flags txrate + * does for communicating "other stuff" to the HAL. + */ + ath_buf_set_rate(sc, ni, bf, pktlen, flags, ctsrate, rate, try); } /* NB: no buffered multicast in power save support */