diff mbox

[V3,5/9] brcmfmac: add firmware feature detection for gscan feature

Message ID 1492776308-15120-6-git-send-email-arend.vanspriel@broadcom.com (mailing list archive)
State Accepted
Delegated to: Kalle Valo
Headers show

Commit Message

Arend van Spriel April 21, 2017, 12:05 p.m. UTC
From: Arend van Spriel <arend@broadcom.com>

Detect gscan support in firmware by doing pfn_gscan_cfg iovar with
invalid version.

Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
---
 .../wireless/broadcom/brcm80211/brcmfmac/feature.c | 22 +++++++-
 .../wireless/broadcom/brcm80211/brcmfmac/feature.h |  4 +-
 .../broadcom/brcm80211/brcmfmac/fwil_types.h       | 59 ++++++++++++++++++++++
 3 files changed, 83 insertions(+), 2 deletions(-)

Comments

Kalle Valo May 18, 2017, 1:36 p.m. UTC | #1
Arend Van Spriel <arend.vanspriel@broadcom.com> wrote:
> From: Arend van Spriel <arend@broadcom.com>
> 
> Detect gscan support in firmware by doing pfn_gscan_cfg iovar with
> invalid version.
> 
> Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
> Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
> Reviewed-by: Franky Lin <franky.lin@broadcom.com>
> Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>

Failed to apply:

fatal: sha1 information is lacking or useless (drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c).
error: could not build fake ancestor
Applying: brcmfmac: add support multi-scheduled scan
Patch failed at 0001 brcmfmac: add support multi-scheduled scan
The copy of the patch that failed is found in: .git/rebase-apply/patch

5 patches set to Changes Requested.

9692541 [V3,5/9] brcmfmac: add firmware feature detection for gscan feature
9692537 [V3,6/9] brcmfmac: move scheduled scan wiphy param setting to pno module
9692543 [V3,7/9] brcmfmac: add support multi-scheduled scan
9692535 [V3,8/9] brcmfmac: add mutex to protect pno requests
9692539 [V3,9/9] brcmfmac: add scheduled scan support for specified BSSIDs
Kalle Valo May 18, 2017, 3:47 p.m. UTC | #2
Kalle Valo <kvalo@codeaurora.org> writes:

> Arend Van Spriel <arend.vanspriel@broadcom.com> wrote:
>> From: Arend van Spriel <arend@broadcom.com>
>> 
>> Detect gscan support in firmware by doing pfn_gscan_cfg iovar with
>> invalid version.
>> 
>> Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
>> Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
>> Reviewed-by: Franky Lin <franky.lin@broadcom.com>
>> Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
>
> Failed to apply:
>
> fatal: sha1 information is lacking or useless (drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c).
> error: could not build fake ancestor
> Applying: brcmfmac: add support multi-scheduled scan
> Patch failed at 0001 brcmfmac: add support multi-scheduled scan
> The copy of the patch that failed is found in: .git/rebase-apply/patch
>
> 5 patches set to Changes Requested.
>
> 9692541 [V3,5/9] brcmfmac: add firmware feature detection for gscan feature
> 9692537 [V3,6/9] brcmfmac: move scheduled scan wiphy param setting to pno module
> 9692543 [V3,7/9] brcmfmac: add support multi-scheduled scan
> 9692535 [V3,8/9] brcmfmac: add mutex to protect pno requests
> 9692539 [V3,9/9] brcmfmac: add scheduled scan support for specified BSSIDs

Actually I made a mistake and forgot to manually remove patches 5 and 6
from the tree after the conflict (I haven't automated that part yet in
my script). So these are now applied:

9fe929aaace6 brcmfmac: add firmware feature detection for gscan feature
94ed6ffb7965 brcmfmac: move scheduled scan wiphy param setting to pno module

