af712341215d80e0322095ef856aeafc615e13ad
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 524-mac80211_survey_channel_stats.patch
1 --- a/include/linux/nl80211.h
2 +++ b/include/linux/nl80211.h
3 @@ -1413,6 +1413,16 @@ enum nl80211_reg_rule_flags {
4 * @NL80211_SURVEY_INFO_FREQUENCY: center frequency of channel
5 * @NL80211_SURVEY_INFO_NOISE: noise level of channel (u8, dBm)
6 * @NL80211_SURVEY_INFO_IN_USE: channel is currently being used
7 + * @NL80211_SURVEY_INFO_CHANNEL_TIME: amount of time (in ms) that the radio
8 + * spent on this channel
9 + * @NL80211_SURVEY_INFO_CHANNEL_TIME_BUSY: amount of the time the primary
10 + * channel was sensed busy (either due to activity or energy detect)
11 + * @NL80211_SURVEY_INFO_CHANNEL_TIME_EXT_BUSY: amount of time the extension
12 + * channel was sensed busy
13 + * @NL80211_SURVEY_INFO_CHANNEL_TIME_RX: amount of time the radio spent
14 + * receiving data
15 + * @NL80211_SURVEY_INFO_CHANNEL_TIME_TX: amount of time the radio spent
16 + * transmitting data
17 * @NL80211_SURVEY_INFO_MAX: highest survey info attribute number
18 * currently defined
19 * @__NL80211_SURVEY_INFO_AFTER_LAST: internal use
20 @@ -1422,6 +1432,11 @@ enum nl80211_survey_info {
21 NL80211_SURVEY_INFO_FREQUENCY,
22 NL80211_SURVEY_INFO_NOISE,
23 NL80211_SURVEY_INFO_IN_USE,
24 + NL80211_SURVEY_INFO_CHANNEL_TIME,
25 + NL80211_SURVEY_INFO_CHANNEL_TIME_BUSY,
26 + NL80211_SURVEY_INFO_CHANNEL_TIME_EXT_BUSY,
27 + NL80211_SURVEY_INFO_CHANNEL_TIME_RX,
28 + NL80211_SURVEY_INFO_CHANNEL_TIME_TX,
29
30 /* keep last */
31 __NL80211_SURVEY_INFO_AFTER_LAST,
32 --- a/include/net/cfg80211.h
33 +++ b/include/net/cfg80211.h
34 @@ -295,6 +295,11 @@ struct key_params {
35 *
36 * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in
37 * @SURVEY_INFO_IN_USE: channel is currently being used
38 + * @SURVEY_INFO_CHANNEL_TIME: channel active time (in ms) was filled in
39 + * @SURVEY_INFO_CHANNEL_TIME_BUSY: channel busy time was filled in
40 + * @SURVEY_INFO_CHANNEL_TIME_EXT_BUSY: extension channel busy time was filled in
41 + * @SURVEY_INFO_CHANNEL_TIME_RX: channel receive time was filled in
42 + * @SURVEY_INFO_CHANNEL_TIME_TX: channel transmit time was filled in
43 *
44 * Used by the driver to indicate which info in &struct survey_info
45 * it has filled in during the get_survey().
46 @@ -302,6 +307,11 @@ struct key_params {
47 enum survey_info_flags {
48 SURVEY_INFO_NOISE_DBM = 1<<0,
49 SURVEY_INFO_IN_USE = 1<<1,
50 + SURVEY_INFO_CHANNEL_TIME = 1<<2,
51 + SURVEY_INFO_CHANNEL_TIME_BUSY = 1<<3,
52 + SURVEY_INFO_CHANNEL_TIME_EXT_BUSY = 1<<4,
53 + SURVEY_INFO_CHANNEL_TIME_RX = 1<<5,
54 + SURVEY_INFO_CHANNEL_TIME_TX = 1<<6,
55 };
56
57 /**
58 @@ -311,6 +321,11 @@ enum survey_info_flags {
59 * @filled: bitflag of flags from &enum survey_info_flags
60 * @noise: channel noise in dBm. This and all following fields are
61 * optional
62 + * @channel_time: amount of time in ms the radio spent on the channel
63 + * @channel_time_busy: amount of time the primary channel was sensed busy
64 + * @channel_time_ext_busy: amount of time the extension channel was sensed busy
65 + * @channel_time_rx: amount of time the radio spent receiving data
66 + * @channel_time_tx: amount of time the radio spent transmitting data
67 *
68 * Used by dump_survey() to report back per-channel survey information.
69 *
70 @@ -319,6 +334,11 @@ enum survey_info_flags {
71 */
72 struct survey_info {
73 struct ieee80211_channel *channel;
74 + u64 channel_time;
75 + u64 channel_time_busy;
76 + u64 channel_time_ext_busy;
77 + u64 channel_time_rx;
78 + u64 channel_time_tx;
79 u32 filled;
80 s8 noise;
81 };
82 --- a/net/wireless/nl80211.c
83 +++ b/net/wireless/nl80211.c
84 @@ -3153,6 +3153,21 @@ static int nl80211_send_survey(struct sk
85 survey->noise);
86 if (survey->filled & SURVEY_INFO_IN_USE)
87 NLA_PUT_FLAG(msg, NL80211_SURVEY_INFO_IN_USE);
88 + if (survey->filled & SURVEY_INFO_CHANNEL_TIME)
89 + NLA_PUT_U64(msg, NL80211_SURVEY_INFO_CHANNEL_TIME,
90 + survey->channel_time);
91 + if (survey->filled & SURVEY_INFO_CHANNEL_TIME_BUSY)
92 + NLA_PUT_U64(msg, NL80211_SURVEY_INFO_CHANNEL_TIME_BUSY,
93 + survey->channel_time_busy);
94 + if (survey->filled & SURVEY_INFO_CHANNEL_TIME_EXT_BUSY)
95 + NLA_PUT_U64(msg, NL80211_SURVEY_INFO_CHANNEL_TIME_EXT_BUSY,
96 + survey->channel_time_ext_busy);
97 + if (survey->filled & SURVEY_INFO_CHANNEL_TIME_RX)
98 + NLA_PUT_U64(msg, NL80211_SURVEY_INFO_CHANNEL_TIME_RX,
99 + survey->channel_time_rx);
100 + if (survey->filled & SURVEY_INFO_CHANNEL_TIME_TX)
101 + NLA_PUT_U64(msg, NL80211_SURVEY_INFO_CHANNEL_TIME_TX,
102 + survey->channel_time_tx);
103
104 nla_nest_end(msg, infoattr);
105