summaryrefslogtreecommitdiffstats
path: root/sys/dev/bwi
diff options
context:
space:
mode:
authorrpaulo <rpaulo@FreeBSD.org>2010-04-07 15:29:13 +0000
committerrpaulo <rpaulo@FreeBSD.org>2010-04-07 15:29:13 +0000
commit69bf804b50328bc699737db57c5d38691d59780a (patch)
treeea8a3480b8652bfecee1f73168674b2f28571e3b /sys/dev/bwi
parent1db184691b1abeac975b128c17b5c4997b7bcf6c (diff)
downloadFreeBSD-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/bwi')
-rw-r--r--sys/dev/bwi/if_bwi.c44
-rw-r--r--sys/dev/bwi/if_bwivar.h7
2 files changed, 10 insertions, 41 deletions
diff --git a/sys/dev/bwi/if_bwi.c b/sys/dev/bwi/if_bwi.c
index 2604d83..c77004d 100644
--- a/sys/dev/bwi/if_bwi.c
+++ b/sys/dev/bwi/if_bwi.c
@@ -64,8 +64,8 @@ __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_phy.h>
+#include <net80211/ieee80211_ratectl.h>
#include <net/bpf.h>
@@ -112,9 +112,6 @@ static void bwi_set_channel(struct ieee80211com *);
static void bwi_scan_end(struct ieee80211com *);
static int bwi_newstate(struct ieee80211vap *, enum ieee80211_state, int);
static void bwi_updateslot(struct ifnet *);
-static struct ieee80211_node *bwi_node_alloc(struct ieee80211vap *,
- const uint8_t [IEEE80211_ADDR_LEN]);
-static void bwi_newassoc(struct ieee80211_node *, int);
static int bwi_media_change(struct ifnet *);
static void bwi_calibrate(void *);
@@ -525,7 +522,6 @@ bwi_attach(struct bwi_softc *sc)
ic->ic_vap_delete = bwi_vap_delete;
ic->ic_raw_xmit = bwi_raw_xmit;
ic->ic_updateslot = bwi_updateslot;
- ic->ic_node_alloc = bwi_node_alloc;
ic->ic_scan_start = bwi_scan_start;
ic->ic_scan_end = bwi_scan_end;
ic->ic_set_channel = bwi_set_channel;
@@ -621,10 +617,7 @@ bwi_vap_create(struct ieee80211com *ic,
#if 0
vap->iv_update_beacon = bwi_beacon_update;
#endif
- ieee80211_amrr_init(&bvp->bv_amrr, vap,
- IEEE80211_AMRR_MIN_SUCCESS_THRESHOLD,
- IEEE80211_AMRR_MAX_SUCCESS_THRESHOLD,
- 500 /*ms*/);
+ ieee80211_ratectl_init(vap);
/* complete setup */
ieee80211_vap_attach(vap, bwi_media_change, ieee80211_media_status);
@@ -637,7 +630,7 @@ bwi_vap_delete(struct ieee80211vap *vap)
{
struct bwi_vap *bvp = BWI_VAP(vap);
- ieee80211_amrr_cleanup(&bvp->bv_amrr);
+ ieee80211_ratectl_deinit(vap);
ieee80211_vap_detach(vap);
free(bvp, M_80211_VAP);
}
@@ -1831,7 +1824,7 @@ bwi_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
#endif
if (vap->iv_opmode == IEEE80211_M_STA) {
/* fake a join to init the tx rate */
- bwi_newassoc(ni, 1);
+ ic->ic_newassoc(ni, 1);
}
callout_reset(&sc->sc_calib_ch, hz, bwi_calibrate, sc);
@@ -1842,25 +1835,6 @@ back:
return error;
}
-/* ARGUSED */
-static struct ieee80211_node *
-bwi_node_alloc(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN])
-{
- struct bwi_node *bn;
-
- bn = malloc(sizeof(struct bwi_node), M_80211_NODE, M_NOWAIT | M_ZERO);
- return bn != NULL ? &bn->ni : NULL;
-}
-
-static void
-bwi_newassoc(struct ieee80211_node *ni, int isnew)
-{
- struct ieee80211vap *vap = ni->ni_vap;
-
- ieee80211_amrr_node_init(&BWI_VAP(vap)->bv_amrr,
- &BWI_NODE(ni)->amn, ni);
-}
-
static int
bwi_media_change(struct ifnet *ifp)
{
@@ -3012,7 +2986,7 @@ bwi_encap(struct bwi_softc *sc, int idx, struct mbuf *m,
} else if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE) {
rate = rate_fb = tp->ucastrate;
} else {
- rix = ieee80211_amrr_choose(ni, &BWI_NODE(ni)->amn);
+ rix = ieee80211_ratectl_rate(ni, NULL, pkt_len);
rate = ni->ni_txrate;
if (rix > 0) {
@@ -3369,6 +3343,7 @@ _bwi_txeof(struct bwi_softc *sc, uint16_t tx_id, int acked, int data_txcnt)
struct bwi_txbuf *tb;
int ring_idx, buf_idx;
struct ieee80211_node *ni;
+ struct ieee80211vap *vap;
if (tx_id == 0) {
if_printf(ifp, "%s: zero tx id\n", __func__);
@@ -3393,8 +3368,8 @@ _bwi_txeof(struct bwi_softc *sc, uint16_t tx_id, int acked, int data_txcnt)
bus_dmamap_unload(sc->sc_buf_dtag, tb->tb_dmap);
ni = tb->tb_ni;
+ vap = ni->ni_vap;
if (tb->tb_ni != NULL) {
- struct bwi_node *bn = (struct bwi_node *) tb->tb_ni;
const struct bwi_txbuf_hdr *hdr =
mtod(tb->tb_mbuf, const struct bwi_txbuf_hdr *);
@@ -3407,8 +3382,9 @@ _bwi_txeof(struct bwi_softc *sc, uint16_t tx_id, int acked, int data_txcnt)
* well so to avoid over-aggressive downshifting we
* treat any number of retries as "1".
*/
- ieee80211_amrr_tx_complete(&bn->amn, acked,
- data_txcnt > 1);
+ ieee80211_ratectl_tx_complete(vap, ni,
+ (data_txcnt > 1) ? IEEE80211_RATECTL_TX_SUCCESS :
+ IEEE80211_RATECTL_TX_FAILURE, &acked, NULL);
}
/*
diff --git a/sys/dev/bwi/if_bwivar.h b/sys/dev/bwi/if_bwivar.h
index 22a1b1e..d5f09da 100644
--- a/sys/dev/bwi/if_bwivar.h
+++ b/sys/dev/bwi/if_bwivar.h
@@ -533,15 +533,8 @@ struct bwi_rx_radiotap_hdr {
/* TODO: sq */
};
-struct bwi_node {
- struct ieee80211_node ni; /* must be the first */
- struct ieee80211_amrr_node amn;
-};
-#define BWI_NODE(ni) ((struct bwi_node *)(ni))
-
struct bwi_vap {
struct ieee80211vap bv_vap;
- struct ieee80211_amrr bv_amrr;
int (*bv_newstate)(struct ieee80211vap *,
enum ieee80211_state, int);
};
OpenPOWER on IntegriCloud