From patchwork Fri May 19 07:57:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arend van Spriel X-Patchwork-Id: 9736149 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6CA606020B for ; Fri, 19 May 2017 07:58:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 41C08288EE for ; Fri, 19 May 2017 07:58:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 35D7428928; Fri, 19 May 2017 07:58:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 20DEA288EE for ; Fri, 19 May 2017 07:58:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751481AbdESH6G (ORCPT ); Fri, 19 May 2017 03:58:06 -0400 Received: from lpdvrndsmtp01.broadcom.com ([192.19.229.170]:44610 "EHLO rnd-relay.smtp.broadcom.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750734AbdESH6D (ORCPT ); Fri, 19 May 2017 03:58:03 -0400 Received: from mail-irv-17.broadcom.com (mail-irv-17.lvn.broadcom.net [10.75.224.233]) by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id E9C6130C01A; Fri, 19 May 2017 00:58:01 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com E9C6130C01A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1495180682; bh=C+u4iT7UT2CdUGYSn9kBV95giabWHwOPHyMCuDYSzc8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YFK+ZSoaLa32nVEQYgsH7hA4KGxI0uaVIMs/WuA+7LXFFLsQq3VaS/X9uaZx+KASP GGvpwuEvvUleLuMBT5F/OURWSWjPVTdVfG9yTZubHkrfqEu34ETUImh2mLjpvDIlG1 tAB97Eii3xzzN1SUs1aB0SvNbIoqUplbEcNSxy3E= Received: from jenkins-cam-14.cam.broadcom.com (jenkins-cam-14.cam.broadcom.com [10.177.128.77]) by mail-irv-17.broadcom.com (Postfix) with ESMTP id 9A01781F1C; Fri, 19 May 2017 00:58:01 -0700 (PDT) Received: by jenkins-cam-14.cam.broadcom.com (Postfix, from userid 25152) id 5129CB8283C; Fri, 19 May 2017 08:57:54 +0100 (BST) From: Arend van Spriel To: Kalle Valo Cc: linux-wireless@vger.kernel.org, Arend Van Spriel Subject: [PATCH V4 3/3] brcmfmac: add scheduled scan support for specified BSSIDs Date: Fri, 19 May 2017 08:57:39 +0100 Message-Id: <1495180659-12406-3-git-send-email-arend.vanspriel@broadcom.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1495180659-12406-1-git-send-email-arend.vanspriel@broadcom.com> References: <1495180659-12406-1-git-send-email-arend.vanspriel@broadcom.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Arend Van Spriel Add support to handle scheduled scan request containing BSSID in the matchsets. The firmware can send event upon finding BSSIDs and SSIDs. To get these in one event the bit REPORT_SEPARATELY needed to be removed from the flags in brcmf_pno_config(). Reviewed-by: Hante Meuleman Reviewed-by: Pieter-Paul Giesberts Reviewed-by: Franky Lin Signed-off-by: Arend van Spriel --- .../broadcom/brcm80211/brcmfmac/fwil_types.h | 11 ++++ .../net/wireless/broadcom/brcm80211/brcmfmac/pno.c | 58 ++++++++++++++++------ 2 files changed, 53 insertions(+), 16 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h index 45aaae8..b857d53 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h @@ -806,6 +806,17 @@ struct brcmf_pno_macaddr_le { }; /** + * struct brcmf_pno_bssid_le - bssid configuration for PNO scan. + * + * @bssid: BSS network identifier. + * @flags: flags for this BSSID. + */ +struct brcmf_pno_bssid_le { + u8 bssid[ETH_ALEN]; + __le16 flags; +}; + +/** * struct brcmf_pktcnt_le - packet counters. * * @rx_good_pkt: packets (MSDUs & MMPDUs) received from this station diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c index 81e8549..9623157 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c @@ -120,7 +120,6 @@ static int brcmf_pno_config(struct brcmf_if *ifp, u32 scan_freq, /* set extra pno params */ flags = BIT(BRCMF_PNO_IMMEDIATE_SCAN_BIT) | - BIT(BRCMF_PNO_REPORT_SEPARATELY_BIT) | BIT(BRCMF_PNO_ENABLE_ADAPTSCAN_BIT); pfn_param.repeat = BRCMF_PNO_REPEAT; pfn_param.exp = BRCMF_PNO_FREQ_EXPO_MAX; @@ -205,6 +204,7 @@ static int brcmf_pno_add_ssid(struct brcmf_if *ifp, struct cfg80211_ssid *ssid, bool active) { struct brcmf_pno_net_param_le pfn; + int err; pfn.auth = cpu_to_le32(WLAN_AUTH_OPEN); pfn.wpa_auth = cpu_to_le32(BRCMF_PNO_WPA_AUTH_ANY); @@ -215,7 +215,28 @@ static int brcmf_pno_add_ssid(struct brcmf_if *ifp, struct cfg80211_ssid *ssid, pfn.flags = cpu_to_le32(1 << BRCMF_PNO_HIDDEN_BIT); pfn.ssid.SSID_len = cpu_to_le32(ssid->ssid_len); memcpy(pfn.ssid.SSID, ssid->ssid, ssid->ssid_len); - return brcmf_fil_iovar_data_set(ifp, "pfn_add", &pfn, sizeof(pfn)); + + brcmf_dbg(SCAN, "adding ssid=%.32s (active=%d)\n", ssid->ssid, active); + err = brcmf_fil_iovar_data_set(ifp, "pfn_add", &pfn, sizeof(pfn)); + if (err < 0) + brcmf_err("adding failed: err=%d\n", err); + return err; +} + +static int brcmf_pno_add_bssid(struct brcmf_if *ifp, const u8 *bssid) +{ + struct brcmf_pno_bssid_le bssid_cfg; + int err; + + memcpy(bssid_cfg.bssid, bssid, ETH_ALEN); + bssid_cfg.flags = 0; + + brcmf_dbg(SCAN, "adding bssid=%pM\n", bssid); + err = brcmf_fil_iovar_data_set(ifp, "pfn_add_bssid", &bssid_cfg, + sizeof(bssid_cfg)); + if (err < 0) + brcmf_err("adding failed: err=%d\n", err); + return err; } static bool brcmf_is_ssid_active(struct cfg80211_ssid *ssid, @@ -342,29 +363,29 @@ static int brcmf_pno_prep_fwconfig(struct brcmf_pno_info *pi, return err; } -static int brcmf_pno_config_ssids(struct brcmf_if *ifp, - struct brcmf_pno_info *pi) +static int brcmf_pno_config_networks(struct brcmf_if *ifp, + struct brcmf_pno_info *pi) { struct cfg80211_sched_scan_request *r; struct cfg80211_match_set *ms; bool active; - int i, j, err; + int i, j, err = 0; for (i = 0; i < pi->n_reqs; i++) { r = pi->reqs[i]; for (j = 0; j < r->n_match_sets; j++) { ms = &r->match_sets[j]; - if (!ms->ssid.ssid_len) - continue; - active = brcmf_is_ssid_active(&ms->ssid, r); - brcmf_dbg(SCAN, "adding %.32s (active=%d)\n", - ms->ssid.ssid, active); - err = brcmf_pno_add_ssid(ifp, &ms->ssid, active); - if (err < 0) { - brcmf_err("adding failed: err=%d\n", err); - return err; + if (ms->ssid.ssid_len) { + active = brcmf_is_ssid_active(&ms->ssid, r); + err = brcmf_pno_add_ssid(ifp, &ms->ssid, + active); } + if (!err && is_valid_ether_addr(ms->bssid)) + err = brcmf_pno_add_bssid(ifp, ms->bssid); + + if (err < 0) + return err; } } return 0; @@ -428,7 +449,7 @@ static int brcmf_pno_config_sched_scans(struct brcmf_if *ifp) if (err < 0) goto clean; - err = brcmf_pno_config_ssids(ifp, pi); + err = brcmf_pno_config_networks(ifp, pi); if (err < 0) goto clean; @@ -555,7 +576,12 @@ u32 brcmf_pno_get_bucket_map(struct brcmf_pno_info *pi, for (j = 0; j < req->n_match_sets; j++) { ms = &req->match_sets[j]; if (ms->ssid.ssid_len == ni->SSID_len && - !strncmp(ms->ssid.ssid, ni->SSID, ni->SSID_len)) { + !memcmp(ms->ssid.ssid, ni->SSID, ni->SSID_len)) { + bucket_map |= BIT(i); + break; + } + if (is_valid_ether_addr(ms->bssid) && + !memcmp(ms->bssid, ni->bssid, ETH_ALEN)) { bucket_map |= BIT(i); break; }