PERFORCE change 64069 for review
Sam Leffler
sam at FreeBSD.org
Mon Nov 1 14:48:38 PST 2004
http://perforce.freebsd.org/chv.cgi?CH=64069
Change 64069 by sam at sam_ebb on 2004/11/01 22:47:41
add ieee80211_getrssi that calculates an rssi based on the operating
mode; for station mode this just checks the ap, otherwise we calculate
an average over the "neighbors"
Affected files ...
.. //depot/projects/wifi/sys/net80211/ieee80211_node.c#6 edit
.. //depot/projects/wifi/sys/net80211/ieee80211_node.h#5 edit
Differences ...
==== //depot/projects/wifi/sys/net80211/ieee80211_node.c#6 (text+ko) ====
@@ -1231,3 +1231,43 @@
if (ic->ic_updateslot != NULL)
ic->ic_updateslot(ic->ic_ifp);
}
+
+u_int8_t
+ieee80211_getrssi(struct ieee80211com *ic)
+{
+#define NZ(x) ((x) == 0 ? 1 : (x))
+ u_int8_t rssi;
+
+ switch (ic->ic_opmode) {
+ case IEEE80211_M_IBSS:
+ case IEEE80211_M_AHDEMO:
+ case IEEE80211_M_HOSTAP: {
+ u_int32_t rssi_samples, rssi_total;
+ struct ieee80211_node *ni;
+
+ /* average stats from all neighbors */
+ rssi_samples = 0;
+ rssi_total = 0;
+ /* XXX locking */
+ TAILQ_FOREACH(ni, &ic->ic_node, ni_list)
+ if (ic->ic_opmode != IEEE80211_M_HOSTAP ||
+ IEEE80211_AID(ni->ni_associd) != 0) {
+ rssi_samples++;
+ rssi_total += ic->ic_node_getrssi(ic, ni);
+ }
+ rssi = rssi_total / NZ(rssi_samples);
+ break;
+ }
+ case IEEE80211_M_STA:
+ case IEEE80211_M_MONITOR:
+ default:
+ /* use stats from associated ap */
+ if (ic->ic_bss != NULL)
+ rssi = ic->ic_node_getrssi(ic, ic->ic_bss);
+ else
+ rssi = 0;
+ break;
+ }
+ return rssi;
+#undef NZ
+}
==== //depot/projects/wifi/sys/net80211/ieee80211_node.h#5 (text+ko) ====
@@ -236,4 +236,5 @@
extern void ieee80211_node_leave(struct ieee80211com *,
struct ieee80211_node *);
extern void ieee80211_set_shortslottime(struct ieee80211com *, int onoff);
+extern u_int8_t ieee80211_getrssi(struct ieee80211com *ic);
#endif /* _NET80211_IEEE80211_NODE_H_ */
More information about the p4-projects
mailing list