diff options
author | sam <sam@FreeBSD.org> | 2003-09-15 22:28:07 +0000 |
---|---|---|
committer | sam <sam@FreeBSD.org> | 2003-09-15 22:28:07 +0000 |
commit | c9c933e78b7f78237d8012aa7fd7e0f113823c5a (patch) | |
tree | 0e47a901ca00cc77a28a919bce48d95fbd978a11 /sys | |
parent | 9ba7155cfe8dabb2beb540ffb24b3d14e17f357d (diff) | |
download | FreeBSD-src-c9c933e78b7f78237d8012aa7fd7e0f113823c5a.zip FreeBSD-src-c9c933e78b7f78237d8012aa7fd7e0f113823c5a.tar.gz |
Generalize the per-node RSSI data so drivers can do more interesting
things than record a single value.
o add a per-node method for returning the "current RSSI" for a node
o create a default method that returns ni_rssi which is the rssi for
the last received frame
o use the per-node "get rssi" method to return data for the RID's
submitted by wicontrol, et. al.
Loosely based on work by Tom Marshall <tommy@home.tig-grr.com> for MADWIFI.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net80211/ieee80211_ioctl.c | 9 | ||||
-rw-r--r-- | sys/net80211/ieee80211_node.c | 10 | ||||
-rw-r--r-- | sys/net80211/ieee80211_var.h | 2 |
3 files changed, 17 insertions, 4 deletions
diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c index 4ae0401..46b0a23 100644 --- a/sys/net80211/ieee80211_ioctl.c +++ b/sys/net80211/ieee80211_ioctl.c @@ -140,7 +140,8 @@ ieee80211_cfgget(struct ifnet *ifp, u_long cmd, caddr_t data) break; case WI_RID_COMMS_QUALITY: wreq.wi_val[0] = 0; /* quality */ - wreq.wi_val[1] = htole16(ic->ic_bss->ni_rssi); /* signal */ + wreq.wi_val[1] = + htole16((*ic->ic_node_getrssi)(ic, ic->ic_bss)); wreq.wi_val[2] = 0; /* noise */ wreq.wi_len = 3; break; @@ -278,7 +279,7 @@ ieee80211_cfgget(struct ifnet *ifp, u_long cmd, caddr_t data) ni->ni_esslen); } ap->channel = ieee80211_chan2ieee(ic, ni->ni_chan); - ap->signal = ni->ni_rssi; + ap->signal = (*ic->ic_node_getrssi)(ic, ni); ap->capinfo = ni->ni_capinfo; ap->interval = ni->ni_intval; rs = &ni->ni_rates; @@ -313,7 +314,7 @@ ieee80211_cfgget(struct ifnet *ifp, u_long cmd, caddr_t data) break; res->wi_chan = ieee80211_chan2ieee(ic, ni->ni_chan); res->wi_noise = 0; - res->wi_signal = ni->ni_rssi; + res->wi_signal = (*ic->ic_node_getrssi)(ic, ni); IEEE80211_ADDR_COPY(res->wi_bssid, ni->ni_bssid); res->wi_interval = ni->ni_intval; res->wi_capinfo = ni->ni_capinfo; @@ -339,7 +340,7 @@ ieee80211_cfgget(struct ifnet *ifp, u_long cmd, caddr_t data) break; IEEE80211_ADDR_COPY(wsc.macsrc, ni->ni_macaddr); memset(&wsc.ipsrc, 0, sizeof(wsc.ipsrc)); - wsc.signal = ni->ni_rssi; + wsc.signal = (*ic->ic_node_getrssi)(ic, ni); wsc.noise = 0; wsc.quality = 0; memcpy((caddr_t)wreq.wi_val + sizeof(wsc) * i, diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c index 5ea3466..fe0c9b1 100644 --- a/sys/net80211/ieee80211_node.c +++ b/sys/net80211/ieee80211_node.c @@ -70,6 +70,9 @@ static struct ieee80211_node *ieee80211_node_alloc(struct ieee80211com *); static void ieee80211_node_free(struct ieee80211com *, struct ieee80211_node *); static void ieee80211_node_copy(struct ieee80211com *, struct ieee80211_node *, const struct ieee80211_node *); +static u_int8_t ieee80211_node_getrssi(struct ieee80211com *, + struct ieee80211_node *); + static void ieee80211_setup_node(struct ieee80211com *ic, struct ieee80211_node *ni, u_int8_t *macaddr); static void _ieee80211_free_node(struct ieee80211com *, @@ -86,6 +89,7 @@ ieee80211_node_attach(struct ifnet *ifp) ic->ic_node_alloc = ieee80211_node_alloc; ic->ic_node_free = ieee80211_node_free; ic->ic_node_copy = ieee80211_node_copy; + ic->ic_node_getrssi = ieee80211_node_getrssi; } void @@ -406,6 +410,12 @@ ieee80211_node_copy(struct ieee80211com *ic, *dst = *src; } +static u_int8_t +ieee80211_node_getrssi(struct ieee80211com *ic, struct ieee80211_node *ni) +{ + return ni->ni_rssi; +} + static void ieee80211_setup_node(struct ieee80211com *ic, struct ieee80211_node *ni, u_int8_t *macaddr) diff --git a/sys/net80211/ieee80211_var.h b/sys/net80211/ieee80211_var.h index 187ab79..2546bb8 100644 --- a/sys/net80211/ieee80211_var.h +++ b/sys/net80211/ieee80211_var.h @@ -171,6 +171,8 @@ struct ieee80211com { void (*ic_node_copy)(struct ieee80211com *, struct ieee80211_node *, const struct ieee80211_node *); + u_int8_t (*ic_node_getrssi)(struct ieee80211com *, + struct ieee80211_node *); TAILQ_HEAD(, ieee80211_node) ic_node; /* information of all nodes */ LIST_HEAD(, ieee80211_node) ic_hash[IEEE80211_NODE_HASHSIZE]; u_int16_t ic_lintval; /* listen interval */ |