Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cfg80211: Scan results to also report the per chain signal strength

This commit enhances the scan results to report the per chain signal
strength based on the latest BSS update. This provides similar
information to what is already available through STA information.

Signed-off-by: Sunil Dutt <usdutt@qti.qualcomm.com>
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

authored by

Sunil Dutt and committed by
Johannes Berg
983dafaa 86b6c465

+22
+8
include/net/cfg80211.h
··· 1773 1773 * by %parent_bssid. 1774 1774 * @parent_bssid: the BSS according to which %parent_tsf is set. This is set to 1775 1775 * the BSS that requested the scan in which the beacon/probe was received. 1776 + * @chains: bitmask for filled values in @chain_signal. 1777 + * @chain_signal: per-chain signal strength of last received BSS in dBm. 1776 1778 */ 1777 1779 struct cfg80211_inform_bss { 1778 1780 struct ieee80211_channel *chan; ··· 1783 1781 u64 boottime_ns; 1784 1782 u64 parent_tsf; 1785 1783 u8 parent_bssid[ETH_ALEN] __aligned(2); 1784 + u8 chains; 1785 + s8 chain_signal[IEEE80211_MAX_CHAINS]; 1786 1786 }; 1787 1787 1788 1788 /** ··· 1828 1824 * that holds the beacon data. @beacon_ies is still valid, of course, and 1829 1825 * points to the same data as hidden_beacon_bss->beacon_ies in that case. 1830 1826 * @signal: signal strength value (type depends on the wiphy's signal_type) 1827 + * @chains: bitmask for filled values in @chain_signal. 1828 + * @chain_signal: per-chain signal strength of last received BSS in dBm. 1831 1829 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes 1832 1830 */ 1833 1831 struct cfg80211_bss { ··· 1848 1842 u16 capability; 1849 1843 1850 1844 u8 bssid[ETH_ALEN]; 1845 + u8 chains; 1846 + s8 chain_signal[IEEE80211_MAX_CHAINS]; 1851 1847 1852 1848 u8 priv[0] __aligned(sizeof(void *)); 1853 1849 };
+4
include/uapi/linux/nl80211.h
··· 3862 3862 * @NL80211_BSS_PARENT_BSSID. (u64). 3863 3863 * @NL80211_BSS_PARENT_BSSID: the BSS according to which @NL80211_BSS_PARENT_TSF 3864 3864 * is set. 3865 + * @NL80211_BSS_CHAIN_SIGNAL: per-chain signal strength of last BSS update. 3866 + * Contains a nested array of signal strength attributes (u8, dBm), 3867 + * using the nesting index as the antenna number. 3865 3868 * @__NL80211_BSS_AFTER_LAST: internal 3866 3869 * @NL80211_BSS_MAX: highest BSS attribute 3867 3870 */ ··· 3888 3885 NL80211_BSS_PAD, 3889 3886 NL80211_BSS_PARENT_TSF, 3890 3887 NL80211_BSS_PARENT_BSSID, 3888 + NL80211_BSS_CHAIN_SIGNAL, 3891 3889 3892 3890 /* keep last */ 3893 3891 __NL80211_BSS_AFTER_LAST,
+5
net/wireless/nl80211.c
··· 7839 7839 intbss->ts_boottime, NL80211_BSS_PAD)) 7840 7840 goto nla_put_failure; 7841 7841 7842 + if (!nl80211_put_signal(msg, intbss->pub.chains, 7843 + intbss->pub.chain_signal, 7844 + NL80211_BSS_CHAIN_SIGNAL)) 7845 + goto nla_put_failure; 7846 + 7842 7847 switch (rdev->wiphy.signal_type) { 7843 7848 case CFG80211_SIGNAL_TYPE_MBM: 7844 7849 if (nla_put_u32(msg, NL80211_BSS_SIGNAL_MBM, res->signal))
+5
net/wireless/scan.c
··· 981 981 found->ts = tmp->ts; 982 982 found->ts_boottime = tmp->ts_boottime; 983 983 found->parent_tsf = tmp->parent_tsf; 984 + found->pub.chains = tmp->pub.chains; 985 + memcpy(found->pub.chain_signal, tmp->pub.chain_signal, 986 + IEEE80211_MAX_CHAINS); 984 987 ether_addr_copy(found->parent_bssid, tmp->parent_bssid); 985 988 } else { 986 989 struct cfg80211_internal_bss *new; ··· 1236 1233 tmp.pub.capability = le16_to_cpu(mgmt->u.probe_resp.capab_info); 1237 1234 tmp.ts_boottime = data->boottime_ns; 1238 1235 tmp.parent_tsf = data->parent_tsf; 1236 + tmp.pub.chains = data->chains; 1237 + memcpy(tmp.pub.chain_signal, data->chain_signal, IEEE80211_MAX_CHAINS); 1239 1238 ether_addr_copy(tmp.parent_bssid, data->parent_bssid); 1240 1239 1241 1240 signal_valid = abs(data->chan->center_freq - channel->center_freq) <=