Skip to content

Commit c8cd6e7

Browse files
nbd168jmberg-intel
authored andcommitted
cfg80211: add local BSS receive time to survey information
This is useful for checking how much airtime is being used up by other transmissions on the channel, e.g. by calculating (time_rx - time_bss_rx) or (time_busy - time_bss_rx - time_tx) Signed-off-by: Felix Fietkau <nbd@nbd.name> Link: https://lore.kernel.org/r/20190828102042.58016-1-nbd@nbd.name Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 7010998 commit c8cd6e7

3 files changed

Lines changed: 11 additions & 0 deletions

File tree

‎include/net/cfg80211.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -768,6 +768,7 @@ ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef)
768768
* @SURVEY_INFO_TIME_RX: receive time was filled in
769769
* @SURVEY_INFO_TIME_TX: transmit time was filled in
770770
* @SURVEY_INFO_TIME_SCAN: scan time was filled in
771+
* @SURVEY_INFO_TIME_BSS_RX: local BSS receive time was filled in
771772
*
772773
* Used by the driver to indicate which info in &struct survey_info
773774
* it has filled in during the get_survey().
@@ -781,6 +782,7 @@ enum survey_info_flags {
781782
SURVEY_INFO_TIME_RX = BIT(5),
782783
SURVEY_INFO_TIME_TX = BIT(6),
783784
SURVEY_INFO_TIME_SCAN = BIT(7),
785+
SURVEY_INFO_TIME_BSS_RX = BIT(8),
784786
};
785787

786788
/**
@@ -797,6 +799,7 @@ enum survey_info_flags {
797799
* @time_rx: amount of time the radio spent receiving data
798800
* @time_tx: amount of time the radio spent transmitting data
799801
* @time_scan: amount of time the radio spent for scanning
802+
* @time_bss_rx: amount of time the radio spent receiving data on a local BSS
800803
*
801804
* Used by dump_survey() to report back per-channel survey information.
802805
*
@@ -811,6 +814,7 @@ struct survey_info {
811814
u64 time_rx;
812815
u64 time_tx;
813816
u64 time_scan;
817+
u64 time_bss_rx;
814818
u32 filled;
815819
s8 noise;
816820
};

‎include/uapi/linux/nl80211.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3870,6 +3870,8 @@ enum nl80211_user_reg_hint_type {
38703870
* @NL80211_SURVEY_INFO_TIME_SCAN: time the radio spent for scan
38713871
* (on this channel or globally)
38723872
* @NL80211_SURVEY_INFO_PAD: attribute used for padding for 64-bit alignment
3873+
* @NL80211_SURVEY_INFO_TIME_BSS_RX: amount of time the radio spent
3874+
* receiving frames destined to the local BSS
38733875
* @NL80211_SURVEY_INFO_MAX: highest survey info attribute number
38743876
* currently defined
38753877
* @__NL80211_SURVEY_INFO_AFTER_LAST: internal use
@@ -3886,6 +3888,7 @@ enum nl80211_survey_info {
38863888
NL80211_SURVEY_INFO_TIME_TX,
38873889
NL80211_SURVEY_INFO_TIME_SCAN,
38883890
NL80211_SURVEY_INFO_PAD,
3891+
NL80211_SURVEY_INFO_TIME_BSS_RX,
38893892

38903893
/* keep last */
38913894
__NL80211_SURVEY_INFO_AFTER_LAST,

‎net/wireless/nl80211.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8806,6 +8806,10 @@ static int nl80211_send_survey(struct sk_buff *msg, u32 portid, u32 seq,
88068806
nla_put_u64_64bit(msg, NL80211_SURVEY_INFO_TIME_SCAN,
88078807
survey->time_scan, NL80211_SURVEY_INFO_PAD))
88088808
goto nla_put_failure;
8809+
if ((survey->filled & SURVEY_INFO_TIME_BSS_RX) &&
8810+
nla_put_u64_64bit(msg, NL80211_SURVEY_INFO_TIME_BSS_RX,
8811+
survey->time_bss_rx, NL80211_SURVEY_INFO_PAD))
8812+
goto nla_put_failure;
88098813

88108814
nla_nest_end(msg, infoattr);
88118815

0 commit comments

Comments
 (0)