svn commit: r224912 - in user/adrian/if_ath_tx/sys/dev/ath: .
ath_rate/amrr ath_rate/onoe ath_rate/sample
Adrian Chadd
adrian at FreeBSD.org
Tue Aug 16 14:25:41 UTC 2011
Author: adrian
Date: Tue Aug 16 14:25:41 2011
New Revision: 224912
URL: http://svn.freebsd.org/changeset/base/224912
Log:
Begin to modify the ath rate path to use the stuff hiding in ath_buf
now, rather than passing around all these extra fields.
The (eventual) aim is to fully setup ath_buf.bf_state.bfs_rc with the
legacy rate code information, then populate the rate series stuff
as needed. Then legacy chips can use the bfs_rc rates, and 11n chipsets
can use the rate series (which will also be set for legacy rates.)
TODO: making sure the short preamble flag is set correctly everywhere.
This commit doesn't fully fix onoe/amrr to use the new API, I must
do that before I merge this into -HEAD.
Modified:
user/adrian/if_ath_tx/sys/dev/ath/ath_rate/amrr/amrr.c
user/adrian/if_ath_tx/sys/dev/ath/ath_rate/onoe/onoe.c
user/adrian/if_ath_tx/sys/dev/ath/ath_rate/sample/sample.c
user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c
user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx_ht.c
user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx_ht.h
user/adrian/if_ath_tx/sys/dev/ath/if_athrate.h
user/adrian/if_ath_tx/sys/dev/ath/if_athvar.h
Modified: user/adrian/if_ath_tx/sys/dev/ath/ath_rate/amrr/amrr.c
==============================================================================
--- user/adrian/if_ath_tx/sys/dev/ath/ath_rate/amrr/amrr.c Tue Aug 16 14:23:16 2011 (r224911)
+++ user/adrian/if_ath_tx/sys/dev/ath/ath_rate/amrr/amrr.c Tue Aug 16 14:25:41 2011 (r224912)
@@ -126,7 +126,7 @@ ath_rate_getxtxrates(struct ath_softc *s
{
struct amrr_node *amn = ATH_NODE_AMRR(an);
-/* rix[0] = amn->amn_tx_rate0; */
+ rix[0] = amn->amn_tx_rate0;
rix[1] = amn->amn_tx_rate1;
rix[2] = amn->amn_tx_rate2;
rix[3] = amn->amn_tx_rate3;
Modified: user/adrian/if_ath_tx/sys/dev/ath/ath_rate/onoe/onoe.c
==============================================================================
--- user/adrian/if_ath_tx/sys/dev/ath/ath_rate/onoe/onoe.c Tue Aug 16 14:23:16 2011 (r224911)
+++ user/adrian/if_ath_tx/sys/dev/ath/ath_rate/onoe/onoe.c Tue Aug 16 14:25:41 2011 (r224912)
@@ -134,7 +134,7 @@ ath_rate_getxtxrates(struct ath_softc *s
{
struct onoe_node *on = ATH_NODE_ONOE(an);
-/* rix[0] = on->on_tx_rate0; */
+ rix[0] = on->on_tx_rate0;
rix[1] = on->on_tx_rate1;
rix[2] = on->on_tx_rate2;
rix[3] = on->on_tx_rate3;
Modified: user/adrian/if_ath_tx/sys/dev/ath/ath_rate/sample/sample.c
==============================================================================
--- user/adrian/if_ath_tx/sys/dev/ath/ath_rate/sample/sample.c Tue Aug 16 14:23:16 2011 (r224911)
+++ user/adrian/if_ath_tx/sys/dev/ath/ath_rate/sample/sample.c Tue Aug 16 14:25:41 2011 (r224912)
@@ -446,22 +446,24 @@ done:
*/
void
ath_rate_getxtxrates(struct ath_softc *sc, struct ath_node *an,
- uint8_t rix0, uint8_t *rix, uint8_t *try)
+ uint8_t rix0, struct ath_rc_series *rc)
{
struct sample_node *sn = ATH_NODE_SAMPLE(an);
const struct txschedule *sched = &sn->sched[rix0];
KASSERT(rix0 == sched->r0, ("rix0 (%x) != sched->r0 (%x)!\n", rix0, sched->r0));
-/* rix[0] = sched->r0; */
- rix[1] = sched->r1;
- rix[2] = sched->r2;
- rix[3] = sched->r3;
-
- try[0] = sched->t0;
- try[1] = sched->t1;
- try[2] = sched->t2;
- try[3] = sched->t3;
+ rc[0].flags = rc[1].flags = rc[2].flags = rc[3].flags = 0;
+
+ rc[0].rix = sched->r0;
+ rc[1].rix = sched->r1;
+ rc[2].rix = sched->r2;
+ rc[3].rix = sched->r3;
+
+ rc[0].tries = sched->t0;
+ rc[1].tries = sched->t1;
+ rc[2].tries = sched->t2;
+ rc[3].tries = sched->t3;
}
void
Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c
==============================================================================
--- user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Tue Aug 16 14:23:16 2011 (r224911)
+++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Tue Aug 16 14:25:41 2011 (r224912)
@@ -654,10 +654,6 @@ ath_tx_normal_setup(struct ath_softc *sc
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;
@@ -972,9 +968,16 @@ ath_tx_normal_setup(struct ath_softc *sc
ieee80211_radiotap_tx(vap, m0);
}
+ /* Blank the legacy rate array */
+ bzero(&bf->bf_state.bfs_rc, sizeof(bf->bf_state.bfs_rc));
+
+ /*
+ * ath_buf_set_rate needs at least one rate/try to setup
+ * the rate scenario.
+ */
if (ath_tx_is_11n(sc)) {
- rate[0] = rix;
- try[0] = try0;
+ bf->bf_state.bfs_rc[0].rix = rix;
+ bf->bf_state.bfs_rc[0].tries = try0;
}
/* Store the decided rate index values away */
@@ -988,6 +991,7 @@ ath_tx_normal_setup(struct ath_softc *sc
bf->bf_state.bfs_txantenna = sc->sc_txantenna;
bf->bf_state.bfs_flags = flags;
bf->bf_txflags = flags;
+ bf->bf_state.bfs_shpream = shortPreamble;
/* XXX this should be done in ath_tx_setrate() */
bf->bf_state.bfs_ctsrate = ctsrate;
@@ -1009,17 +1013,15 @@ ath_tx_normal_setup(struct ath_softc *sc
if (ismrr) {
ATH_NODE_LOCK(an);
if (ath_tx_is_11n(sc))
- ath_rate_getxtxrates(sc, an, rix, rate, try);
+ ath_rate_getxtxrates(sc, an, rix, bf->bf_state.bfs_rc);
else
ath_rate_setupxtxdesc(sc, an, ds, shortPreamble, rix);
ATH_NODE_UNLOCK(an);
}
/* Setup 11n rate scenario for 11n NICs only */
- if (ath_tx_is_11n(sc)) {
- ath_buf_set_rate(sc, ni, bf, pktlen, flags, ctsrate,
- (atype == HAL_PKT_TYPE_PSPOLL), rate, try);
- }
+ if (ath_tx_is_11n(sc))
+ ath_buf_set_rate(sc, ni, bf);
return 0;
}
@@ -1198,13 +1200,9 @@ 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];
int o_tid = -1;
int do_override;
- bzero(try, sizeof(try));
- bzero(rate, sizeof(rate));
-
wh = mtod(m0, struct ieee80211_frame *);
ismcast = IEEE80211_IS_MULTICAST(wh->i_addr1);
hdrlen = ieee80211_anyhdrsize(wh);
@@ -1319,6 +1317,8 @@ ath_tx_raw_start(struct ath_softc *sc, s
bf->bf_state.bfs_txantenna = txantenna;
bf->bf_state.bfs_flags = flags;
bf->bf_txflags = flags;
+ bf->bf_state.bfs_shpream =
+ !! (params->ibp_flags & IEEE80211_BPF_SHORTPRE);
/* XXX this should be done in ath_tx_setrate() */
bf->bf_state.bfs_ctsrate = ctsrate;
@@ -1327,21 +1327,32 @@ ath_tx_raw_start(struct ath_softc *sc, s
ath_tx_setds(sc, bf);
+ /* Blank the legacy rate array */
+ bzero(&bf->bf_state.bfs_rc, sizeof(bf->bf_state.bfs_rc));
+
if (ath_tx_is_11n(sc)) {
- rate[0] = ath_tx_findrix(sc, params->ibp_rate0);
- try[0] = params->ibp_try0;
+ bf->bf_state.bfs_rc[0].rix = ath_tx_findrix(sc, params->ibp_rate0);
+ bf->bf_state.bfs_rc[0].tries = 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;
+ bf->bf_state.bfs_rc[0].rix =
+ ath_tx_findrix(sc, params->ibp_rate0);
+ bf->bf_state.bfs_rc[1].rix =
+ ath_tx_findrix(sc, params->ibp_rate1);
+ bf->bf_state.bfs_rc[2].rix =
+ ath_tx_findrix(sc, params->ibp_rate2);
+ bf->bf_state.bfs_rc[3].rix =
+ ath_tx_findrix(sc, params->ibp_rate3);
+
+ bf->bf_state.bfs_rc[0].tries =
+ params->ibp_try0;
+ bf->bf_state.bfs_rc[1].tries =
+ params->ibp_try1;
+ bf->bf_state.bfs_rc[2].tries =
+ params->ibp_try2;
+ bf->bf_state.bfs_rc[3].tries =
+ params->ibp_try3;
}
} else {
if (ismrr) {
@@ -1376,8 +1387,7 @@ ath_tx_raw_start(struct ath_softc *sc, s
* 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,
- (atype == HAL_PKT_TYPE_PSPOLL), rate, try);
+ ath_buf_set_rate(sc, ni, bf);
}
/* NB: no buffered multicast in power save support */
Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx_ht.c
==============================================================================
--- user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx_ht.c Tue Aug 16 14:23:16 2011 (r224911)
+++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx_ht.c Tue Aug 16 14:25:41 2011 (r224912)
@@ -122,8 +122,7 @@ int ath_max_4ms_framelen[4][32] = {
*/
static void
ath_rateseries_setup(struct ath_softc *sc, struct ieee80211_node *ni,
- HAL_11N_RATE_SERIES *series, unsigned int pktlen, uint8_t *rix,
- uint8_t *try, int flags)
+ struct ath_buf *bf, HAL_11N_RATE_SERIES *series)
{
#define HT_RC_2_STREAMS(_rc) ((((_rc) & 0x78) >> 3) + 1)
struct ieee80211com *ic = ni->ni_ic;
@@ -131,6 +130,9 @@ ath_rateseries_setup(struct ath_softc *s
HAL_BOOL shortPreamble = AH_FALSE;
const HAL_RATE_TABLE *rt = sc->sc_currates;
int i;
+ int pktlen = bf->bf_state.bfs_pktlen;
+ int flags = bf->bf_state.bfs_flags;
+ struct ath_rc_series *rc = bf->bf_state.bfs_rc;
if ((ic->ic_flags & IEEE80211_F_SHPREAMBLE) &&
(ni->ni_capinfo & IEEE80211_CAPINFO_SHORT_PREAMBLE))
@@ -139,10 +141,10 @@ ath_rateseries_setup(struct ath_softc *s
memset(series, 0, sizeof(HAL_11N_RATE_SERIES) * 4);
for (i = 0; i < 4; i++) {
/* Only set flags for actual TX attempts */
- if (try[i] == 0)
+ if (rc[i].tries == 0)
continue;
- series[i].Tries = try[i];
+ series[i].Tries = rc[i].tries;
/*
* XXX this isn't strictly correct - sc_txchainmask
@@ -181,7 +183,7 @@ ath_rateseries_setup(struct ath_softc *s
ni->ni_htcap & IEEE80211_HTCAP_SHORTGI20)
series[i].RateFlags |= HAL_RATESERIES_HALFGI;
- series[i].Rate = rt->info[rix[i]].rateCode;
+ series[i].Rate = rt->info[rc[i].rix].rateCode;
/* PktDuration doesn't include slot, ACK, RTS, etc timing - it's just the packet duration */
if (series[i].Rate & IEEE80211_RATE_MCS) {
@@ -193,9 +195,10 @@ ath_rateseries_setup(struct ath_softc *s
, series[i].RateFlags & HAL_RATESERIES_HALFGI);
} else {
if (shortPreamble)
- series[i].Rate |= rt->info[rix[i]].shortPreamble;
+ series[i].Rate |=
+ rt->info[rc[i].rix].shortPreamble;
series[i].PktDuration = ath_hal_computetxtime(ah,
- rt, pktlen, rix[i], shortPreamble);
+ rt, pktlen, rc[i].rix, shortPreamble);
}
}
#undef HT_RC_2_STREAMS
@@ -227,18 +230,21 @@ ath_rateseries_print(HAL_11N_RATE_SERIES
*/
void
-ath_buf_set_rate(struct ath_softc *sc, struct ieee80211_node *ni, struct ath_buf *bf,
- int pktlen, int flags, uint8_t ctsrate, int is_pspoll, uint8_t *rix, uint8_t *try)
+ath_buf_set_rate(struct ath_softc *sc, struct ieee80211_node *ni,
+ struct ath_buf *bf)
{
HAL_11N_RATE_SERIES series[4];
struct ath_desc *ds = bf->bf_desc;
struct ath_desc *lastds = NULL;
struct ath_hal *ah = sc->sc_ah;
+ int is_pspoll = (bf->bf_state.bfs_atype == HAL_PKT_TYPE_PSPOLL);
+ int ctsrate = bf->bf_state.bfs_ctsrate;
+ int flags = bf->bf_state.bfs_flags;
/* Setup rate scenario */
memset(&series, 0, sizeof(series));
- ath_rateseries_setup(sc, ni, series, pktlen, rix, try, flags);
+ ath_rateseries_setup(sc, ni, bf, series);
/* Enforce AR5416 aggregate limit - can't do RTS w/ an agg frame > 8k */
Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx_ht.h
==============================================================================
--- user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx_ht.h Tue Aug 16 14:23:16 2011 (r224911)
+++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx_ht.h Tue Aug 16 14:25:41 2011 (r224912)
@@ -41,8 +41,6 @@ enum {
extern int ath_max_4ms_framelen[4][32];
extern void ath_buf_set_rate(struct ath_softc *sc,
- struct ieee80211_node *ni, struct ath_buf *bf,
- int pktlen, int flags, uint8_t ctsrate, int is_pspoll,
- uint8_t *rix, uint8_t *try);
+ struct ieee80211_node *ni, struct ath_buf *bf);
#endif
Modified: user/adrian/if_ath_tx/sys/dev/ath/if_athrate.h
==============================================================================
--- user/adrian/if_ath_tx/sys/dev/ath/if_athrate.h Tue Aug 16 14:23:16 2011 (r224911)
+++ user/adrian/if_ath_tx/sys/dev/ath/if_athrate.h Tue Aug 16 14:25:41 2011 (r224912)
@@ -77,6 +77,8 @@ struct ath_ratectrl {
struct ath_ratectrl *ath_rate_attach(struct ath_softc *);
void ath_rate_detach(struct ath_ratectrl *);
+#define ATH_RC_NUM 4
+
struct ath_rc_series {
uint8_t rix;
uint8_t tries;
@@ -111,7 +113,7 @@ void ath_rate_newassoc(struct ath_softc
* Return the four TX rate index and try counts for the current data packet.
*/
void ath_rate_getxtxrates(struct ath_softc *sc, struct ath_node *an,
- uint8_t rix0, uint8_t *rix, uint8_t *try);
+ uint8_t rix0, struct ath_rc_series *rc);
/*
* Return the transmit info for a data packet. If multi-rate state
Modified: user/adrian/if_ath_tx/sys/dev/ath/if_athvar.h
==============================================================================
--- user/adrian/if_ath_tx/sys/dev/ath/if_athvar.h Tue Aug 16 14:23:16 2011 (r224911)
+++ user/adrian/if_ath_tx/sys/dev/ath/if_athvar.h Tue Aug 16 14:25:41 2011 (r224912)
@@ -227,10 +227,10 @@ struct ath_buf {
int bfs_txpower; /* tx power */
int bfs_txantenna; /* TX antenna config */
enum ieee80211_protmode bfs_protmode;
- HAL_11N_RATE_SERIES bfs_rc11n[4]; /* 11n TX series */
+ HAL_11N_RATE_SERIES bfs_rc11n[ATH_RC_NUM]; /* 11n TX series */
int bfs_ctsrate; /* CTS rate */
int bfs_ctsduration; /* CTS duration (pre-11n NICs) */
- struct ath_rc_series bfs_rc[4]; /* non-11n TX series */
+ struct ath_rc_series bfs_rc[ATH_RC_NUM]; /* non-11n TX series */
} bf_state;
};
typedef STAILQ_HEAD(, ath_buf) ath_bufhead;
More information about the svn-src-user
mailing list