Fix build on non-SMP machines of the remote GDB debugging (#2666)
[openwrt.git] / package / mac80211 / patches / 025-mac80211-get-sta.patch
1 Subject: mac80211: implement station stats retrieval
2
3 This implements the required cfg80211 callback in mac80211
4 to allow userspace to get station statistics.
5
6 Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
7
8 ---
9 net/mac80211/cfg.c | 26 ++++++++++++++++++++++++++
10 1 file changed, 26 insertions(+)
11
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
15 return 0;
16 }
17
18 +static int ieee80211_get_station(struct wiphy *wiphy, struct net_device *dev,
19 + u8 *mac, struct station_stats *stats)
20 +{
21 + struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
22 + struct sta_info *sta;
23 +
24 + sta = sta_info_get(local, mac);
25 + if (!sta)
26 + return -ENOENT;
27 +
28 + /* XXX: verify sta->dev == dev */
29 +
30 + stats->filled = STATION_STAT_INACTIVE_TIME |
31 + STATION_STAT_RX_BYTES |
32 + STATION_STAT_TX_BYTES;
33 +
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;
37 +
38 + sta_info_put(sta);
39 +
40 + return 0;
41 +}
42 +
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,
51 };
This page took 0.057451 seconds and 5 git commands to generate.