diff options
author | rpaulo <rpaulo@FreeBSD.org> | 2010-04-07 15:29:13 +0000 |
---|---|---|
committer | rpaulo <rpaulo@FreeBSD.org> | 2010-04-07 15:29:13 +0000 |
commit | 69bf804b50328bc699737db57c5d38691d59780a (patch) | |
tree | ea8a3480b8652bfecee1f73168674b2f28571e3b /sys/dev/ral/rt2661.c | |
parent | 1db184691b1abeac975b128c17b5c4997b7bcf6c (diff) | |
download | FreeBSD-src-69bf804b50328bc699737db57c5d38691d59780a.zip FreeBSD-src-69bf804b50328bc699737db57c5d38691d59780a.tar.gz |
net80211 rate control framework (net80211 ratectl).
This framework allows drivers to abstract the rate control algorithm and
just feed the framework with the usable parameters. The rate control
framework will now deal with passing the parameters to the selected
algorithm. Right now we have AMRR (the default) and RSSADAPT but there's
no way to select one with ifconfig, yet.
The objective is to have more rate control algorithms in the net80211
stack so all drivers[0] can use it. Ideally, we'll have the well-known
sample rate control algorithm in the net80211 at some point so all
drivers can use it (not just ath).
[0] all drivers that do rate control in software, that is.
Reviewed by: bschmidt, thompsa, weyongo
MFC after: 1 months
Diffstat (limited to 'sys/dev/ral/rt2661.c')
-rw-r--r-- | sys/dev/ral/rt2661.c | 48 |
1 files changed, 14 insertions, 34 deletions
diff --git a/sys/dev/ral/rt2661.c b/sys/dev/ral/rt2661.c index 9e6693f..94ab9ca 100644 --- a/sys/dev/ral/rt2661.c +++ b/sys/dev/ral/rt2661.c @@ -55,7 +55,7 @@ __FBSDID("$FreeBSD$"); #include <net80211/ieee80211_var.h> #include <net80211/ieee80211_radiotap.h> #include <net80211/ieee80211_regdomain.h> -#include <net80211/ieee80211_amrr.h> +#include <net80211/ieee80211_ratectl.h> #include <netinet/in.h> #include <netinet/in_systm.h> @@ -100,8 +100,6 @@ static void rt2661_reset_rx_ring(struct rt2661_softc *, struct rt2661_rx_ring *); static void rt2661_free_rx_ring(struct rt2661_softc *, struct rt2661_rx_ring *); -static struct ieee80211_node *rt2661_node_alloc(struct ieee80211vap *, - const uint8_t [IEEE80211_ADDR_LEN]); static void rt2661_newassoc(struct ieee80211_node *, int); static int rt2661_newstate(struct ieee80211vap *, enum ieee80211_state, int); @@ -307,7 +305,6 @@ rt2661_attach(device_t dev, int id) ieee80211_ifattach(ic, macaddr); ic->ic_newassoc = rt2661_newassoc; - ic->ic_node_alloc = rt2661_node_alloc; #if 0 ic->ic_wme.wme_update = rt2661_wme_update; #endif @@ -428,11 +425,7 @@ rt2661_vap_create(struct ieee80211com *ic, vap->iv_update_beacon = rt2661_beacon_update; #endif - ieee80211_amrr_init(&rvp->amrr, vap, - IEEE80211_AMRR_MIN_SUCCESS_THRESHOLD, - IEEE80211_AMRR_MAX_SUCCESS_THRESHOLD, - 500 /* ms */); - + ieee80211_ratectl_init(vap); /* complete setup */ ieee80211_vap_attach(vap, ieee80211_media_change, ieee80211_media_status); if (TAILQ_FIRST(&ic->ic_vaps) == vap) @@ -445,7 +438,7 @@ rt2661_vap_delete(struct ieee80211vap *vap) { struct rt2661_vap *rvp = RT2661_VAP(vap); - ieee80211_amrr_cleanup(&rvp->amrr); + ieee80211_ratectl_deinit(vap); ieee80211_vap_detach(vap); free(rvp, M_80211_VAP); } @@ -771,25 +764,11 @@ rt2661_free_rx_ring(struct rt2661_softc *sc, struct rt2661_rx_ring *ring) bus_dma_tag_destroy(ring->data_dmat); } -static struct ieee80211_node * -rt2661_node_alloc(struct ieee80211vap *vap, - const uint8_t mac[IEEE80211_ADDR_LEN]) -{ - struct rt2661_node *rn; - - rn = malloc(sizeof (struct rt2661_node), M_80211_NODE, - M_NOWAIT | M_ZERO); - - return (rn != NULL) ? &rn->ni : NULL; -} - static void rt2661_newassoc(struct ieee80211_node *ni, int isnew) { - struct ieee80211vap *vap = ni->ni_vap; - - ieee80211_amrr_node_init(&RT2661_VAP(vap)->amrr, - &RT2661_NODE(ni)->amrr, ni); + /* XXX move */ + ieee80211_ratectl_node_init(ni); } static int @@ -899,9 +878,9 @@ rt2661_tx_intr(struct rt2661_softc *sc) struct ifnet *ifp = sc->sc_ifp; struct rt2661_tx_ring *txq; struct rt2661_tx_data *data; - struct rt2661_node *rn; uint32_t val; int qid, retrycnt; + struct ieee80211vap *vap; for (;;) { struct ieee80211_node *ni; @@ -921,13 +900,12 @@ rt2661_tx_intr(struct rt2661_softc *sc) data->m = NULL; ni = data->ni; data->ni = NULL; + vap = ni->ni_vap; /* if no frame has been sent, ignore */ if (ni == NULL) continue; - rn = RT2661_NODE(ni); - switch (RT2661_TX_RESULT(val)) { case RT2661_TX_SUCCESS: retrycnt = RT2661_TX_RETRYCNT(val); @@ -935,8 +913,9 @@ rt2661_tx_intr(struct rt2661_softc *sc) DPRINTFN(sc, 10, "data frame sent successfully after " "%d retries\n", retrycnt); if (data->rix != IEEE80211_FIXED_RATE_NONE) - ieee80211_amrr_tx_complete(&rn->amrr, - IEEE80211_AMRR_SUCCESS, retrycnt); + ieee80211_ratectl_tx_complete(vap, ni, + IEEE80211_RATECTL_TX_SUCCESS, + &retrycnt, NULL); ifp->if_opackets++; break; @@ -946,8 +925,9 @@ rt2661_tx_intr(struct rt2661_softc *sc) DPRINTFN(sc, 9, "%s\n", "sending data frame failed (too much retries)"); if (data->rix != IEEE80211_FIXED_RATE_NONE) - ieee80211_amrr_tx_complete(&rn->amrr, - IEEE80211_AMRR_FAILURE, retrycnt); + ieee80211_ratectl_tx_complete(vap, ni, + IEEE80211_RATECTL_TX_FAILURE, + &retrycnt, NULL); ifp->if_oerrors++; break; @@ -1511,7 +1491,7 @@ rt2661_tx_data(struct rt2661_softc *sc, struct mbuf *m0, } else if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE) { rate = tp->ucastrate; } else { - (void) ieee80211_amrr_choose(ni, &RT2661_NODE(ni)->amrr); + (void) ieee80211_ratectl_rate(ni, NULL, 0); rate = ni->ni_txrate; } rate &= IEEE80211_RATE_VAL; |