]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
mac80211: implement station stats retrieval
authorJohannes Berg <johannes@sipsolutions.net>
Wed, 19 Dec 2007 01:03:37 +0000 (02:03 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jan 2008 22:59:53 +0000 (14:59 -0800)
This implements the required cfg80211 callback in mac80211
to allow userspace to get station statistics.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/mac80211/cfg.c

index 4c1ce353c6626e4d83e9c9c43f4bc051e014f6d2..11156b381ec3a6436c35e04ffa1f1b5dbabb0c70 100644 (file)
@@ -269,6 +269,31 @@ static int ieee80211_config_default_key(struct wiphy *wiphy,
        return 0;
 }
 
+static int ieee80211_get_station(struct wiphy *wiphy, struct net_device *dev,
+                                u8 *mac, struct station_stats *stats)
+{
+       struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
+       struct sta_info *sta;
+
+       sta = sta_info_get(local, mac);
+       if (!sta)
+               return -ENOENT;
+
+       /* XXX: verify sta->dev == dev */
+
+       stats->filled = STATION_STAT_INACTIVE_TIME |
+                       STATION_STAT_RX_BYTES |
+                       STATION_STAT_TX_BYTES;
+
+       stats->inactive_time = jiffies_to_msecs(jiffies - sta->last_rx);
+       stats->rx_bytes = sta->rx_bytes;
+       stats->tx_bytes = sta->tx_bytes;
+
+       sta_info_put(sta);
+
+       return 0;
+}
+
 struct cfg80211_ops mac80211_config_ops = {
        .add_virtual_intf = ieee80211_add_iface,
        .del_virtual_intf = ieee80211_del_iface,
@@ -277,4 +302,5 @@ struct cfg80211_ops mac80211_config_ops = {
        .del_key = ieee80211_del_key,
        .get_key = ieee80211_get_key,
        .set_default_key = ieee80211_config_default_key,
+       .get_station = ieee80211_get_station,
 };