History

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.

Sunil Dutt committed 8 years ago

Commit 983dafa1 parent 86b6c464 files · +22 −0Browse files

Unified · Split

4 files
  1. include/net/cfg80211.h +8 −0
  2. include/uapi/linux/nl80211.h +4 −0
  3. net/wireless/nl80211.c +5 −0
  4. net/wireless/scan.c +5 −0
include/net/cfg80211.h+8−0
@@ -1773,6 +1773,8 @@ enum cfg80211_signal_type { · 1772 unmodified lines
17731773 * by %parent_bssid.
17741774 * @parent_bssid: the BSS according to which %parent_tsf is set. This is set to
17751775 * 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.
17761778 */
17771779 struct cfg80211_inform_bss {
17781780 struct ieee80211_channel *chan;
@@ -1781,6 +1783,8 @@ struct cfg80211_inform_bss { · 2 unmodified lines
17811783 u64 boottime_ns;
17821784 u64 parent_tsf;
17831785 u8 parent_bssid[ETH_ALEN] __aligned(2);
1786+ u8 chains;
1787+ s8 chain_signal[IEEE80211_MAX_CHAINS];
17841788 };
17851789
17861790 /**
@@ -1824,6 +1828,8 @@ struct cfg80211_bss_ies { · 37 unmodified lines
18241828 * that holds the beacon data. @beacon_ies is still valid, of course, and
18251829 * points to the same data as hidden_beacon_bss->beacon_ies in that case.
18261830 * @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.
18271833 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
18281834 */
18291835 struct cfg80211_bss {
@@ -1842,6 +1848,8 @@ struct cfg80211_bss { · 12 unmodified lines
18421848 u16 capability;
18431849
18441850 u8 bssid[ETH_ALEN];
1851+ u8 chains;
1852+ s8 chain_signal[IEEE80211_MAX_CHAINS];
18451853
18461854 u8 priv[0] __aligned(sizeof(void *));
18471855 };
include/uapi/linux/nl80211.h+4−0
@@ -3862,6 +3862,9 @@ enum nl80211_bss_scan_width { · 3861 unmodified lines
38623862 * @NL80211_BSS_PARENT_BSSID. (u64).
38633863 * @NL80211_BSS_PARENT_BSSID: the BSS according to which @NL80211_BSS_PARENT_TSF
38643864 * 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.
38653868 * @__NL80211_BSS_AFTER_LAST: internal
38663869 * @NL80211_BSS_MAX: highest BSS attribute
38673870 */
@@ -3885,6 +3888,7 @@ enum nl80211_bss { · 17 unmodified lines
38853888 NL80211_BSS_PAD,
38863889 NL80211_BSS_PARENT_TSF,
38873890 NL80211_BSS_PARENT_BSSID,
3891+ NL80211_BSS_CHAIN_SIGNAL,
38883892
38893893 /* keep last */
38903894 __NL80211_BSS_AFTER_LAST,
net/wireless/nl80211.c+5−0
@@ -7839,6 +7839,11 @@ static int nl80211_send_bss(struct sk_buff *msg, struct netlink_callback *cb, · 7838 unmodified lines
78397839 intbss->ts_boottime, NL80211_BSS_PAD))
78407840 goto nla_put_failure;
78417841
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+
78427847 switch (rdev->wiphy.signal_type) {
78437848 case CFG80211_SIGNAL_TYPE_MBM:
78447849 if (nla_put_u32(msg, NL80211_BSS_SIGNAL_MBM, res->signal))
net/wireless/scan.c+5−0
@@ -981,6 +981,9 @@ cfg80211_bss_update(struct cfg80211_registered_device *rdev, · 980 unmodified lines
981981 found->ts = tmp->ts;
982982 found->ts_boottime = tmp->ts_boottime;
983983 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);
984987 ether_addr_copy(found->parent_bssid, tmp->parent_bssid);
985988 } else {
986989 struct cfg80211_internal_bss *new;
@@ -1233,6 +1236,8 @@ cfg80211_inform_bss_frame_data(struct wiphy *wiphy, · 246 unmodified lines
12331236 tmp.pub.capability = le16_to_cpu(mgmt->u.probe_resp.capab_info);
12341237 tmp.ts_boottime = data->boottime_ns;
12351238 tmp.parent_tsf = data->parent_tsf;
1239+ tmp.pub.chains = data->chains;
1240+ memcpy(tmp.pub.chain_signal, data->chain_signal, IEEE80211_MAX_CHAINS);
12361241 ether_addr_copy(tmp.parent_bssid, data->parent_bssid);
12371242
12381243 signal_valid = abs(data->chan->center_freq - channel->center_freq) <=