1 Subject: mac80211: implement station stats retrieval
3 This implements the required cfg80211 callback in mac80211
4 to allow userspace to get station statistics.
6 Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
9 net/mac80211/cfg.c | 26 ++++++++++++++++++++++++++
10 1 file changed, 26 insertions(+)
12 --- everything.orig/net/mac80211/cfg.c 2007-11-08 17:15:51.801523493 +0100
13 +++ everything/net/mac80211/cfg.c 2007-11-08 17:17:01.921529351 +0100
14 @@ -617,6 +617,31 @@ static int ieee80211_change_station(stru
18 +static int ieee80211_get_station(struct wiphy *wiphy, struct net_device *dev,
19 + u8 *mac, struct station_stats *stats)
21 + struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
22 + struct sta_info *sta;
24 + sta = sta_info_get(local, mac);
28 + /* XXX: verify sta->dev == dev */
30 + stats->filled = STATION_STAT_INACTIVE_TIME |
31 + STATION_STAT_RX_BYTES |
32 + STATION_STAT_TX_BYTES;
34 + stats->inactive_time = jiffies_to_msecs(jiffies - sta->last_rx);
35 + stats->rx_bytes = sta->rx_bytes;
36 + stats->tx_bytes = sta->tx_bytes;
43 struct cfg80211_ops mac80211_config_ops = {
44 .add_virtual_intf = ieee80211_add_iface,
45 .del_virtual_intf = ieee80211_del_iface,
46 @@ -631,4 +656,5 @@ struct cfg80211_ops mac80211_config_ops
47 .add_station = ieee80211_add_station,
48 .del_station = ieee80211_del_station,
49 .change_station = ieee80211_change_station,
50 + .get_station = ieee80211_get_station,