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/wpi | |
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/wpi')
-rw-r--r-- | sys/dev/wpi/if_wpi.c | 47 | ||||
-rw-r--r-- | sys/dev/wpi/if_wpivar.h | 7 |
2 files changed, 10 insertions, 44 deletions
diff --git a/sys/dev/wpi/if_wpi.c b/sys/dev/wpi/if_wpi.c index 1797c2d..33c801b 100644 --- a/sys/dev/wpi/if_wpi.c +++ b/sys/dev/wpi/if_wpi.c @@ -93,6 +93,7 @@ __FBSDID("$FreeBSD$"); #include <net80211/ieee80211_var.h> #include <net80211/ieee80211_radiotap.h> #include <net80211/ieee80211_regdomain.h> +#include <net80211/ieee80211_ratectl.h> #include <netinet/in.h> #include <netinet/in_systm.h> @@ -173,8 +174,6 @@ static int wpi_alloc_tx_ring(struct wpi_softc *, struct wpi_tx_ring *, int, int); static void wpi_reset_tx_ring(struct wpi_softc *, struct wpi_tx_ring *); static void wpi_free_tx_ring(struct wpi_softc *, struct wpi_tx_ring *); -static struct ieee80211_node *wpi_node_alloc(struct ieee80211vap *, - const uint8_t mac[IEEE80211_ADDR_LEN]); static int wpi_newstate(struct ieee80211vap *, enum ieee80211_state, int); static void wpi_mem_lock(struct wpi_softc *); static void wpi_mem_unlock(struct wpi_softc *); @@ -235,7 +234,6 @@ static void wpi_init_locked(struct wpi_softc *, int); static void wpi_stop(struct wpi_softc *); static void wpi_stop_locked(struct wpi_softc *); -static void wpi_newassoc(struct ieee80211_node *, int); static int wpi_set_txpower(struct wpi_softc *, struct ieee80211_channel *, int); static void wpi_calib_timeout(void *); @@ -668,8 +666,6 @@ wpi_attach(device_t dev) ieee80211_ifattach(ic, macaddr); /* override default methods */ - ic->ic_node_alloc = wpi_node_alloc; - ic->ic_newassoc = wpi_newassoc; ic->ic_raw_xmit = wpi_raw_xmit; ic->ic_wme.wme_update = wpi_wme_update; ic->ic_scan_start = wpi_scan_start; @@ -782,11 +778,7 @@ wpi_vap_create(struct ieee80211com *ic, wvp->newstate = vap->iv_newstate; vap->iv_newstate = wpi_newstate; - ieee80211_amrr_init(&wvp->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); ic->ic_opmode = opmode; @@ -798,7 +790,7 @@ wpi_vap_delete(struct ieee80211vap *vap) { struct wpi_vap *wvp = WPI_VAP(vap); - ieee80211_amrr_cleanup(&wvp->amrr); + ieee80211_ratectl_deinit(vap); ieee80211_vap_detach(vap); free(wvp, M_80211_VAP); } @@ -1236,18 +1228,6 @@ wpi_resume(device_t dev) return 0; } -/* ARGSUSED */ -static struct ieee80211_node * -wpi_node_alloc(struct ieee80211vap *vap __unused, - const uint8_t mac[IEEE80211_ADDR_LEN] __unused) -{ - struct wpi_node *wn; - - wn = malloc(sizeof (struct wpi_node), M_80211_NODE, M_NOWAIT | M_ZERO); - - return &wn->ni; -} - /** * Called by net80211 when ever there is a change to 80211 state machine */ @@ -1567,7 +1547,9 @@ wpi_tx_intr(struct wpi_softc *sc, struct wpi_rx_desc *desc) struct wpi_tx_ring *ring = &sc->txq[desc->qid & 0x3]; struct wpi_tx_data *txdata = &ring->data[desc->idx]; struct wpi_tx_stat *stat = (struct wpi_tx_stat *)(desc + 1); - struct wpi_node *wn = (struct wpi_node *)txdata->ni; + struct ieee80211_node *ni = txdata->ni; + struct ieee80211vap *vap = ni->ni_vap; + int retrycnt = 0; DPRINTFN(WPI_DEBUG_TX, ("tx done: qid=%d idx=%d retries=%d nkill=%d " "rate=%x duration=%d status=%x\n", desc->qid, desc->idx, @@ -1580,11 +1562,12 @@ wpi_tx_intr(struct wpi_softc *sc, struct wpi_rx_desc *desc) * the lowest available bit-rate. * XXX frames w/o ACK shouldn't be used either */ - wn->amn.amn_txcnt++; if (stat->ntries > 0) { DPRINTFN(WPI_DEBUG_TX, ("%d retries\n", stat->ntries)); - wn->amn.amn_retrycnt++; + retrycnt = 1; } + ieee80211_ratectl_tx_complete(vap, ni, IEEE80211_RATECTL_TX_SUCCESS, + &retrycnt, NULL); /* XXX oerrors should only count errors !maxtries */ if ((le32toh(stat->status) & 0xff) != 1) @@ -1919,7 +1902,7 @@ wpi_tx_data(struct wpi_softc *sc, struct mbuf *m0, struct ieee80211_node *ni, } else if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE) { rate = tp->ucastrate; } else { - (void) ieee80211_amrr_choose(ni, &WPI_NODE(ni)->amn); + (void) ieee80211_ratectl_rate(ni, NULL, 0); rate = ni->ni_txrate; } tx->rate = wpi_plcp_signal(rate); @@ -3212,15 +3195,6 @@ wpi_stop(struct wpi_softc *sc) } static void -wpi_newassoc(struct ieee80211_node *ni, int isnew) -{ - struct ieee80211vap *vap = ni->ni_vap; - struct wpi_vap *wvp = WPI_VAP(vap); - - ieee80211_amrr_node_init(&wvp->amrr, &WPI_NODE(ni)->amn, ni); -} - -static void wpi_calib_timeout(void *arg) { struct wpi_softc *sc = arg; @@ -3706,4 +3680,3 @@ static const char *wpi_cmd_str(int cmd) MODULE_DEPEND(wpi, pci, 1, 1, 1); MODULE_DEPEND(wpi, wlan, 1, 1, 1); MODULE_DEPEND(wpi, firmware, 1, 1, 1); -MODULE_DEPEND(wpi, wlan_amrr, 1, 1, 1); diff --git a/sys/dev/wpi/if_wpivar.h b/sys/dev/wpi/if_wpivar.h index 811624b..00579b3e 100644 --- a/sys/dev/wpi/if_wpivar.h +++ b/sys/dev/wpi/if_wpivar.h @@ -106,12 +106,6 @@ struct wpi_amrr { int recovery; }; -struct wpi_node { - struct ieee80211_node ni; /* must be the first */ - struct ieee80211_amrr_node amn; -}; -#define WPI_NODE(ni) ((struct wpi_node *)(ni)) - struct wpi_power_sample { uint8_t index; int8_t power; @@ -127,7 +121,6 @@ struct wpi_power_group { struct wpi_vap { struct ieee80211vap vap; - struct ieee80211_amrr amrr; int (*newstate)(struct ieee80211vap *, enum ieee80211_state, int); |