Please resend patches 7-9 and double check that the tree looks ok :)
Arend van Spriel May 18, 2017, 7:34 p.m. UTC | #3
On 18-5-2017 17:47, Kalle Valo wrote:
> Kalle Valo <kvalo@codeaurora.org> writes:
> 
>> Arend Van Spriel <arend.vanspriel@broadcom.com> wrote:
>>> From: Arend van Spriel <arend@broadcom.com>
>>>
>>> Detect gscan support in firmware by doing pfn_gscan_cfg iovar with
>>> invalid version.
>>>
>>> Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
>>> Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
>>> Reviewed-by: Franky Lin <franky.lin@broadcom.com>
>>> Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
>>
>> Failed to apply:
>>
>> fatal: sha1 information is lacking or useless (drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c).
>> error: could not build fake ancestor
>> Applying: brcmfmac: add support multi-scheduled scan
>> Patch failed at 0001 brcmfmac: add support multi-scheduled scan
>> The copy of the patch that failed is found in: .git/rebase-apply/patch
>>
>> 5 patches set to Changes Requested.
>>
>> 9692541 [V3,5/9] brcmfmac: add firmware feature detection for gscan feature
>> 9692537 [V3,6/9] brcmfmac: move scheduled scan wiphy param setting to pno module
>> 9692543 [V3,7/9] brcmfmac: add support multi-scheduled scan
>> 9692535 [V3,8/9] brcmfmac: add mutex to protect pno requests
>> 9692539 [V3,9/9] brcmfmac: add scheduled scan support for specified BSSIDs
> 
> Actually I made a mistake and forgot to manually remove patches 5 and 6
> from the tree after the conflict (I haven't automated that part yet in
> my script). So these are now applied:
> 
> 9fe929aaace6 brcmfmac: add firmware feature detection for gscan feature
> 94ed6ffb7965 brcmfmac: move scheduled scan wiphy param setting to pno module
> 
> Please resend patches 7-9 and double check that the tree looks ok :)

Will do. These patches were in same series as cfg80211 changes and all
based on mac80211-next/master. I already mentioned to you and Johannes
in earlier version of the patch series (posted April 7) that this would
result in a merge conflict, but I can imagine that info got lost after
more than a month.

Regards,
Arend
Kalle Valo May 19, 2017, 5:03 a.m. UTC | #4
Arend Van Spriel <arend.vanspriel@broadcom.com> writes:

> On 18-5-2017 17:47, Kalle Valo wrote:
>> Kalle Valo <kvalo@codeaurora.org> writes:
>> 
>>> Arend Van Spriel <arend.vanspriel@broadcom.com> wrote:
>>>> From: Arend van Spriel <arend@broadcom.com>
>>>>
>>>> Detect gscan support in firmware by doing pfn_gscan_cfg iovar with
>>>> invalid version.
>>>>
>>>> Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
>>>> Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
>>>> Reviewed-by: Franky Lin <franky.lin@broadcom.com>
>>>> Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
>>>
>>> Failed to apply:
>>>
>>> fatal: sha1 information is lacking or useless
>>> (drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c).
>>> error: could not build fake ancestor
>>> Applying: brcmfmac: add support multi-scheduled scan
>>> Patch failed at 0001 brcmfmac: add support multi-scheduled scan
>>> The copy of the patch that failed is found in: .git/rebase-apply/patch
>>>
>>> 5 patches set to Changes Requested.
>>>
>>> 9692541 [V3,5/9] brcmfmac: add firmware feature detection for gscan feature
>>> 9692537 [V3,6/9] brcmfmac: move scheduled scan wiphy param setting to pno module
>>> 9692543 [V3,7/9] brcmfmac: add support multi-scheduled scan
>>> 9692535 [V3,8/9] brcmfmac: add mutex to protect pno requests
>>> 9692539 [V3,9/9] brcmfmac: add scheduled scan support for specified BSSIDs
>> 
>> Actually I made a mistake and forgot to manually remove patches 5 and 6
>> from the tree after the conflict (I haven't automated that part yet in
>> my script). So these are now applied:
>> 
>> 9fe929aaace6 brcmfmac: add firmware feature detection for gscan feature
>> 94ed6ffb7965 brcmfmac: move scheduled scan wiphy param setting to pno module
>> 
>> Please resend patches 7-9 and double check that the tree looks ok :)
>
> Will do. These patches were in same series as cfg80211 changes and all
> based on mac80211-next/master. I already mentioned to you and Johannes
> in earlier version of the patch series (posted April 7) that this would
> result in a merge conflict, but I can imagine that info got lost after
> more than a month.

Ah, I remember now. But yeah, too many emails so I tend to forget so old
discussions while looking at patches.
diff mbox

Patch

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
index 62985f2..8c7ef59 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
@@ -27,6 +27,7 @@ 
 #include "feature.h"
 #include "common.h"
 
