Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F178206538
D62205.1796255384.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
4 KB
Referenced Files
None
Subscribers
None
D62205.1796255384.diff
View Options
diff --git a/sys/net80211/_ieee80211.h b/sys/net80211/_ieee80211.h
--- a/sys/net80211/_ieee80211.h
+++ b/sys/net80211/_ieee80211.h
@@ -428,6 +428,12 @@
*/
typedef int8_t net80211_nf_t;
+/*
+ * "Average" RSSI - used by the IEEE80211_RSSI_LPF family of macros.
+ * See ieee80211_node.h for more information.
+ */
+typedef uint32_t net80211_avgrssi_t;
+
/*
* 802.11 rate set.
*/
diff --git a/sys/net80211/ieee80211_node.h b/sys/net80211/ieee80211_node.h
--- a/sys/net80211/ieee80211_node.h
+++ b/sys/net80211/ieee80211_node.h
@@ -234,12 +234,12 @@
struct ieee80211_key ni_ucastkey; /* unicast key */
/* hardware */
- uint32_t ni_avgrssi; /* recv ssi state */
+ net80211_avgrssi_t ni_avgrssi; /* recv ssi state */
net80211_nf_t ni_noise; /* noise floor */
/* mimo statistics */
- uint32_t ni_mimo_rssi_ctl[IEEE80211_MAX_CHAINS];
- uint32_t ni_mimo_rssi_ext[IEEE80211_MAX_CHAINS];
+ net80211_avgrssi_t ni_mimo_rssi_ctl[IEEE80211_MAX_CHAINS];
+ net80211_avgrssi_t ni_mimo_rssi_ext[IEEE80211_MAX_CHAINS];
net80211_nf_t ni_mimo_noise_ctl[IEEE80211_MAX_CHAINS];
net80211_nf_t ni_mimo_noise_ext[IEEE80211_MAX_CHAINS];
uint8_t ni_mimo_chains;
@@ -359,10 +359,14 @@
* each sample incorporated with IEEE80211_RSSI_LPF. Use IEEE80211_RSSI_GET
* to extract the current value.
*
- * Note that we assume rssi data are in the range [-127..127] and we
+ * Note that we assume and cap rssi data are in the range [-127..127] and we
* discard values <-20. This is consistent with assumptions throughout
* net80211 that signal strength data are in .5 dBm units relative to
* the current noise floor (linear, not log).
+ *
+ * Note: this doesn't take into account ieee80211_rssi_t and whatever size
+ * it is. It currenly assumes the input rssi is an int8_t so the math is
+ * bounded to fit in a uint32_t.
*/
#define IEEE80211_RSSI_LPF_LEN 10
#define IEEE80211_RSSI_DUMMY_MARKER 127
@@ -373,7 +377,7 @@
(((x) != IEEE80211_RSSI_DUMMY_MARKER) ? (((x) * ((len) - 1) + (y)) / (len)) : (y))
#define IEEE80211_RSSI_LPF(x, y) do { \
if ((y) >= -20) { \
- x = _IEEE80211_RSSI_LPF((x), IEEE80211_RSSI_IN((y)), \
+ x = _IEEE80211_RSSI_LPF((x), IEEE80211_RSSI_IN((MIN(y, 127))), \
IEEE80211_RSSI_LPF_LEN); \
} \
} while (0)
@@ -381,6 +385,10 @@
((((x) % (mul)) >= ((mul)/2)) ? ((x) + ((mul) - 1)) / (mul) : (x)/(mul))
#define IEEE80211_RSSI_GET(x) \
IEEE80211_RSSI_EP_RND(x, IEEE80211_RSSI_EP_MULTIPLIER)
+#define IEEE80211_RSSI_LPF_INIT(x) \
+ do { \
+ (x) = IEEE80211_RSSI_DUMMY_MARKER; \
+ } while (0)
void ieee80211_node_attach(struct ieee80211com *);
void ieee80211_node_lateattach(struct ieee80211com *);
diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c
--- a/sys/net80211/ieee80211_node.c
+++ b/sys/net80211/ieee80211_node.c
@@ -1451,7 +1451,7 @@
ni->ni_txpower = ic->ic_txpowlimit; /* max power */
ni->ni_txparms = &vap->iv_txparms[ieee80211_chan2mode(ic->ic_curchan)];
ieee80211_crypto_resetkey(vap, &ni->ni_ucastkey, IEEE80211_KEYIX_NONE);
- ni->ni_avgrssi = IEEE80211_RSSI_DUMMY_MARKER;
+ IEEE80211_RSSI_LPF_INIT(ni->ni_avgrssi);
ni->ni_inact_reload = nt->nt_inact_init;
ni->ni_inact = ni->ni_inact_reload;
ni->ni_ath_defkeyix = 0x7fff;
diff --git a/sys/net80211/ieee80211_scan_sta.c b/sys/net80211/ieee80211_scan_sta.c
--- a/sys/net80211/ieee80211_scan_sta.c
+++ b/sys/net80211/ieee80211_scan_sta.c
@@ -85,7 +85,7 @@
uint8_t se_notseen; /* not seen in previous scans */
uint8_t se_flags;
#define STA_DEMOTE11B 0x01 /* match w/ demoted 11b chan */
- uint32_t se_avgrssi; /* LPF rssi state */
+ net80211_avgrssi_t se_avgrssi; /* LPF rssi state */
unsigned long se_lastupdate; /* time of last update */
unsigned long se_lastfail; /* time of last failure */
unsigned long se_lastassoc; /* time of last association */
@@ -265,7 +265,7 @@
return 0;
}
se->se_scangen = st->st_scaniter-1;
- se->se_avgrssi = IEEE80211_RSSI_DUMMY_MARKER;
+ IEEE80211_RSSI_LPF_INIT(se->se_avgrssi);
IEEE80211_ADDR_COPY(se->base.se_macaddr, macaddr);
TAILQ_INSERT_TAIL(&st->st_entry, se, se_list);
LIST_INSERT_HEAD(&st->st_hash[hash], se, se_hash);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Dec 2, 11:49 PM (23 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42160779
Default Alt Text
D62205.1796255384.diff (4 KB)
Attached To
Mode
D62205: net80211: add net80211_avgrssi_t ; clean up RSSI_LPF init and usage
Attached
Detach File
Event Timeline