Skip to content

Commit 13ab24e

Browse files
marcanjannau
authored andcommitted
wifi: brcmfmac: Add support for SCAN_V3
This is essentially identical to SCAN_V2 with an extra field where we had a padding byte, so don't bother duplicating the entire structure. Just add the field and the logic to set the version properly. Signed-off-by: Hector Martin <marcan@marcan.st>
1 parent ac7043d commit 13ab24e

4 files changed

Lines changed: 44 additions & 8 deletions

File tree

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

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,6 +1093,7 @@ static void brcmf_scan_params_v2_to_v1(struct brcmf_scan_params_v2_le *params_v2
10931093
}
10941094

10951095
static void brcmf_escan_prep(struct brcmf_cfg80211_info *cfg,
1096+
struct brcmf_if *ifp,
10961097
struct brcmf_scan_params_v2_le *params_le,
10971098
struct cfg80211_scan_request *request)
10981099
{
@@ -1109,8 +1110,13 @@ static void brcmf_escan_prep(struct brcmf_cfg80211_info *cfg,
11091110

11101111
length = BRCMF_SCAN_PARAMS_V2_FIXED_SIZE;
11111112

1112-
params_le->version = cpu_to_le16(BRCMF_SCAN_PARAMS_VERSION_V2);
1113+
if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_SCAN_V3))
1114+
params_le->version = cpu_to_le16(BRCMF_SCAN_PARAMS_VERSION_V3);
1115+
else
1116+
params_le->version = cpu_to_le16(BRCMF_SCAN_PARAMS_VERSION_V2);
1117+
11131118
params_le->bss_type = DOT11_BSSTYPE_ANY;
1119+
params_le->ssid_type = 0;
11141120
params_le->scan_type = cpu_to_le32(BRCMF_SCANTYPE_ACTIVE);
11151121
params_le->channel_num = 0;
11161122
params_le->nprobes = cpu_to_le32(-1);
@@ -1204,7 +1210,7 @@ s32 brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg,
12041210
/* Do a scan abort to stop the driver's scan engine */
12051211
brcmf_dbg(SCAN, "ABORT scan in firmware\n");
12061212

1207-
brcmf_escan_prep(cfg, &params_v2_le, NULL);
1213+
brcmf_escan_prep(cfg, ifp, &params_v2_le, NULL);
12081214

12091215
/* E-Scan (or anyother type) can be aborted by SCAN */
12101216
if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_SCAN_V2)) {
@@ -1464,11 +1470,13 @@ brcmf_run_escan(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp,
14641470
goto exit;
14651471
}
14661472
BUG_ON(params_size + sizeof("escan") >= BRCMF_DCMD_MEDLEN);
1467-
brcmf_escan_prep(cfg, &params->params_v2_le, request);
1473+
brcmf_escan_prep(cfg, ifp, &params->params_v2_le, request);
14681474

1469-
params->version = cpu_to_le32(BRCMF_ESCAN_REQ_VERSION_V2);
1470-
1471-
if (!brcmf_feat_is_enabled(ifp, BRCMF_FEAT_SCAN_V2)) {
1475+
if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_SCAN_V3)) {
1476+
params->version = cpu_to_le32(BRCMF_ESCAN_REQ_VERSION_V3);
1477+
} else if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_SCAN_V2)) {
1478+
params->version = cpu_to_le32(BRCMF_ESCAN_REQ_VERSION_V2);
1479+
} else {
14721480
struct brcmf_escan_params_le *params_v1;
14731481

14741482
params_size -= BRCMF_SCAN_PARAMS_V2_FIXED_SIZE;

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ static int brcmf_feat_fwcap_debugfs_read(struct seq_file *seq, void *data)
289289
void brcmf_feat_attach(struct brcmf_pub *drvr)
290290
{
291291
struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
292+
struct brcmf_wl_scan_version_le scan_ver;
292293
struct brcmf_pno_macaddr_le pfn_mac;
293294
struct brcmf_gscan_config gscan_cfg;
294295
u32 wowl_cap;
@@ -339,7 +340,20 @@ void brcmf_feat_attach(struct brcmf_pub *drvr)
339340
ifp->drvr->feat_flags |= BIT(BRCMF_FEAT_SCAN_RANDOM_MAC);
340341

341342
brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_FWSUP, "sup_wpa");
342-
brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_SCAN_V2, "scan_ver");
343+
344+
err = brcmf_fil_iovar_data_get(ifp, "scan_ver", &scan_ver, sizeof(scan_ver));
345+
if (!err) {
346+
int ver = le16_to_cpu(scan_ver.scan_ver_major);
347+
348+
if (ver == 2) {
349+
ifp->drvr->feat_flags |= BIT(BRCMF_FEAT_SCAN_V2);
350+
} else if (ver == 3) {
351+
/* We consider SCAN_V3 a subtype of SCAN_V2 since the
352+
* structure is essentially the same.
353+
*/
354+
ifp->drvr->feat_flags |= BIT(BRCMF_FEAT_SCAN_V2) | BIT(BRCMF_FEAT_SCAN_V3);
355+
}
356+
}
343357

344358
brcmf_feat_wlc_version_overrides(drvr);
345359
brcmf_feat_firmware_overrides(drvr);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
BRCMF_FEAT_DEF(FWAUTH) \
5858
BRCMF_FEAT_DEF(DUMP_OBSS) \
5959
BRCMF_FEAT_DEF(SCAN_V2) \
60+
BRCMF_FEAT_DEF(SCAN_V3) \
6061
BRCMF_FEAT_DEF(PMKID_V2) \
6162
BRCMF_FEAT_DEF(PMKID_V3) \
6263
BRCMF_FEAT_DEF(SAE_EXT)

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252

5353
/* version of brcmf_scan_params structure */
5454
#define BRCMF_SCAN_PARAMS_VERSION_V2 2
55+
#define BRCMF_SCAN_PARAMS_VERSION_V3 3
5556

5657
/* masks for channel and ssid count */
5758
#define BRCMF_SCAN_PARAMS_COUNT_MASK 0x0000ffff
@@ -72,6 +73,7 @@
7273
#define DOT11_BSSTYPE_ANY 2
7374
#define BRCMF_ESCAN_REQ_VERSION 1
7475
#define BRCMF_ESCAN_REQ_VERSION_V2 2
76+
#define BRCMF_ESCAN_REQ_VERSION_V3 3
7577

7678
#define BRCMF_MAXRATES_IN_SET 16 /* max # of rates in rateset */
7779

@@ -414,7 +416,7 @@ struct brcmf_scan_params_v2_le {
414416
s8 bss_type; /* default: any,
415417
* DOT11_BSSTYPE_ANY/INFRASTRUCTURE/INDEPENDENT
416418
*/
417-
u8 pad;
419+
u8 ssid_type; /* v3 only */
418420
__le32 scan_type; /* flags, 0 use default */
419421
__le32 nprobes; /* -1 use default, number of probes per channel */
420422
__le32 active_time; /* -1 use default, dwell time per channel for
@@ -833,6 +835,17 @@ struct brcmf_wlc_version_le {
833835
__le16 wlc_ver_minor;
834836
};
835837

838+
/**
839+
* struct brcmf_wl_scan_version_le - scan interface version
840+
*/
841+
struct brcmf_wl_scan_version_le {
842+
__le16 version;
843+
__le16 length;
844+
__le16 scan_ver_major;
845+
};
846+
847+
#define BRCMF_WL_SCAN_VERSION_VERSION 1
848+
836849
/**
837850
* struct brcmf_assoclist_le - request assoc list.
838851
*

0 commit comments

Comments
 (0)