From 6a3739dc42c1d9626e5784d9316c56962bd8f016 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 28 Aug 2019 16:25:22 +0200 Subject: [PATCH] mac80211: add patch to include local BSS rx time in survey information Signed-off-by: Felix Fietkau --- ...al-BSS-receive-time-to-survey-inform.patch | 77 +++++++++++++++++++ .../500-mac80211_configure_antenna_gain.patch | 4 +- 2 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 package/kernel/mac80211/patches/subsys/350-cfg80211-add-local-BSS-receive-time-to-survey-inform.patch diff --git a/package/kernel/mac80211/patches/subsys/350-cfg80211-add-local-BSS-receive-time-to-survey-inform.patch b/package/kernel/mac80211/patches/subsys/350-cfg80211-add-local-BSS-receive-time-to-survey-inform.patch new file mode 100644 index 0000000000..af70b46fdc --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/350-cfg80211-add-local-BSS-receive-time-to-survey-inform.patch @@ -0,0 +1,77 @@ +From: Felix Fietkau +Date: Wed, 28 Aug 2019 12:13:55 +0200 +Subject: [PATCH] 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 +--- + +--- a/include/net/cfg80211.h ++++ b/include/net/cfg80211.h +@@ -682,6 +682,7 @@ ieee80211_chandef_max_power(struct cfg80 + * @SURVEY_INFO_TIME_RX: receive time was filled in + * @SURVEY_INFO_TIME_TX: transmit time was filled in + * @SURVEY_INFO_TIME_SCAN: scan time was filled in ++ * @SURVEY_INFO_TIME_BSS_RX: local BSS receive time was filled in + * + * Used by the driver to indicate which info in &struct survey_info + * it has filled in during the get_survey(). +@@ -695,6 +696,7 @@ enum survey_info_flags { + SURVEY_INFO_TIME_RX = BIT(5), + SURVEY_INFO_TIME_TX = BIT(6), + SURVEY_INFO_TIME_SCAN = BIT(7), ++ SURVEY_INFO_TIME_BSS_RX = BIT(8), + }; + + /** +@@ -711,6 +713,7 @@ enum survey_info_flags { + * @time_rx: amount of time the radio spent receiving data + * @time_tx: amount of time the radio spent transmitting data + * @time_scan: amount of time the radio spent for scanning ++ * @time_bss_rx: amount of time the radio spent receiving data on a local BSS + * + * Used by dump_survey() to report back per-channel survey information. + * +@@ -725,6 +728,7 @@ struct survey_info { + u64 time_rx; + u64 time_tx; + u64 time_scan; ++ u64 time_bss_rx; + u32 filled; + s8 noise; + }; +--- a/include/uapi/linux/nl80211.h ++++ b/include/uapi/linux/nl80211.h +@@ -3836,6 +3836,8 @@ enum nl80211_user_reg_hint_type { + * @NL80211_SURVEY_INFO_TIME_SCAN: time the radio spent for scan + * (on this channel or globally) + * @NL80211_SURVEY_INFO_PAD: attribute used for padding for 64-bit alignment ++ * @NL80211_SURVEY_INFO_TIME_BSS_RX: amount of time the radio spent ++ * receiving local BSS data + * @NL80211_SURVEY_INFO_MAX: highest survey info attribute number + * currently defined + * @__NL80211_SURVEY_INFO_AFTER_LAST: internal use +@@ -3852,6 +3854,7 @@ enum nl80211_survey_info { + NL80211_SURVEY_INFO_TIME_TX, + NL80211_SURVEY_INFO_TIME_SCAN, + NL80211_SURVEY_INFO_PAD, ++ NL80211_SURVEY_INFO_TIME_BSS_RX, + + /* keep last */ + __NL80211_SURVEY_INFO_AFTER_LAST, +--- a/net/wireless/nl80211.c ++++ b/net/wireless/nl80211.c +@@ -8694,6 +8694,10 @@ static int nl80211_send_survey(struct sk + nla_put_u64_64bit(msg, NL80211_SURVEY_INFO_TIME_SCAN, + survey->time_scan, NL80211_SURVEY_INFO_PAD)) + goto nla_put_failure; ++ if ((survey->filled & SURVEY_INFO_TIME_BSS_RX) && ++ nla_put_u64_64bit(msg, NL80211_SURVEY_INFO_TIME_BSS_RX, ++ survey->time_bss_rx, NL80211_SURVEY_INFO_PAD)) ++ goto nla_put_failure; + + nla_nest_end(msg, infoattr); + diff --git a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch index 3ca34b7ec3..a76953933f 100644 --- a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch +++ b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch @@ -1,6 +1,6 @@ --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h -@@ -3344,6 +3344,7 @@ struct cfg80211_update_owe_info { +@@ -3348,6 +3348,7 @@ struct cfg80211_update_owe_info { * (as advertised by the nl80211 feature flag.) * @get_tx_power: store the current TX power into the dbm variable; * return 0 if successful @@ -8,7 +8,7 @@ * * @set_wds_peer: set the WDS peer for a WDS interface * -@@ -3656,6 +3657,7 @@ struct cfg80211_ops { +@@ -3660,6 +3661,7 @@ struct cfg80211_ops { enum nl80211_tx_power_setting type, int mbm); int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, int *dbm); -- 2.25.1