1 From 331e789443618ca9cc3ed48ada4e670225cca036 Mon Sep 17 00:00:00 2001
2 From: Arend Van Spriel <arend.vanspriel@broadcom.com>
3 Date: Wed, 23 Nov 2016 10:25:28 +0000
4 Subject: [PATCH] brcmfmac: use provided channels for scheduled scan
6 User-space can provide list of channels in the schedule scan request.
7 This was ignored so all channels supported and allowed by the device
8 were used. This patch configures the device to use the channels as
11 Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
12 Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
13 Reviewed-by: Franky Lin <franky.lin@broadcom.com>
14 Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
15 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
17 .../broadcom/brcm80211/brcmfmac/fwil_types.h | 16 +++++++++++++
18 .../net/wireless/broadcom/brcm80211/brcmfmac/pno.c | 26 +++++++++++++++++++++-
19 2 files changed, 41 insertions(+), 1 deletion(-)
21 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h
22 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h
24 #define BRCMF_TXBF_MU_BFR_CAP BIT(1)
26 #define BRCMF_MAXPMKID 16 /* max # PMKID cache entries */
27 +#define BRCMF_NUMCHANNELS 64
29 #define BRCMF_PFN_MACADDR_CFG_VER 1
30 #define BRCMF_PFN_MAC_OUI_ONLY BIT(0)
31 @@ -719,6 +720,21 @@ struct brcmf_pno_param_le {
35 + * struct brcmf_pno_config_le - PNO channel configuration.
37 + * @reporttype: determines what is reported.
38 + * @channel_num: number of channels specified in @channel_list.
39 + * @channel_list: channels to use in PNO scan.
42 +struct brcmf_pno_config_le {
45 + __le16 channel_list[BRCMF_NUMCHANNELS];
50 * struct brcmf_pno_net_param_le - scan parameters per preferred network.
52 * @ssid: ssid name and its length.
53 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c
54 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c
61 #include "fwil_types.h"
62 +#include "cfg80211.h"
65 #define BRCMF_PNO_VERSION 2
66 #define BRCMF_PNO_REPEAT 4
68 #define BRCMF_PNO_HIDDEN_BIT 2
69 #define BRCMF_PNO_SCHED_SCAN_PERIOD 30
71 +static int brcmf_pno_channel_config(struct brcmf_if *ifp,
72 + struct brcmf_pno_config_le *cfg)
74 + cfg->reporttype = 0;
77 + return brcmf_fil_iovar_data_set(ifp, "pfn_cfg", cfg, sizeof(*cfg));
80 static int brcmf_pno_config(struct brcmf_if *ifp, u32 scan_freq,
83 @@ -167,7 +177,10 @@ int brcmf_pno_clean(struct brcmf_if *ifp
84 int brcmf_pno_start_sched_scan(struct brcmf_if *ifp,
85 struct cfg80211_sched_scan_request *req)
87 + struct brcmu_d11inf *d11inf;
88 + struct brcmf_pno_config_le pno_cfg;
89 struct cfg80211_ssid *ssid;
93 /* clean up everything */
94 @@ -190,6 +203,17 @@ int brcmf_pno_start_sched_scan(struct br
98 + /* configure channels to use */
99 + d11inf = &ifp->drvr->config->d11inf;
100 + for (i = 0; i < req->n_channels; i++) {
101 + chan = req->channels[i]->hw_value;
102 + pno_cfg.channel_list[i] = cpu_to_le16(chan);
104 + if (req->n_channels) {
105 + pno_cfg.channel_num = cpu_to_le32(req->n_channels);
106 + brcmf_pno_channel_config(ifp, &pno_cfg);
109 /* configure each match set */
110 for (i = 0; i < req->n_match_sets; i++) {
111 ssid = &req->match_sets[i].ssid;