Skip to content

Commit 399ef7b

Browse files
committed
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 40d5593 commit 399ef7b

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

10761076
static void brcmf_escan_prep(struct brcmf_cfg80211_info *cfg,
1077+
struct brcmf_if *ifp,
10771078
struct brcmf_scan_params_v2_le *params_le,
10781079
struct cfg80211_scan_request *request)
10791080
{
@@ -1090,8 +1091,13 @@ static void brcmf_escan_prep(struct brcmf_cfg80211_info *cfg,
10901091

10911092
length = BRCMF_SCAN_PARAMS_V2_FIXED_SIZE;
10921093

1093-
params_le->version = cpu_to_le16(BRCMF_SCAN_PARAMS_VERSION_V2);
1094+
if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_SCAN_V3))
1095+
params_le->version = cpu_to_le16(BRCMF_SCAN_PARAMS_VERSION_V3);
1096+
else
1097+
params_le->version = cpu_to_le16(BRCMF_SCAN_PARAMS_VERSION_V2);
1098+
10941099
params_le->bss_type = DOT11_BSSTYPE_ANY;
1100+
params_le->ssid_type = 0;
10951101
params_le->scan_type = cpu_to_le32(BRCMF_SCANTYPE_ACTIVE);
10961102
params_le->channel_num = 0;
10971103
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
@@ -287,6 +287,7 @@ static int brcmf_feat_fwcap_debugfs_read(struct seq_file *seq, void *data)
287287
void brcmf_feat_attach(struct brcmf_pub *drvr)
288288
{
289289
struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
290+
struct brcmf_wl_scan_version_le scan_ver;
290291
struct brcmf_pno_macaddr_le pfn_mac;
291292
struct brcmf_gscan_config gscan_cfg;
292293
u32 wowl_cap;
@@ -337,7 +338,20 @@ void brcmf_feat_attach(struct brcmf_pub *drvr)
337338
ifp->drvr->feat_flags |= BIT(BRCMF_FEAT_SCAN_RANDOM_MAC);
338339

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

342356
if (drvr->settings->feature_disable) {
343357
brcmf_dbg(INFO, "Features: 0x%02x, disable: 0x%02x\n",

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
@@ -828,6 +830,17 @@ struct brcmf_wlc_version_le {
828830
__le16 wlc_ver_minor;
829831
};
830832

833+
/**
834+
* struct brcmf_wl_scan_version_le - scan interface version
835+
*/
836+
struct brcmf_wl_scan_version_le {
837+
__le16 version;
838+
__le16 length;
839+
__le16 scan_ver_major;
840+
};
841+
842+
#define BRCMF_WL_SCAN_VERSION_VERSION 1
843+
831844
/**
832845
* struct brcmf_assoclist_le - request assoc list.
833846
*

0 commit comments

Comments
 (0)