Skip to content

Commit a0e1c94

Browse files
dberlinmarcan
authored andcommitted
[brcmfmac] Support high power/low power/etc scan flags
This patch adds support for handling the scan flags that come from the 802.11 stack. This enables the stack to control whether we are doing high/low power scans, as well as other options. Signed-off-by: Daniel Berlin <dberlin@dberlin.org>
1 parent b672274 commit a0e1c94

2 files changed

Lines changed: 51 additions & 2 deletions

File tree

drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,6 +1088,28 @@ static void brcmf_scan_params_v2_to_v1(struct brcmf_scan_params_v2_le *params_v2
10881088
&params_v2_le->channel_list[0], params_size);
10891089
}
10901090

1091+
static u32 brcmf_nl80211_scan_flags_to_scan_flags(u32 nl80211_flags)
1092+
{
1093+
u32 scan_flags = 0;
1094+
if (nl80211_flags & NL80211_SCAN_FLAG_LOW_SPAN) {
1095+
scan_flags |= BRCMF_SCANFLAGS_LOW_SPAN;
1096+
brcmf_dbg(SCAN, "requested low span scan\n");
1097+
}
1098+
if (nl80211_flags & NL80211_SCAN_FLAG_HIGH_ACCURACY) {
1099+
scan_flags |= BRCMF_SCANFLAGS_HIGH_ACCURACY;
1100+
brcmf_dbg(SCAN, "requested high accuracy scan\n");
1101+
}
1102+
if (nl80211_flags & NL80211_SCAN_FLAG_LOW_POWER) {
1103+
scan_flags |= BRCMF_SCANFLAGS_LOW_POWER;
1104+
brcmf_dbg(SCAN, "requested low power scan\n");
1105+
}
1106+
if (nl80211_flags & NL80211_SCAN_FLAG_LOW_PRIORITY) {
1107+
scan_flags |= BRCMF_SCANFLAGS_LOW_PRIO;
1108+
brcmf_dbg(SCAN, "requested low priority scan\n");
1109+
}
1110+
return scan_flags;
1111+
}
1112+
10911113
static void brcmf_escan_prep(struct brcmf_cfg80211_info *cfg,
10921114
struct brcmf_if *ifp,
10931115
struct brcmf_scan_params_v2_le *params_le,
@@ -1101,6 +1123,7 @@ static void brcmf_escan_prep(struct brcmf_cfg80211_info *cfg,
11011123
char *ptr;
11021124
int length;
11031125
struct brcmf_ssid_le ssid_le;
1126+
u32 scan_type = BRCMF_SCANTYPE_ACTIVE;
11041127

11051128
eth_broadcast_addr(params_le->bssid);
11061129

@@ -1113,7 +1136,6 @@ static void brcmf_escan_prep(struct brcmf_cfg80211_info *cfg,
11131136

11141137
params_le->bss_type = DOT11_BSSTYPE_ANY;
11151138
params_le->ssid_type = 0;
1116-
params_le->scan_type = cpu_to_le32(BRCMF_SCANTYPE_ACTIVE);
11171139
params_le->channel_num = 0;
11181140
params_le->nprobes = cpu_to_le32(-1);
11191141
params_le->active_time = cpu_to_le32(-1);
@@ -1173,9 +1195,17 @@ static void brcmf_escan_prep(struct brcmf_cfg80211_info *cfg,
11731195
}
11741196
} else {
11751197
brcmf_dbg(SCAN, "Performing passive scan\n");
1176-
params_le->scan_type = cpu_to_le32(BRCMF_SCANTYPE_PASSIVE);
1198+
scan_type = BRCMF_SCANTYPE_PASSIVE;
11771199
}
1200+
scan_type |= brcmf_nl80211_scan_flags_to_scan_flags(request->flags);
1201+
params_le->scan_type = cpu_to_le32(scan_type);
11781202
params_le->length = cpu_to_le16(length);
1203+
1204+
/* Include RNR results if requested */
1205+
if (request->flags & NL80211_SCAN_FLAG_COLOCATED_6GHZ) {
1206+
params_le->ssid_type |= BRCMF_SCANSSID_INC_RNR;
1207+
}
1208+
11791209
/* Adding mask to channel numbers */
11801210
params_le->channel_num =
11811211
cpu_to_le32((n_ssids << BRCMF_SCAN_PARAMS_NSSID_SHIFT) |
@@ -7840,6 +7870,16 @@ static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
78407870
wiphy_ext_feature_set(wiphy,
78417871
NL80211_EXT_FEATURE_SAE_OFFLOAD_AP);
78427872
}
7873+
if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_SAE)) {
7874+
wiphy->features |= NL80211_FEATURE_SAE;
7875+
}
7876+
7877+
/* High accuracy and low power scans are always supported. */
7878+
wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_HIGH_ACCURACY_SCAN);
7879+
wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_LOW_POWER_SCAN);
7880+
wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_LOW_SPAN_SCAN);
7881+
wiphy->features |= NL80211_FEATURE_LOW_PRIORITY_SCAN;
7882+
78437883
wiphy->mgmt_stypes = brcmf_txrx_stypes;
78447884
wiphy->max_remain_on_channel_duration = 5000;
78457885
if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_PNO)) {

drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,15 @@
6464
#define BRCMF_SCANTYPE_ACTIVE 0
6565
#define BRCMF_SCANTYPE_PASSIVE 1
6666

67+
/* Additional scanning flags */
68+
#define BRCMF_SCANFLAGS_LOW_PRIO 0x2
69+
#define BRCMF_SCANFLAGS_LOW_POWER 0x1000
70+
#define BRCMF_SCANFLAGS_HIGH_ACCURACY 0x2000
71+
#define BRCMF_SCANFLAGS_LOW_SPAN 0x4000
72+
73+
/* scan ssid_type flags */
74+
#define BRCMF_SCANSSID_INC_RNR 0x02 /* Include RNR channels*/
75+
6776
#define BRCMF_WSEC_MAX_PSK_LEN 32
6877
#define BRCMF_WSEC_PASSPHRASE BIT(0)
6978

0 commit comments

Comments
 (0)