diff options
author | adrian <adrian@FreeBSD.org> | 2012-07-20 01:36:46 +0000 |
---|---|---|
committer | adrian <adrian@FreeBSD.org> | 2012-07-20 01:36:46 +0000 |
commit | ff4507cc5ce9a70c8dbb2f9db25e479dced77a03 (patch) | |
tree | c49c47f3387735721d9738929468d7430ee67c47 /sys/dev/ath/if_ath.c | |
parent | 233485e7d23a92c37660a093e331259a4b9c86ef (diff) | |
download | FreeBSD-src-ff4507cc5ce9a70c8dbb2f9db25e479dced77a03.zip FreeBSD-src-ff4507cc5ce9a70c8dbb2f9db25e479dced77a03.tar.gz |
Enable the basic node-based rate control statistics via an ioctl().
Diffstat (limited to 'sys/dev/ath/if_ath.c')
-rw-r--r-- | sys/dev/ath/if_ath.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c index ff2b9c9..5db4d0e 100644 --- a/sys/dev/ath/if_ath.c +++ b/sys/dev/ath/if_ath.c @@ -4925,6 +4925,43 @@ ath_watchdog(void *arg) callout_schedule(&sc->sc_wd_ch, hz); } +/* + * Fetch the rate control statistics for the given node. + */ +static int +ath_ioctl_ratestats(struct ath_softc *sc, struct ath_rateioctl *rs) +{ + struct ath_node *an; + struct ieee80211com *ic = sc->sc_ifp->if_l2com; + struct ieee80211_node *ni; + int error = 0; + + /* Perform a lookup on the given node */ + ni = ieee80211_find_node(&ic->ic_sta, rs->is_u.macaddr); + if (ni == NULL) { + error = EINVAL; + goto bad; + } + + /* Lock the ath_node */ + an = ATH_NODE(ni); + ATH_NODE_LOCK(an); + + /* Fetch the rate control stats for this node */ + error = ath_rate_fetch_node_stats(sc, an, rs); + + /* No matter what happens here, just drop through */ + + /* Unlock the ath_node */ + ATH_NODE_UNLOCK(an); + + /* Unref the node */ + ieee80211_node_decref(ni); + +bad: + return (error); +} + #ifdef ATH_DIAGAPI /* * Diagnostic interface to the HAL. This is used by various @@ -5073,6 +5110,9 @@ ath_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = ath_ioctl_phyerr(sc,(struct ath_diag*) ifr); break; #endif + case SIOCGATHNODERATESTATS: + error = ath_ioctl_ratestats(sc, (struct ath_rateioctl *) ifr); + break; case SIOCGIFADDR: error = ether_ioctl(ifp, cmd, data); break; |