PERFORCE change 137690 for review
Sam Leffler
sam at FreeBSD.org
Fri Mar 14 05:35:25 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=137690
Change 137690 by sam at sam_ebb on 2008/03/14 05:34:39
o track amrr changes
o replace callout thread to update amrr state by inline
calls to ieee80211_amrr_choose
Affected files ...
.. //depot/projects/vap/sys/dev/bwi/if_bwi.c#5 edit
.. //depot/projects/vap/sys/dev/bwi/if_bwivar.h#3 edit
Differences ...
==== //depot/projects/vap/sys/dev/bwi/if_bwi.c#5 (text+ko) ====
@@ -113,7 +113,6 @@
static void bwi_updateslot(struct ifnet *);
static struct ieee80211_node *bwi_node_alloc(struct ieee80211_node_table *);
static void bwi_newassoc(struct ieee80211_node *, int);
-static void bwi_amrr_timeout(void *);
static int bwi_media_change(struct ifnet *);
static void bwi_calibrate(void *);
@@ -600,7 +599,6 @@
const uint8_t bssid[IEEE80211_ADDR_LEN],
const uint8_t mac[IEEE80211_ADDR_LEN])
{
- struct bwi_softc *sc = ic->ic_ifp->if_softc;
struct bwi_vap *bvp;
struct ieee80211vap *vap;
@@ -621,10 +619,10 @@
#if 0
vap->iv_update_beacon = bwi_beacon_update;
#endif
- callout_init_mtx(&bvp->bv_amrr_ch, &sc->sc_mtx, 0);
ieee80211_amrr_init(&bvp->bv_amrr, vap,
IEEE80211_AMRR_MIN_SUCCESS_THRESHOLD,
- IEEE80211_AMRR_MAX_SUCCESS_THRESHOLD);
+ IEEE80211_AMRR_MAX_SUCCESS_THRESHOLD,
+ 500 /*ms*/);
/* complete setup */
ieee80211_vap_attach(vap, bwi_media_change, ieee80211_media_status);
@@ -637,7 +635,7 @@
{
struct bwi_vap *bvp = BWI_VAP(vap);
- callout_drain(&bvp->bv_amrr_ch);
+ ieee80211_amrr_cleanup(&bvp->bv_amrr);
ieee80211_vap_detach(vap);
free(bvp, M_80211_VAP);
}
@@ -1749,14 +1747,12 @@
struct bwi_vap *bvp = BWI_VAP(vap);
struct ifnet *ifp = vap->iv_ic->ic_ifp;
struct bwi_softc *sc = ifp->if_softc;
- const struct ieee80211_txparam *tp;
struct bwi_mac *mac;
struct ieee80211_node *ni;
int error;
BWI_LOCK(sc);
- callout_stop(&bvp->bv_amrr_ch);
callout_stop(&sc->sc_calib_ch);
if (nstate == IEEE80211_S_INIT)
@@ -1791,12 +1787,6 @@
bwi_newassoc(ni, 1);
}
- /* start automatic rate control timer */
- tp = &vap->iv_txparms[ieee80211_chan2mode(ni->ni_chan)];
- if (tp->ucastrate == IEEE80211_FIXED_RATE_NONE)
- callout_reset(&bvp->bv_amrr_ch, hz / 2,
- bwi_amrr_timeout, vap);
-
callout_reset(&sc->sc_calib_ch, hz, bwi_calibrate, sc);
} else {
bwi_set_bssid(sc, bwi_zero_addr);
@@ -1821,41 +1811,11 @@
bwi_newassoc(struct ieee80211_node *ni, int isnew)
{
struct ieee80211vap *vap = ni->ni_vap;
- int i;
- ieee80211_amrr_node_init(&BWI_VAP(vap)->bv_amrr, &BWI_NODE(ni)->amn);
-
- /* set rate to some reasonable initial value */
- for (i = ni->ni_rates.rs_nrates - 1;
- i > 0 && (ni->ni_rates.rs_rates[i] & IEEE80211_RATE_VAL) > 72;
- i--);
- ni->ni_txrate = i;
-}
-
-static void
-bwi_iter_func(void *arg, struct ieee80211_node *ni)
-{
- struct ieee80211vap *vap = arg;
- struct bwi_node *bn = BWI_NODE(ni);
-
- ieee80211_amrr_choose(&BWI_VAP(vap)->bv_amrr, ni, &bn->amn);
+ ieee80211_amrr_node_init(&BWI_VAP(vap)->bv_amrr,
+ &BWI_NODE(ni)->amn, ni);
}
-static void
-bwi_amrr_timeout(void *arg)
-{
- struct ieee80211vap *vap = arg;
- struct ieee80211com *ic = vap->iv_ic;
-
- BWI_ASSERT_LOCKED(sc);
-
- if (vap->iv_opmode == IEEE80211_M_STA)
- bwi_iter_func(vap, vap->iv_bss);
- else
- ieee80211_iterate_nodes(&ic->ic_sta, bwi_iter_func, vap);
- callout_reset(&BWI_VAP(vap)->bv_amrr_ch, hz / 2, bwi_amrr_timeout, vap);
-}
-
static int
bwi_media_change(struct ifnet *ifp)
{
@@ -3039,14 +2999,14 @@
else if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE)
rate = rate_fb = tp->ucastrate;
else {
- rate = ni->ni_rates.rs_rates[ni->ni_txrate] &
- IEEE80211_RATE_VAL;
- tb->tb_rate_idx[0] = ni->ni_txrate;
+ tb->tb_rate_idx[0] =
+ ieee80211_amrr_choose(ni, &BWI_NODE(ni)->amn);
+ rate = ni->ni_txrate;
- if (ni->ni_txrate > 0) {
- rate_fb = ni->ni_rates.rs_rates[ni->ni_txrate - 1] &
+ if (tb->tb_rate_idx[0] > 0) {
+ tb->tb_rate_idx[1] = tb->tb_rate_idx[0] - 1;
+ rate_fb = ni->ni_rates.rs_rates[tb->tb_rate_idx[1]] &
IEEE80211_RATE_VAL;
- tb->tb_rate_idx[1] = ni->ni_txrate - 1;
} else {
rate_fb = rate;
tb->tb_rate_idx[1] = tb->tb_rate_idx[0];
@@ -3424,12 +3384,11 @@
/* NB: update rate control only for unicast frames */
if (hdr->txh_mac_ctrl & htole32(BWI_TXH_MAC_C_ACK)) {
/* Feed back 'acked and data_txcnt' */
- if (acked &&
+ ieee80211_amrr_tx_complete(&bn->amn,
+ (acked &&
(data_txcnt <= BWI_SHRETRY_FB ||
- tb->tb_rate_idx[0] == tb->tb_rate_idx[1]))
- bn->amn.amn_success++;
- bn->amn.amn_txcnt++;
- bn->amn.amn_retrycnt += data_txcnt-1;
+ tb->tb_rate_idx[0] == tb->tb_rate_idx[1])),
+ data_txcnt-1);
}
/*
==== //depot/projects/vap/sys/dev/bwi/if_bwivar.h#3 (text+ko) ====
@@ -539,7 +539,6 @@
struct bwi_vap {
struct ieee80211vap bv_vap;
struct ieee80211_amrr bv_amrr;
- struct callout bv_amrr_ch;
int (*bv_newstate)(struct ieee80211vap *,
enum ieee80211_state, int);
};
More information about the p4-projects
mailing list