aboutsummaryrefslogtreecommitdiffstats
path: root/package/kernel/mac80211/patches/357-0003-brcmfmac-move-pno-helper-functions-in-separate-sourc.patch
diff options
context:
space:
mode:
authorRafał Miłecki <rafal@milecki.pl>2017-02-02 09:27:20 +0100
committerRafał Miłecki <rafal@milecki.pl>2017-02-02 09:49:35 +0100
commit863a06b0a4ed3939d81fb49d3b8a88db9e807d41 (patch)
tree89174b4e79a6d66935bb4f72601ed476b8e3d9a8 /package/kernel/mac80211/patches/357-0003-brcmfmac-move-pno-helper-functions-in-separate-sourc.patch
parent4e611ac5dfe16bde1741ab76b1cd5d7d97bf9f1e (diff)
downloadupstream-863a06b0a4ed3939d81fb49d3b8a88db9e807d41.tar.gz
upstream-863a06b0a4ed3939d81fb49d3b8a88db9e807d41.tar.bz2
upstream-863a06b0a4ed3939d81fb49d3b8a88db9e807d41.zip
mac80211: brcmfmac: backport scheduled scan cleanup and chip support
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Diffstat (limited to 'package/kernel/mac80211/patches/357-0003-brcmfmac-move-pno-helper-functions-in-separate-sourc.patch')
-rw-r--r--package/kernel/mac80211/patches/357-0003-brcmfmac-move-pno-helper-functions-in-separate-sourc.patch319
1 files changed, 319 insertions, 0 deletions
diff --git a/package/kernel/mac80211/patches/357-0003-brcmfmac-move-pno-helper-functions-in-separate-sourc.patch b/package/kernel/mac80211/patches/357-0003-brcmfmac-move-pno-helper-functions-in-separate-sourc.patch
new file mode 100644
index 0000000000..94f2e6b972
--- /dev/null
+++ b/package/kernel/mac80211/patches/357-0003-brcmfmac-move-pno-helper-functions-in-separate-sourc.patch
@@ -0,0 +1,319 @@
+From ac55136f43d3336c7b40238b779c404008229929 Mon Sep 17 00:00:00 2001
+From: Arend Van Spriel <arend.vanspriel@broadcom.com>
+Date: Wed, 23 Nov 2016 10:25:22 +0000
+Subject: [PATCH] brcmfmac: move pno helper functions in separate source file
+
+Introducing new source file for pno related functionality. Moving
+existing pno functions.
+
+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>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+---
+ .../wireless/broadcom/brcm80211/brcmfmac/Makefile | 3 +-
+ .../broadcom/brcm80211/brcmfmac/cfg80211.c | 93 ++-----------------
+ .../net/wireless/broadcom/brcm80211/brcmfmac/pno.c | 100 +++++++++++++++++++++
+ .../net/wireless/broadcom/brcm80211/brcmfmac/pno.h | 40 +++++++++
+ 4 files changed, 150 insertions(+), 86 deletions(-)
+ create mode 100644 drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c
+ create mode 100644 drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.h
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Makefile
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Makefile
+@@ -35,7 +35,8 @@ brcmfmac-objs += \
+ firmware.o \
+ feature.o \
+ btcoex.o \
+- vendor.o
++ vendor.o \
++ pno.o
+ brcmfmac-$(CPTCFG_BRCMFMAC_PROTO_BCDC) += \
+ bcdc.o
+ brcmfmac-$(CPTCFG_BRCMFMAC_PROTO_MSGBUF) += \
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+@@ -32,6 +32,7 @@
+ #include "fwil_types.h"
+ #include "p2p.h"
+ #include "btcoex.h"
++#include "pno.h"
+ #include "cfg80211.h"
+ #include "feature.h"
+ #include "fwil.h"
+@@ -41,16 +42,6 @@
+ #include "common.h"
+
+ #define BRCMF_SCAN_IE_LEN_MAX 2048
+-#define BRCMF_PNO_VERSION 2
+-#define BRCMF_PNO_TIME 30
+-#define BRCMF_PNO_REPEAT 4
+-#define BRCMF_PNO_FREQ_EXPO_MAX 3
+-#define BRCMF_PNO_MAX_PFN_COUNT 16
+-#define BRCMF_PNO_ENABLE_ADAPTSCAN_BIT 6
+-#define BRCMF_PNO_HIDDEN_BIT 2
+-#define BRCMF_PNO_WPA_AUTH_ANY 0xFFFFFFFF
+-#define BRCMF_PNO_SCAN_COMPLETE 1
+-#define BRCMF_PNO_SCAN_INCOMPLETE 0
+
+ #define WPA_OUI "\x00\x50\xF2" /* WPA OUI */
+ #define WPA_OUI_TYPE 1
+@@ -3323,76 +3314,6 @@ out_err:
+ return err;
+ }
+
+-static int brcmf_dev_pno_clean(struct net_device *ndev)
+-{
+- int ret;
+-
+- /* Disable pfn */
+- ret = brcmf_fil_iovar_int_set(netdev_priv(ndev), "pfn", 0);
+- if (ret == 0) {
+- /* clear pfn */
+- ret = brcmf_fil_iovar_data_set(netdev_priv(ndev), "pfnclear",
+- NULL, 0);
+- }
+- if (ret < 0)
+- brcmf_err("failed code %d\n", ret);
+-
+- return ret;
+-}
+-
+-static int brcmf_dev_pno_config(struct brcmf_if *ifp,
+- struct cfg80211_sched_scan_request *request)
+-{
+- struct brcmf_pno_param_le pfn_param;
+- struct brcmf_pno_macaddr_le pfn_mac;
+- s32 err;
+- u8 *mac_mask;
+- int i;
+-
+- memset(&pfn_param, 0, sizeof(pfn_param));
+- pfn_param.version = cpu_to_le32(BRCMF_PNO_VERSION);
+-
+- /* set extra pno params */
+- pfn_param.flags = cpu_to_le16(1 << BRCMF_PNO_ENABLE_ADAPTSCAN_BIT);
+- pfn_param.repeat = BRCMF_PNO_REPEAT;
+- pfn_param.exp = BRCMF_PNO_FREQ_EXPO_MAX;
+-
+- /* set up pno scan fr */
+- pfn_param.scan_freq = cpu_to_le32(BRCMF_PNO_TIME);
+-
+- err = brcmf_fil_iovar_data_set(ifp, "pfn_set", &pfn_param,
+- sizeof(pfn_param));
+- if (err) {
+- brcmf_err("pfn_set failed, err=%d\n", err);
+- return err;
+- }
+-
+- /* Find out if mac randomization should be turned on */
+- if (!(request->flags & NL80211_SCAN_FLAG_RANDOM_ADDR))
+- return 0;
+-
+- pfn_mac.version = BRCMF_PFN_MACADDR_CFG_VER;
+- pfn_mac.flags = BRCMF_PFN_MAC_OUI_ONLY | BRCMF_PFN_SET_MAC_UNASSOC;
+-
+- memcpy(pfn_mac.mac, request->mac_addr, ETH_ALEN);
+- mac_mask = request->mac_addr_mask;
+- for (i = 0; i < ETH_ALEN; i++) {
+- pfn_mac.mac[i] &= mac_mask[i];
+- pfn_mac.mac[i] |= get_random_int() & ~(mac_mask[i]);
+- }
+- /* Clear multi bit */
+- pfn_mac.mac[0] &= 0xFE;
+- /* Set locally administered */
+- pfn_mac.mac[0] |= 0x02;
+-
+- err = brcmf_fil_iovar_data_set(ifp, "pfn_macaddr", &pfn_mac,
+- sizeof(pfn_mac));
+- if (err)
+- brcmf_err("pfn_macaddr failed, err=%d\n", err);
+-
+- return err;
+-}
+-
+ static int
+ brcmf_cfg80211_sched_scan_start(struct wiphy *wiphy,
+ struct net_device *ndev,
+@@ -3436,15 +3357,16 @@ brcmf_cfg80211_sched_scan_start(struct w
+
+ if (request->n_match_sets > 0) {
+ /* clean up everything */
+- ret = brcmf_dev_pno_clean(ndev);
++ ret = brcmf_pno_clean(ifp);
+ if (ret < 0) {
+ brcmf_err("failed error=%d\n", ret);
+ return ret;
+ }
+
+ /* configure pno */
+- if (brcmf_dev_pno_config(ifp, request))
+- return -EINVAL;
++ ret = brcmf_pno_config(ifp, request);
++ if (ret < 0)
++ return ret;
+
+ /* configure each match set */
+ for (i = 0; i < request->n_match_sets; i++) {
+@@ -3486,11 +3408,12 @@ static int brcmf_cfg80211_sched_scan_sto
+ struct net_device *ndev)
+ {
+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
++ struct brcmf_if *ifp = netdev_priv(ndev);
+
+ brcmf_dbg(SCAN, "enter\n");
+- brcmf_dev_pno_clean(ndev);
++ brcmf_pno_clean(ifp);
+ if (cfg->sched_escan)
+- brcmf_notify_escan_complete(cfg, netdev_priv(ndev), true, true);
++ brcmf_notify_escan_complete(cfg, ifp, true, true);
+ return 0;
+ }
+
+--- /dev/null
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c
+@@ -0,0 +1,100 @@
++/*
++ * Copyright (c) 2016 Broadcom
++ *
++ * Permission to use, copy, modify, and/or distribute this software for any
++ * purpose with or without fee is hereby granted, provided that the above
++ * copyright notice and this permission notice appear in all copies.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
++ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
++ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
++ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
++ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
++ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
++ */
++#include <linux/netdevice.h>
++#include <net/cfg80211.h>
++
++#include "core.h"
++#include "debug.h"
++#include "pno.h"
++#include "fwil.h"
++#include "fwil_types.h"
++
++#define BRCMF_PNO_VERSION 2
++#define BRCMF_PNO_TIME 30
++#define BRCMF_PNO_REPEAT 4
++#define BRCMF_PNO_FREQ_EXPO_MAX 3
++#define BRCMF_PNO_ENABLE_ADAPTSCAN_BIT 6
++#define BRCMF_PNO_SCAN_INCOMPLETE 0
++
++int brcmf_pno_clean(struct brcmf_if *ifp)
++{
++ int ret;
++
++ /* Disable pfn */
++ ret = brcmf_fil_iovar_int_set(ifp, "pfn", 0);
++ if (ret == 0) {
++ /* clear pfn */
++ ret = brcmf_fil_iovar_data_set(ifp, "pfnclear", NULL, 0);
++ }
++ if (ret < 0)
++ brcmf_err("failed code %d\n", ret);
++
++ return ret;
++}
++
++int brcmf_pno_config(struct brcmf_if *ifp,
++ struct cfg80211_sched_scan_request *request)
++{
++ struct brcmf_pno_param_le pfn_param;
++ struct brcmf_pno_macaddr_le pfn_mac;
++ s32 err;
++ u8 *mac_mask;
++ int i;
++
++ memset(&pfn_param, 0, sizeof(pfn_param));
++ pfn_param.version = cpu_to_le32(BRCMF_PNO_VERSION);
++
++ /* set extra pno params */
++ pfn_param.flags = cpu_to_le16(1 << BRCMF_PNO_ENABLE_ADAPTSCAN_BIT);
++ pfn_param.repeat = BRCMF_PNO_REPEAT;
++ pfn_param.exp = BRCMF_PNO_FREQ_EXPO_MAX;
++
++ /* set up pno scan fr */
++ pfn_param.scan_freq = cpu_to_le32(BRCMF_PNO_TIME);
++
++ err = brcmf_fil_iovar_data_set(ifp, "pfn_set", &pfn_param,
++ sizeof(pfn_param));
++ if (err) {
++ brcmf_err("pfn_set failed, err=%d\n", err);
++ return err;
++ }
++
++ /* Find out if mac randomization should be turned on */
++ if (!(request->flags & NL80211_SCAN_FLAG_RANDOM_ADDR))
++ return 0;
++
++ pfn_mac.version = BRCMF_PFN_MACADDR_CFG_VER;
++ pfn_mac.flags = BRCMF_PFN_MAC_OUI_ONLY | BRCMF_PFN_SET_MAC_UNASSOC;
++
++ memcpy(pfn_mac.mac, request->mac_addr, ETH_ALEN);
++ mac_mask = request->mac_addr_mask;
++ for (i = 0; i < ETH_ALEN; i++) {
++ pfn_mac.mac[i] &= mac_mask[i];
++ pfn_mac.mac[i] |= get_random_int() & ~(mac_mask[i]);
++ }
++ /* Clear multi bit */
++ pfn_mac.mac[0] &= 0xFE;
++ /* Set locally administered */
++ pfn_mac.mac[0] |= 0x02;
++
++ err = brcmf_fil_iovar_data_set(ifp, "pfn_macaddr", &pfn_mac,
++ sizeof(pfn_mac));
++ if (err)
++ brcmf_err("pfn_macaddr failed, err=%d\n", err);
++
++ return err;
++}
++
+--- /dev/null
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.h
+@@ -0,0 +1,40 @@
++/*
++ * Copyright (c) 2016 Broadcom
++ *
++ * Permission to use, copy, modify, and/or distribute this software for any
++ * purpose with or without fee is hereby granted, provided that the above
++ * copyright notice and this permission notice appear in all copies.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
++ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
++ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
++ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
++ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
++ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
++ */
++#ifndef _BRCMF_PNO_H
++#define _BRCMF_PNO_H
++
++#define BRCMF_PNO_SCAN_COMPLETE 1
++#define BRCMF_PNO_WPA_AUTH_ANY 0xFFFFFFFF
++#define BRCMF_PNO_HIDDEN_BIT 2
++#define BRCMF_PNO_MAX_PFN_COUNT 16
++
++/**
++ * brcmf_pno_clean - disable and clear pno in firmware.
++ *
++ * @ifp: interface object used.
++ */
++int brcmf_pno_clean(struct brcmf_if *ifp);
++
++/**
++ * brcmf_pno_config - configure pno parameters.
++ *
++ * @ifp: interface object used.
++ * @request: scheduled scan parameters.
++ */
++int brcmf_pno_config(struct brcmf_if *ifp,
++ struct cfg80211_sched_scan_request *request);
++
++#endif /* _BRCMF_PNO_H */