+#define BRCMF_FW_UNSUPPORTED	23
 
 /*
  * expand feature list to array of feature strings.
@@ -113,6 +114,22 @@  static void brcmf_feat_iovar_int_get(struct brcmf_if *ifp,
 	}
 }
 
+static void brcmf_feat_iovar_data_set(struct brcmf_if *ifp,
+				      enum brcmf_feat_id id, char *name,
+				      const void *data, size_t len)
+{
+	int err;
+
+	err = brcmf_fil_iovar_data_set(ifp, name, data, len);
+	if (err != -BRCMF_FW_UNSUPPORTED) {
+		brcmf_dbg(INFO, "enabling feature: %s\n", brcmf_feat_names[id]);
+		ifp->drvr->feat_flags |= BIT(id);
+	} else {
+		brcmf_dbg(TRACE, "%s feature check failed: %d\n",
+			  brcmf_feat_names[id], err);
+	}
+}
+
 static void brcmf_feat_firmware_capabilities(struct brcmf_if *ifp)
 {
 	char caps[256];
@@ -136,11 +153,14 @@  void brcmf_feat_attach(struct brcmf_pub *drvr)
 {
 	struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
 	struct brcmf_pno_macaddr_le pfn_mac;
+	struct brcmf_gscan_config gscan_cfg;
 	u32 wowl_cap;
 	s32 err;
 
 	brcmf_feat_firmware_capabilities(ifp);
-
+	memset(&gscan_cfg, 0, sizeof(gscan_cfg));
+	brcmf_feat_iovar_data_set(ifp, BRCMF_FEAT_GSCAN, "pfn_gscan_cfg",
+				  &gscan_cfg, sizeof(gscan_cfg));
 	brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_PNO, "pfn");
 	if (drvr->bus_if->wowl_supported)
 		brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_WOWL, "wowl");
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h
index db4733a..c1dbd17 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h
@@ -31,6 +31,7 @@ 
  * WOWL_GTK: (WOWL) GTK rekeying offload
  * WOWL_ARP_ND: ARP and Neighbor Discovery offload support during WOWL.
  * MFP: 802.11w Management Frame Protection.
+ * GSCAN: enhanced scan offload feature.
  */
 #define BRCMF_FEAT_LIST \
 	BRCMF_FEAT_DEF(MBSS) \
@@ -44,7 +45,8 @@ 
 	BRCMF_FEAT_DEF(WOWL_ND) \
 	BRCMF_FEAT_DEF(WOWL_GTK) \
 	BRCMF_FEAT_DEF(WOWL_ARP_ND) \
-	BRCMF_FEAT_DEF(MFP)
+	BRCMF_FEAT_DEF(MFP) \
+	BRCMF_FEAT_DEF(GSCAN)
 
 /*
  * Quirks:
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h
index 9a1eb5a..8c18fad 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h
@@ -835,4 +835,63 @@  struct brcmf_gtk_keyinfo_le {
 	u8 replay_counter[BRCMF_RSN_REPLAY_LEN];
 };
 
+/**
+ * struct brcmf_gscan_bucket_config - configuration data for channel bucket.
+ *
+ * @bucket_end_index: !unknown!
+ * @bucket_freq_multiple: !unknown!
+ * @flag: !unknown!
+ * @reserved: !unknown!
+ * @repeat: !unknown!
+ * @max_freq_multiple: !unknown!
+ */
+struct brcmf_gscan_bucket_config {
+	u8 bucket_end_index;
+	u8 bucket_freq_multiple;
+	u8 flag;
+	u8 reserved;
+	__le16 repeat;
+	__le16 max_freq_multiple;
+};
+
+/* version supported which must match firmware */
+#define BRCMF_GSCAN_CFG_VERSION                     1
+
+/**
+ * enum brcmf_gscan_cfg_flags - bit values for gscan flags.
+ *
+ * @BRCMF_GSCAN_CFG_FLAGS_ALL_RESULTS: send probe responses/beacons to host.
+ * @BRCMF_GSCAN_CFG_FLAGS_CHANGE_ONLY: indicated only flags member is changed.
+ */
+enum brcmf_gscan_cfg_flags {
+	BRCMF_GSCAN_CFG_FLAGS_ALL_RESULTS = BIT(0),
+	BRCMF_GSCAN_CFG_FLAGS_CHANGE_ONLY = BIT(7),
+};
+
+/**
+ * struct brcmf_gscan_config - configuration data for gscan.
+ *
+ * @version: version of the api to match firmware.
+ * @flags: flags according %enum brcmf_gscan_cfg_flags.
+ * @buffer_threshold: percentage threshold of buffer to generate an event.
+ * @swc_nbssid_threshold: number of BSSIDs with significant change that
+ *	will generate an event.
+ * @swc_rssi_window_size: size of rssi cache buffer (max=8).
+ * @count_of_channel_buckets: number of array members in @bucket.
+ * @retry_threshold: !unknown!
+ * @lost_ap_window: !unknown!
+ * @bucket: array of channel buckets.
+ */
+struct brcmf_gscan_config {
+	__le16 version;
+	u8  flags;
+	u8   buffer_threshold;
+	u8   swc_nbssid_threshold;
+	u8  swc_rssi_window_size;
+	u8  count_of_channel_buckets;
+	u8  retry_threshold;
+	__le16  lost_ap_window;
+	struct brcmf_gscan_bucket_config bucket[1];
+};
+
 #endif /* FWIL_TYPES_H_ */