WinlabMadwifi-> Introduction to Rate Control = Rate Control = General Information could be found in this [http://madwifi.org/wiki/UserDocs/RateControl link]. Rate control, or rate adaptation, is a technique to adapt PHY channel rate in sender node. With the help of either some explicit feedback from recever (ACK frames) or implicit information (RSSI), the sender infers channel quality and choose a proper modulation scheme for next outgoing packet to maintain acceptable BER(PER) performance. Files involved for rate control: * ath/if_ath.c * ath/if_athrate.h * ath_rate/amrr/amrr.h * ath_rate/amrr/amrr.c * ath_rate/onoe/onoe.h * ath_rate/onoe/onoe.c * ath_rate/sample/sample.h * ath_rate/sample/sample.c == Main interfaces in if_ath.c == === When the rate is determined? === when a packet is xmitted, a rate has to be determined associate with this packet. This is done by ''ath_tx_start(struct net_device *dev, struct ieee80211_node *ni, struct ath_buf *bf, struct sk_buff *skb)'' function. {{{ if (ic->ic_fixed_rate == -1) { /* * Data frames; consult the rate control module. */ ath_rate_findrate(sc, an, shortPreamble, pktlen, &rix, &try0, &txrate); } else { rix = ic->ic_fixed_rate; try0 = ATH_TXMAXTRY; //XXX: should be configurabe if (shortPreamble) txrate = rt->info[rix].shortPreamble; else txrate = rt->info[rix].rateCode; } }}} === When statistics are collected? === After the packet is transmitted, function ''ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)'' is executed. In this function, {{{ sr = ds->ds_txstat.ts_shortretry; lr = ds->ds_txstat.ts_longretry; sc->sc_stats.ast_tx_shortretry += sr; sc->sc_stats.ast_tx_longretry += lr; /* * Hand the descriptor to the rate control algorithm. */ if ((ds->ds_txstat.ts_status & HAL_TXERR_FILT) == 0 && (bf->bf_flags & HAL_TXDESC_NOACK) == 0) ath_rate_tx_complete(sc, an, ds); }}} ''sc'' contains updated statistics and will be read by rate control module. == The purpose of a rate-control module? ==