Skip to content

Commit 600b249

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 fd9564e commit 600b249

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
@@ -1075,6 +1075,7 @@ static void brcmf_scan_params_v2_to_v1(struct brcmf_scan_params_v2_le *params_v2
10751075
}
10761076

10771077
static void brcmf_escan_prep(struct brcmf_cfg80211_info *cfg,
1078+
struct brcmf_if *ifp,
10781079
struct brcmf_scan_params_v2_le *params_le,
10791080
struct cfg80211_scan_request *request)
10801081
{
@@ -1091,8 +1092,13 @@ static void brcmf_escan_prep(struct brcmf_cfg80211_info *cfg,
10911092

10921093
length = BRCMF_SCAN_PARAMS_V2_FIXED_SIZE;
10931094

1094-
params_le->version = cpu_to_le16(BRCMF_SCAN_PARAMS_VERSION_V2);
1095+
if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_SCAN_V3))
1096+
params_le->version = cpu_to_le16(BRCMF_SCAN_PARAMS_VERSION_V3);
1097+
else
1098+
params_le->version = cpu_to_le16(BRCMF_SCAN_PARAMS_VERSION_V2);
1099+
10951100
params_le->bss_type = DOT11_BSSTYPE_ANY;
1101+
params_le->ssid_type = 0;
10961102
params_le->scan_type = cpu_to_le32(BRCMF_SCANTYPE_ACTIVE);
10971103
params_le->channel_num = 0;
10981104
params_le->nprobes = cpu_to_le32(-1);
@@ -1186,7 +1192,7 @@ s32 brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg,
11861192
/* Do a scan abort to stop the driver's scan engine */
11871193
brcmf_dbg(SCAN, "ABORT scan in firmware\n");
11881194

1189-
brcmf_escan_prep(cfg, &params_v2_le, NULL);
1195+
brcmf_escan_prep(cfg, ifp, &params_v2_le, NULL);
11901196

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

1451-
params->version = cpu_to_le32(BRCMF_ESCAN_REQ_VERSION_V2);
1452-
1453-
if (!brcmf_feat_is_enabled(ifp, BRCMF_FEAT_SCAN_V2)) {
1457+
if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_SCAN_V3)) {
1458+
params->version = cpu_to_le32(BRCMF_ESCAN_REQ_VERSION_V3);
1459+
} else if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_SCAN_V2)) {
1460+
params->version = cpu_to_le32(BRCMF_ESCAN_REQ_VERSION_V2);
1461+
} else {
14541462
struct brcmf_escan_params_le *params_v1;
14551463

14561464
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
@@ -288,6 +288,7 @@ static int brcmf_feat_fwcap_debugfs_read(struct seq_file *seq, void *data)
288288
void brcmf_feat_attach(struct brcmf_pub *drvr)
289289
{
290290
struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
291+
struct brcmf_wl_scan_version_le scan_ver;
291292
struct brcmf_pno_macaddr_le pfn_mac;
292293
struct brcmf_gscan_config gscan_cfg;
293294
u32 wowl_cap;
@@ -338,7 +339,20 @@ void brcmf_feat_attach(struct brcmf_pub *drvr)
338339
ifp->drvr->feat_flags |= BIT(BRCMF_FEAT_SCAN_RANDOM_MAC);
339340

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

343357
brcmf_feat_wlc_version_overrides(drvr);
344358
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
@@ -56,6 +56,7 @@
5656
BRCMF_FEAT_DEF(FWAUTH) \
5757
BRCMF_FEAT_DEF(DUMP_OBSS) \
5858
BRCMF_FEAT_DEF(SCAN_V2) \
59+
BRCMF_FEAT_DEF(SCAN_V3) \
5960
BRCMF_FEAT_DEF(PMKID_V2) \
6061
BRCMF_FEAT_DEF(PMKID_V3)
6162

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)