summaryrefslogtreecommitdiffstats
path: root/sys/net80211/ieee80211_input.c
diff options
context:
space:
mode:
authoradrian <adrian@FreeBSD.org>2011-04-08 09:20:45 +0000
committeradrian <adrian@FreeBSD.org>2011-04-08 09:20:45 +0000
commit04a664ee1baf82bf5944c99c19b983121b136b2b (patch)
treef9e05b144f48a3d203c359da6d5d69c1a7c22daa /sys/net80211/ieee80211_input.c
parent416bdcba5e6296557c941806cd8ce943d47a90ff (diff)
downloadFreeBSD-src-04a664ee1baf82bf5944c99c19b983121b136b2b.zip
FreeBSD-src-04a664ee1baf82bf5944c99c19b983121b136b2b.tar.gz
Add initial support for MIMO statistics to net80211.
This introduces struct ieee80211_rx_stats - which stores the various kinds of RX statistics which a MIMO and non-MIMO 802.11 device can export. It also fleshes out the mimo export to userland (node_getmimoinfo()). It assumes that MIMO radios (for now) export both ctl and ext channels. Non-11n MIMO radios are possible (and I believe Atheros made at least one), so if that chipset support is added, extra flags to the struct ieee80211_rx_stats can be added to extend this support. Two new input functions have been added - ieee80211_input_mimo() and ieee80211_input_mimo_all() - which MIMO-aware devices can call with MIMO specific statistics. 802.11 devices calling the non-MIMO input functions will still function.
Diffstat (limited to 'sys/net80211/ieee80211_input.c')
-rw-r--r--sys/net80211/ieee80211_input.c47
1 files changed, 46 insertions, 1 deletions
diff --git a/sys/net80211/ieee80211_input.c b/sys/net80211/ieee80211_input.c
index c372370..a18da4a 100644
--- a/sys/net80211/ieee80211_input.c
+++ b/sys/net80211/ieee80211_input.c
@@ -57,9 +57,54 @@ __FBSDID("$FreeBSD$");
#include <net/ethernet.h>
#endif
+static void
+ieee80211_process_mimo(struct ieee80211_node *ni, struct ieee80211_rx_stats *rx)
+{
+ int i;
+
+ /* Verify the required MIMO bits are set */
+ if ((rx->r_flags & (IEEE80211_R_C_CHAIN | IEEE80211_R_C_NF | IEEE80211_R_C_RSSI)) !=
+ (IEEE80211_R_C_CHAIN | IEEE80211_R_C_NF | IEEE80211_R_C_RSSI))
+ return;
+
+ /* XXX This assumes the MIMO radios have both ctl and ext chains */
+ for (i = 0; i < MIN(rx->c_chain, IEEE80211_MAX_CHAINS); i++) {
+ IEEE80211_RSSI_LPF(ni->ni_mimo_rssi_ctl[i], rx->c_rssi_ctl[i]);
+ IEEE80211_RSSI_LPF(ni->ni_mimo_rssi_ext[i], rx->c_rssi_ext[i]);
+ }
+
+ /* XXX This also assumes the MIMO radios have both ctl and ext chains */
+ for(i = 0; i < MIN(rx->c_chain, IEEE80211_MAX_CHAINS); i++) {
+ ni->ni_mimo_noise_ctl[i] = rx->c_nf_ctl[i];
+ ni->ni_mimo_noise_ext[i] = rx->c_nf_ext[i];
+ }
+ ni->ni_mimo_chains = rx->c_chain;
+}
+
+int
+ieee80211_input_mimo(struct ieee80211_node *ni, struct mbuf *m,
+ struct ieee80211_rx_stats *rx)
+{
+ /* XXX should assert IEEE80211_R_NF and IEEE80211_R_RSSI are set */
+ ieee80211_process_mimo(ni, rx);
+ return ieee80211_input(ni, m, rx->rssi, rx->nf);
+}
+
int
ieee80211_input_all(struct ieee80211com *ic, struct mbuf *m, int rssi, int nf)
{
+ struct ieee80211_rx_stats rx;
+
+ rx.r_flags = IEEE80211_R_NF | IEEE80211_R_RSSI;
+ rx.nf = nf;
+ rx.rssi = rssi;
+ return ieee80211_input_mimo_all(ic, m, &rx);
+}
+
+int
+ieee80211_input_mimo_all(struct ieee80211com *ic, struct mbuf *m,
+ struct ieee80211_rx_stats *rx)
+{
struct ieee80211vap *vap;
int type = -1;
@@ -96,7 +141,7 @@ ieee80211_input_all(struct ieee80211com *ic, struct mbuf *m, int rssi, int nf)
m = NULL;
}
ni = ieee80211_ref_node(vap->iv_bss);
- type = ieee80211_input(ni, mcopy, rssi, nf);
+ type = ieee80211_input_mimo(ni, mcopy, rx);
ieee80211_free_node(ni);
}
if (m != NULL) /* no vaps, reclaim mbuf */
OpenPOWER on IntegriCloud