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.
Unified · Split
| @@ -1773,6 +1773,8 @@ enum cfg80211_signal_type { · 1772 unmodified lines | |||
| 1773 | * by %parent_bssid. | 1773 | * by %parent_bssid. |
| 1774 | * @parent_bssid: the BSS according to which %parent_tsf is set. This is set to | 1774 | * @parent_bssid: the BSS according to which %parent_tsf is set. This is set to |
| 1775 | * the BSS that requested the scan in which the beacon/probe was received. | 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 | struct cfg80211_inform_bss { | 1779 | struct cfg80211_inform_bss { |
| 1778 | struct ieee80211_channel *chan; | 1780 | struct ieee80211_channel *chan; |
| @@ -1781,6 +1783,8 @@ struct cfg80211_inform_bss { · 2 unmodified lines | |||
| 1781 | u64 boottime_ns; | 1783 | u64 boottime_ns; |
| 1782 | u64 parent_tsf; | 1784 | u64 parent_tsf; |
| 1783 | u8 parent_bssid[ETH_ALEN] __aligned(2); | 1785 | u8 parent_bssid[ETH_ALEN] __aligned(2); |
| 1786 | u8 chains; | ||
| 1787 | s8 chain_signal[IEEE80211_MAX_CHAINS]; | ||
| 1784 | }; | 1788 | }; |
| 1785 | 1789 | ||
| 1786 | /** | 1790 | /** |
| @@ -1824,6 +1828,8 @@ struct cfg80211_bss_ies { · 37 unmodified lines | |||
| 1824 | * that holds the beacon data. @beacon_ies is still valid, of course, and | 1828 | * that holds the beacon data. @beacon_ies is still valid, of course, and |
| 1825 | * points to the same data as hidden_beacon_bss->beacon_ies in that case. | 1829 | * points to the same data as hidden_beacon_bss->beacon_ies in that case. |
| 1826 | * @signal: signal strength value (type depends on the wiphy's signal_type) | 1830 | * @signal: signal strength value (type depends on the wiphy's signal_type) |
| 1831 | * @chains: bitmask for filled values in @chain_signal. | ||
| 1832 | * @chain_signal: per-chain signal strength of last received BSS in dBm. | ||
| 1827 | * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes | 1833 | * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes |
| 1828 | */ | 1834 | */ |
| 1829 | struct cfg80211_bss { | 1835 | struct cfg80211_bss { |
| @@ -1842,6 +1848,8 @@ struct cfg80211_bss { · 12 unmodified lines | |||
| 1842 | u16 capability; | 1848 | u16 capability; |
| 1843 | 1849 | ||
| 1844 | u8 bssid[ETH_ALEN]; | 1850 | u8 bssid[ETH_ALEN]; |
| 1851 | u8 chains; | ||
| 1852 | s8 chain_signal[IEEE80211_MAX_CHAINS]; | ||
| 1845 | 1853 | ||
| 1846 | u8 priv[0] __aligned(sizeof(void *)); | 1854 | u8 priv[0] __aligned(sizeof(void *)); |
| 1847 | }; | 1855 | }; |
| @@ -3862,6 +3862,9 @@ enum nl80211_bss_scan_width { · 3861 unmodified lines | |||
| 3862 | * @NL80211_BSS_PARENT_BSSID. (u64). | 3862 | * @NL80211_BSS_PARENT_BSSID. (u64). |
| 3863 | * @NL80211_BSS_PARENT_BSSID: the BSS according to which @NL80211_BSS_PARENT_TSF | 3863 | * @NL80211_BSS_PARENT_BSSID: the BSS according to which @NL80211_BSS_PARENT_TSF |
| 3864 | * is set. | 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 | * @__NL80211_BSS_AFTER_LAST: internal | 3868 | * @__NL80211_BSS_AFTER_LAST: internal |
| 3866 | * @NL80211_BSS_MAX: highest BSS attribute | 3869 | * @NL80211_BSS_MAX: highest BSS attribute |
| 3867 | */ | 3870 | */ |
| @@ -3885,6 +3888,7 @@ enum nl80211_bss { · 17 unmodified lines | |||
| 3885 | NL80211_BSS_PAD, | 3888 | NL80211_BSS_PAD, |
| 3886 | NL80211_BSS_PARENT_TSF, | 3889 | NL80211_BSS_PARENT_TSF, |
| 3887 | NL80211_BSS_PARENT_BSSID, | 3890 | NL80211_BSS_PARENT_BSSID, |
| 3891 | NL80211_BSS_CHAIN_SIGNAL, | ||
| 3888 | 3892 | ||
| 3889 | /* keep last */ | 3893 | /* keep last */ |
| 3890 | __NL80211_BSS_AFTER_LAST, | 3894 | __NL80211_BSS_AFTER_LAST, |
| @@ -7839,6 +7839,11 @@ static int nl80211_send_bss(struct sk_buff *msg, struct netlink_callback *cb, · 7838 unmodified lines | |||
| 7839 | intbss->ts_boottime, NL80211_BSS_PAD)) | 7839 | intbss->ts_boottime, NL80211_BSS_PAD)) |
| 7840 | goto nla_put_failure; | 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 | switch (rdev->wiphy.signal_type) { | 7847 | switch (rdev->wiphy.signal_type) { |
| 7843 | case CFG80211_SIGNAL_TYPE_MBM: | 7848 | case CFG80211_SIGNAL_TYPE_MBM: |
| 7844 | if (nla_put_u32(msg, NL80211_BSS_SIGNAL_MBM, res->signal)) | 7849 | if (nla_put_u32(msg, NL80211_BSS_SIGNAL_MBM, res->signal)) |
| @@ -981,6 +981,9 @@ cfg80211_bss_update(struct cfg80211_registered_device *rdev, · 980 unmodified lines | |||
| 981 | found->ts = tmp->ts; | 981 | found->ts = tmp->ts; |
| 982 | found->ts_boottime = tmp->ts_boottime; | 982 | found->ts_boottime = tmp->ts_boottime; |
| 983 | found->parent_tsf = tmp->parent_tsf; | 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 | ether_addr_copy(found->parent_bssid, tmp->parent_bssid); | 987 | ether_addr_copy(found->parent_bssid, tmp->parent_bssid); |
| 985 | } else { | 988 | } else { |
| 986 | struct cfg80211_internal_bss *new; | 989 | struct cfg80211_internal_bss *new; |
| @@ -1233,6 +1236,8 @@ cfg80211_inform_bss_frame_data(struct wiphy *wiphy, · 246 unmodified lines | |||
| 1233 | tmp.pub.capability = le16_to_cpu(mgmt->u.probe_resp.capab_info); | 1236 | tmp.pub.capability = le16_to_cpu(mgmt->u.probe_resp.capab_info); |
| 1234 | tmp.ts_boottime = data->boottime_ns; | 1237 | tmp.ts_boottime = data->boottime_ns; |
| 1235 | tmp.parent_tsf = data->parent_tsf; | 1238 | tmp.parent_tsf = data->parent_tsf; |
| 1239 | tmp.pub.chains = data->chains; | ||
| 1240 | memcpy(tmp.pub.chain_signal, data->chain_signal, IEEE80211_MAX_CHAINS); | ||
| 1236 | ether_addr_copy(tmp.parent_bssid, data->parent_bssid); | 1241 | ether_addr_copy(tmp.parent_bssid, data->parent_bssid); |
| 1237 | 1242 | ||
| 1238 | signal_valid = abs(data->chan->center_freq - channel->center_freq) <= | 1243 | signal_valid = abs(data->chan->center_freq - channel->center_freq) <= |