Skip to content

Commit c582324

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 3fefd45 commit c582324

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
@@ -1078,6 +1078,7 @@ static void brcmf_scan_params_v2_to_v1(struct brcmf_scan_params_v2_le *params_v2
10781078
}
10791079

10801080
static void brcmf_escan_prep(struct brcmf_cfg80211_info *cfg,
1081+
struct brcmf_if *ifp,
10811082
struct brcmf_scan_params_v2_le *params_le,
10821083
struct cfg80211_scan_request *request)
10831084
{
@@ -1094,8 +1095,13 @@ static void brcmf_escan_prep(struct brcmf_cfg80211_info *cfg,
10941095

10951096
length = BRCMF_SCAN_PARAMS_V2_FIXED_SIZE;
10961097

1097-
params_le->version = cpu_to_le16(BRCMF_SCAN_PARAMS_VERSION_V2);
1098+
if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_SCAN_V3))
1099+
params_le->version = cpu_to_le16(BRCMF_SCAN_PARAMS_VERSION_V3);
1100+
else
1101+
params_le->version = cpu_to_le16(BRCMF_SCAN_PARAMS_VERSION_V2);
1102+
10981103
params_le->bss_type = DOT11_BSSTYPE_ANY;
1104+
params_le->ssid_type = 0;
10991105
params_le->scan_type = cpu_to_le32(BRCMF_SCANTYPE_ACTIVE);
11001106
params_le->channel_num = 0;
11011107
params_le->nprobes = cpu_to_le32(-1);
@@ -1189,7 +1195,7 @@ s32 brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg,
11891195
/* Do a scan abort to stop the driver's scan engine */
11901196
brcmf_dbg(SCAN, "ABORT scan in firmware\n");
11911197

1192-
brcmf_escan_prep(cfg, &params_v2_le, NULL);
1198+
brcmf_escan_prep(cfg, ifp, &params_v2_le, NULL);
11931199

11941200
/* E-Scan (or anyother type) can be aborted by SCAN */
11951201
if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_SCAN_V2)) {
@@ -1449,11 +1455,13 @@ brcmf_run_escan(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp,
14491455
goto exit;
14501456
}
14511457
BUG_ON(params_size + sizeof("escan") >= BRCMF_DCMD_MEDLEN);
1452-
brcmf_escan_prep(cfg, &params->params_v2_le, request);
1458+
brcmf_escan_prep(cfg, ifp, &params->params_v2_le, request);
14531459

1454-
params->version = cpu_to_le32(BRCMF_ESCAN_REQ_VERSION_V2);
1455-
1456-
if (!brcmf_feat_is_enabled(ifp, BRCMF_FEAT_SCAN_V2)) {
1460+
if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_SCAN_V3)) {
1461+
params->version = cpu_to_le32(BRCMF_ESCAN_REQ_VERSION_V3);
1462+
} else if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_SCAN_V2)) {
1463+
params->version = cpu_to_le32(BRCMF_ESCAN_REQ_VERSION_V2);
1464+
} else {
14571465
struct brcmf_escan_params_le *params_v1;
14581466

14591467
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)