From 3252f8852e9905f7b16c48f14f9b5122863553ad Mon Sep 17 00:00:00 2001 From: mentor Date: Sat, 1 Mar 2008 07:59:04 +0000 Subject: [PATCH] Merge -dfs to trunk - r3366 This commit should have been in trunk all along. Also, make one codepath sligthly less verbose. git-svn-id: http://madwifi-project.org/svn/madwifi/trunk@3367 0192ed92-7a03-0410-a25b-9323aeb14dbd --- ath/if_ath.c | 7 +++---- ath/if_athvar.h | 1 - ath_rate/sample/sample.c | 4 ++-- net80211/ieee80211_ioctl.h | 1 + net80211/ieee80211_proto.c | 1 + net80211/ieee80211_var.h | 1 + net80211/ieee80211_wireless.c | 17 ++++++++++++++++- 7 files changed, 24 insertions(+), 8 deletions(-) diff --git a/ath/if_ath.c b/ath/if_ath.c index c351753..2eb1545 100644 --- a/ath/if_ath.c +++ b/ath/if_ath.c @@ -5508,7 +5508,6 @@ ath_node_alloc(struct ieee80211vap *vap) if (an != NULL) { memset(an, 0, space); an->an_decomp_index = INVALID_DECOMP_INDEX; - an->an_avgrssi = ATH_RSSI_DUMMY_MARKER; an->an_halstats.ns_avgbrssi = ATH_RSSI_DUMMY_MARKER; an->an_halstats.ns_avgrssi = ATH_RSSI_DUMMY_MARKER; an->an_halstats.ns_avgtxrssi = ATH_RSSI_DUMMY_MARKER; @@ -5614,7 +5613,7 @@ ath_node_getrssi(const struct ieee80211_node *ni) #define HAL_EP_RND(x, mul) \ ((((x) % (mul)) >= ((mul) / 2)) ? ((x) + ((mul) - 1)) / \ (mul) : (x)/(mul)) - u_int32_t avgrssi = ATH_NODE_CONST(ni)->an_avgrssi; + u_int32_t avgrssi = ATH_NODE_CONST(ni)->an_halstats.ns_avgrssi; int32_t rssi; /* @@ -6551,7 +6550,7 @@ drop_micfail: /* Fast path: node is present in the key map; * grab a reference for processing the frame. */ ni = ieee80211_ref_node(ni); - ATH_RSSI_LPF(ATH_NODE(ni)->an_avgrssi, rs->rs_rssi); + ATH_RSSI_LPF(ATH_NODE(ni)->an_halstats.ns_avgrssi, rs->rs_rssi); type = ieee80211_input(ni->ni_vap, ni, skb, rs->rs_rssi, bf->bf_tsf); ieee80211_unref_node(&ni); } else { @@ -6564,7 +6563,7 @@ drop_micfail: if (ni != NULL) { ieee80211_keyix_t keyix; - ATH_RSSI_LPF(ATH_NODE(ni)->an_avgrssi, rs->rs_rssi); + ATH_RSSI_LPF(ATH_NODE(ni)->an_halstats.ns_avgrssi, rs->rs_rssi); type = ieee80211_input(ni->ni_vap, ni, skb, rs->rs_rssi, bf->bf_tsf); /* * If the station has a key cache slot assigned diff --git a/ath/if_athvar.h b/ath/if_athvar.h index bbdf31e..198149f 100644 --- a/ath/if_athvar.h +++ b/ath/if_athvar.h @@ -358,7 +358,6 @@ typedef STAILQ_HEAD(, ath_buf) ath_bufhead; struct ath_node { struct ieee80211_node an_node; /* base class */ u_int16_t an_decomp_index; /* decompression mask index */ - u_int32_t an_avgrssi; /* average rssi over all rx frames */ u_int8_t an_prevdatarix; /* rate ix of last data frame */ u_int16_t an_minffrate; /* min rate in kbps for ff to aggregate */ HAL_NODE_STATS an_halstats; /* rssi statistics used by hal */ diff --git a/ath_rate/sample/sample.c b/ath_rate/sample/sample.c index 7947da3..ff67819 100644 --- a/ath_rate/sample/sample.c +++ b/ath_rate/sample/sample.c @@ -425,9 +425,9 @@ ath_rate_findrate(struct ath_softc *sc, struct ath_node *an, * bit rates will not work. */ int initial_rate = 72; - if (an->an_avgrssi > 50) { + if (an->an_halstats.ns_avgrssi > 50) { initial_rate = 108; /* 54 mbps */ - } else if (an->an_avgrssi > 30) { + } else if (an->an_halstats.ns_avgrssi > 30) { initial_rate = 72; /* 36 mbps */ } else { initial_rate = 22; /* 11 mbps */ diff --git a/net80211/ieee80211_ioctl.h b/net80211/ieee80211_ioctl.h index 1bc1b5c..992f27c 100644 --- a/net80211/ieee80211_ioctl.h +++ b/net80211/ieee80211_ioctl.h @@ -641,6 +641,7 @@ enum { FCC requires 30m, so that is the default. */ IEEE80211_PARAM_BEACON_MISS_THRESH = 73, /* Beacon miss threshold (in beacons) */ IEEE80211_PARAM_BEACON_MISS_THRESH_MS = 74, /* Beacon miss threshold (in ms) */ + IEEE80211_PARAM_RSSI_EWMA = 75, }; #define SIOCG80211STATS (SIOCDEVPRIVATE+2) diff --git a/net80211/ieee80211_proto.c b/net80211/ieee80211_proto.c index c0e6d86..174f219 100644 --- a/net80211/ieee80211_proto.c +++ b/net80211/ieee80211_proto.c @@ -100,6 +100,7 @@ ieee80211_proto_attach(struct ieee80211com *ic) { ic->ic_protmode = IEEE80211_PROT_CTSONLY; + ic->ic_rssi_ewma = 0; ic->ic_wme.wme_hipri_switch_hysteresis = AGGRESSIVE_MODE_SWITCH_HYSTERESIS; diff --git a/net80211/ieee80211_var.h b/net80211/ieee80211_var.h index cb64916..3b77628 100644 --- a/net80211/ieee80211_var.h +++ b/net80211/ieee80211_var.h @@ -401,6 +401,7 @@ struct ieee80211com { /* XXX Multi-BSS: can per-VAP be done/make sense? */ enum ieee80211_protmode ic_protmode; /* 802.11g protection mode */ + int ic_rssi_ewma; u_int16_t ic_nonerpsta; /* # non-ERP stations */ u_int16_t ic_longslotsta; /* # long slot time stations */ u_int16_t ic_sta_assoc; /* stations associated */ diff --git a/net80211/ieee80211_wireless.c b/net80211/ieee80211_wireless.c index acde0cf..3aeec3b 100644 --- a/net80211/ieee80211_wireless.c +++ b/net80211/ieee80211_wireless.c @@ -1110,7 +1110,11 @@ ieee80211_ioctl_getspy(struct net_device *dev, struct iw_request_info *info, /* check we are associated w/ this vap */ if (ni) { if (ni->ni_vap == vap) { - set_quality(&spy_stat[i], ni->ni_rssi, ic->ic_channoise); + set_quality(&spy_stat[i], + ic->ic_rssi_ewma ? + ic->ic_node_getrssi(ni) : ni->ni_rssi, + ic->ic_channoise); + if (ni->ni_rtsf != vap->iv_spy.ts_rssi[i]) { vap->iv_spy.ts_rssi[i] = ni->ni_rtsf; } else { @@ -2311,6 +2315,9 @@ ieee80211_ioctl_setparam(struct net_device *dev, struct iw_request_info *info, IEEE80211_IS_CHAN_ANYG(ic->ic_bsschan)) retv = ENETRESET; break; + case IEEE80211_PARAM_RSSI_EWMA: + ic->ic_rssi_ewma = value; + break; case IEEE80211_PARAM_MCASTCIPHER: if ((vap->iv_caps & cipher2cap(value)) == 0 && !ieee80211_crypto_available(vap, value)) @@ -2942,6 +2949,9 @@ ieee80211_ioctl_getparam(struct net_device *dev, struct iw_request_info *info, case IEEE80211_PARAM_PROTMODE: param[0] = ic->ic_protmode; break; + case IEEE80211_PARAM_RSSI_EWMA: + param[0] = ic->ic_rssi_ewma; + break; case IEEE80211_PARAM_MCASTCIPHER: param[0] = rsn->rsn_mcastcipher; break; @@ -5607,6 +5617,11 @@ static const struct iw_priv_args ieee80211_priv_args[] = { { IEEE80211_IOCTL_FILTERFRAME, IW_PRIV_TYPE_FILTER , 0, "setfilter" }, + { IEEE80211_PARAM_RSSI_EWMA, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rssi_ewma" }, + { IEEE80211_PARAM_RSSI_EWMA, + 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_rssi_ewma" }, + #ifdef ATH_REVERSE_ENGINEERING /* Diagnostic dump of device registers