From 728432240e2e1ddb7c836030dfe3eb98e07e0449 Mon Sep 17 00:00:00 2001 From: adrian Date: Tue, 1 Feb 2011 08:10:18 +0000 Subject: Add a new method to the rate control modules which extract out the three other rates and try counts. The 11n rate scenario path wants to take a list of rate and tries, rather than calling setupxtxdesc(). --- sys/dev/ath/ath_rate/amrr/amrr.c | 24 ++++++++++++++++++++++++ sys/dev/ath/ath_rate/onoe/onoe.c | 23 +++++++++++++++++++++++ sys/dev/ath/ath_rate/sample/sample.c | 24 ++++++++++++++++++++++++ sys/dev/ath/if_athrate.h | 6 ++++++ 4 files changed, 77 insertions(+) diff --git a/sys/dev/ath/ath_rate/amrr/amrr.c b/sys/dev/ath/ath_rate/amrr/amrr.c index 88e71e6..5fee76e 100644 --- a/sys/dev/ath/ath_rate/amrr/amrr.c +++ b/sys/dev/ath/ath_rate/amrr/amrr.c @@ -114,6 +114,30 @@ ath_rate_findrate(struct ath_softc *sc, struct ath_node *an, *txrate = amn->amn_tx_rate0; } +/* + * Get the TX rates. + * + * The short preamble bits aren't set here; the caller should augment + * the returned rate with the relevant preamble rate flag. + */ +void +ath_rate_getxtxrates(struct ath_softc *sc, struct ath_node *an, + uint8_t rix0, uint8_t *rix, uint8_t *try) +{ + struct amrr_node *amn = ATH_NODE_AMRR(an); + +/* rix[0] = amn->amn_tx_rate0; */ + rix[1] = amn->amn_tx_rate1; + rix[2] = amn->amn_tx_rate2; + rix[3] = amn->amn_tx_rate3; + + try[0] = amn->amn_tx_try0; + try[1] = amn->amn_tx_try1; + try[2] = amn->amn_tx_try2; + try[3] = amn->amn_tx_try3; +} + + void ath_rate_setupxtxdesc(struct ath_softc *sc, struct ath_node *an, struct ath_desc *ds, int shortPreamble, u_int8_t rix) diff --git a/sys/dev/ath/ath_rate/onoe/onoe.c b/sys/dev/ath/ath_rate/onoe/onoe.c index 22811c4..77236ad 100644 --- a/sys/dev/ath/ath_rate/onoe/onoe.c +++ b/sys/dev/ath/ath_rate/onoe/onoe.c @@ -122,6 +122,29 @@ ath_rate_findrate(struct ath_softc *sc, struct ath_node *an, *txrate = on->on_tx_rate0; } +/* + * Get the TX rates. + * + * The short preamble bits aren't set here; the caller should augment + * the returned rate with the relevant preamble rate flag. + */ +void +ath_rate_getxtxrates(struct ath_softc *sc, struct ath_node *an, + uint8_t rix0, uint8_t *rix, uint8_t *try) +{ + struct onoe_node *on = ATH_NODE_ONOE(an); + +/* rix[0] = on->on_tx_rate0; */ + rix[1] = on->on_tx_rate1; + rix[2] = on->on_tx_rate2; + rix[3] = on->on_tx_rate3; + + try[0] = on->on_tx_try0; + try[1] = 2; + try[2] = 2; + try[3] = 2; +} + void ath_rate_setupxtxdesc(struct ath_softc *sc, struct ath_node *an, struct ath_desc *ds, int shortPreamble, u_int8_t rix) diff --git a/sys/dev/ath/ath_rate/sample/sample.c b/sys/dev/ath/ath_rate/sample/sample.c index ad4c5e2..c993459 100644 --- a/sys/dev/ath/ath_rate/sample/sample.c +++ b/sys/dev/ath/ath_rate/sample/sample.c @@ -363,6 +363,30 @@ done: #undef RATE } +/* + * Get the TX rates. Don't fiddle with short preamble flags for them; + * the caller can do that. + */ +void +ath_rate_getxtxrates(struct ath_softc *sc, struct ath_node *an, + uint8_t rix0, uint8_t *rix, uint8_t *try) +{ + 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; +} + void ath_rate_setupxtxdesc(struct ath_softc *sc, struct ath_node *an, struct ath_desc *ds, int shortPreamble, u_int8_t rix) diff --git a/sys/dev/ath/if_athrate.h b/sys/dev/ath/if_athrate.h index 189db10..55b99a2 100644 --- a/sys/dev/ath/if_athrate.h +++ b/sys/dev/ath/if_athrate.h @@ -102,6 +102,12 @@ void ath_rate_newassoc(struct ath_softc *, struct ath_node *, * Transmit handling. */ /* + * 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); + +/* * Return the transmit info for a data packet. If multi-rate state * is to be setup then try0 should contain a value other than ATH_TXMATRY * and ath_rate_setupxtxdesc will be called after deciding if the frame -- cgit v1.1