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.
This commit is contained in:
Sam Leffler 2003-09-15 22:28:07 +00:00
parent c87cfaedf2
commit d1e61976a0
3 changed files with 17 additions and 4 deletions

View File

@ -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,

View File

@ -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)

View File

@ -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 */