Commit 983dafaa authored by Sunil Dutt's avatar Sunil Dutt Committed by Johannes Berg

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: default avatarSunil Dutt <usdutt@qti.qualcomm.com>
Signed-off-by: default avatarJouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 86b6c465
...@@ -1773,6 +1773,8 @@ enum cfg80211_signal_type { ...@@ -1773,6 +1773,8 @@ enum cfg80211_signal_type {
* by %parent_bssid. * by %parent_bssid.
* @parent_bssid: the BSS according to which %parent_tsf is set. This is set to * @parent_bssid: the BSS according to which %parent_tsf is set. This is set to
* the BSS that requested the scan in which the beacon/probe was received. * the BSS that requested the scan in which the beacon/probe was received.
* @chains: bitmask for filled values in @chain_signal.
* @chain_signal: per-chain signal strength of last received BSS in dBm.
*/ */
struct cfg80211_inform_bss { struct cfg80211_inform_bss {
struct ieee80211_channel *chan; struct ieee80211_channel *chan;
...@@ -1781,6 +1783,8 @@ struct cfg80211_inform_bss { ...@@ -1781,6 +1783,8 @@ struct cfg80211_inform_bss {
u64 boottime_ns; u64 boottime_ns;
u64 parent_tsf; u64 parent_tsf;
u8 parent_bssid[ETH_ALEN] __aligned(2); u8 parent_bssid[ETH_ALEN] __aligned(2);
u8 chains;
s8 chain_signal[IEEE80211_MAX_CHAINS];
}; };
/** /**
...@@ -1824,6 +1828,8 @@ struct cfg80211_bss_ies { ...@@ -1824,6 +1828,8 @@ struct cfg80211_bss_ies {
* that holds the beacon data. @beacon_ies is still valid, of course, and * that holds the beacon data. @beacon_ies is still valid, of course, and
* points to the same data as hidden_beacon_bss->beacon_ies in that case. * points to the same data as hidden_beacon_bss->beacon_ies in that case.
* @signal: signal strength value (type depends on the wiphy's signal_type) * @signal: signal strength value (type depends on the wiphy's signal_type)
* @chains: bitmask for filled values in @chain_signal.
* @chain_signal: per-chain signal strength of last received BSS in dBm.
* @priv: private area for driver use, has at least wiphy->bss_priv_size bytes * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
*/ */
struct cfg80211_bss { struct cfg80211_bss {
...@@ -1842,6 +1848,8 @@ struct cfg80211_bss { ...@@ -1842,6 +1848,8 @@ struct cfg80211_bss {
u16 capability; u16 capability;
u8 bssid[ETH_ALEN]; u8 bssid[ETH_ALEN];
u8 chains;
s8 chain_signal[IEEE80211_MAX_CHAINS];
u8 priv[0] __aligned(sizeof(void *)); u8 priv[0] __aligned(sizeof(void *));
}; };
......
...@@ -3862,6 +3862,9 @@ enum nl80211_bss_scan_width { ...@@ -3862,6 +3862,9 @@ enum nl80211_bss_scan_width {
* @NL80211_BSS_PARENT_BSSID. (u64). * @NL80211_BSS_PARENT_BSSID. (u64).
* @NL80211_BSS_PARENT_BSSID: the BSS according to which @NL80211_BSS_PARENT_TSF * @NL80211_BSS_PARENT_BSSID: the BSS according to which @NL80211_BSS_PARENT_TSF
* is set. * is set.
* @NL80211_BSS_CHAIN_SIGNAL: per-chain signal strength of last BSS update.
* Contains a nested array of signal strength attributes (u8, dBm),
* using the nesting index as the antenna number.
* @__NL80211_BSS_AFTER_LAST: internal * @__NL80211_BSS_AFTER_LAST: internal
* @NL80211_BSS_MAX: highest BSS attribute * @NL80211_BSS_MAX: highest BSS attribute
*/ */
...@@ -3885,6 +3888,7 @@ enum nl80211_bss { ...@@ -3885,6 +3888,7 @@ enum nl80211_bss {
NL80211_BSS_PAD, NL80211_BSS_PAD,
NL80211_BSS_PARENT_TSF, NL80211_BSS_PARENT_TSF,
NL80211_BSS_PARENT_BSSID, NL80211_BSS_PARENT_BSSID,
NL80211_BSS_CHAIN_SIGNAL,
/* keep last */ /* keep last */
__NL80211_BSS_AFTER_LAST, __NL80211_BSS_AFTER_LAST,
......
...@@ -7839,6 +7839,11 @@ static int nl80211_send_bss(struct sk_buff *msg, struct netlink_callback *cb, ...@@ -7839,6 +7839,11 @@ static int nl80211_send_bss(struct sk_buff *msg, struct netlink_callback *cb,
intbss->ts_boottime, NL80211_BSS_PAD)) intbss->ts_boottime, NL80211_BSS_PAD))
goto nla_put_failure; goto nla_put_failure;
if (!nl80211_put_signal(msg, intbss->pub.chains,
intbss->pub.chain_signal,
NL80211_BSS_CHAIN_SIGNAL))
goto nla_put_failure;
switch (rdev->wiphy.signal_type) { switch (rdev->wiphy.signal_type) {
case CFG80211_SIGNAL_TYPE_MBM: case CFG80211_SIGNAL_TYPE_MBM:
if (nla_put_u32(msg, NL80211_BSS_SIGNAL_MBM, res->signal)) if (nla_put_u32(msg, NL80211_BSS_SIGNAL_MBM, res->signal))
......
...@@ -981,6 +981,9 @@ cfg80211_bss_update(struct cfg80211_registered_device *rdev, ...@@ -981,6 +981,9 @@ cfg80211_bss_update(struct cfg80211_registered_device *rdev,
found->ts = tmp->ts; found->ts = tmp->ts;
found->ts_boottime = tmp->ts_boottime; found->ts_boottime = tmp->ts_boottime;
found->parent_tsf = tmp->parent_tsf; found->parent_tsf = tmp->parent_tsf;
found->pub.chains = tmp->pub.chains;
memcpy(found->pub.chain_signal, tmp->pub.chain_signal,
IEEE80211_MAX_CHAINS);
ether_addr_copy(found->parent_bssid, tmp->parent_bssid); ether_addr_copy(found->parent_bssid, tmp->parent_bssid);
} else { } else {
struct cfg80211_internal_bss *new; struct cfg80211_internal_bss *new;
...@@ -1233,6 +1236,8 @@ cfg80211_inform_bss_frame_data(struct wiphy *wiphy, ...@@ -1233,6 +1236,8 @@ cfg80211_inform_bss_frame_data(struct wiphy *wiphy,
tmp.pub.capability = le16_to_cpu(mgmt->u.probe_resp.capab_info); tmp.pub.capability = le16_to_cpu(mgmt->u.probe_resp.capab_info);
tmp.ts_boottime = data->boottime_ns; tmp.ts_boottime = data->boottime_ns;
tmp.parent_tsf = data->parent_tsf; tmp.parent_tsf = data->parent_tsf;
tmp.pub.chains = data->chains;
memcpy(tmp.pub.chain_signal, data->chain_signal, IEEE80211_MAX_CHAINS);
ether_addr_copy(tmp.parent_bssid, data->parent_bssid); ether_addr_copy(tmp.parent_bssid, data->parent_bssid);
signal_valid = abs(data->chan->center_freq - channel->center_freq) <= signal_valid = abs(data->chan->center_freq - channel->center_freq) <=
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment