PKG_NAME:=mac80211
-PKG_VERSION:=5.0.5-1
+PKG_VERSION:=5.1-rc2-1
PKG_RELEASE:=1
-PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.0.5/
-PKG_HASH:=9fe6eeaf2043a6eadbc5a13277b0ac62905451af55d7afaa6ac2d91a3aa8c298
+PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.1-rc2/
+PKG_HASH:=bb65aeb3da1563e18238a6e9aa84f12e82bd477d8404ad4525bc305d4ce1e241
PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/backports-$(PKG_VERSION)
ath10k_core-$(CONFIG_DEV_COREDUMP) += coredump.o
--- a/drivers/net/wireless/ath/ath10k/thermal.h
+++ b/drivers/net/wireless/ath/ath10k/thermal.h
-@@ -36,7 +36,7 @@ struct ath10k_thermal {
+@@ -25,7 +25,7 @@ struct ath10k_thermal {
int temperature;
};
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
-@@ -2993,6 +2993,8 @@ void regulatory_hint_country_ie(struct w
+@@ -3002,6 +3002,8 @@ void regulatory_hint_country_ie(struct w
enum environment_cap env = ENVIRON_ANY;
struct regulatory_request *request = NULL, *lr;
/* IE len must be evenly divisible by 2 */
if (country_ie_len & 0x01)
return;
-@@ -3218,6 +3220,7 @@ static bool is_wiphy_all_set_reg_flag(en
+@@ -3253,6 +3255,7 @@ static bool is_wiphy_all_set_reg_flag(en
void regulatory_hint_disconnect(void)
{
{CTRY_UNITED_KINGDOM, ETSI1_WORLD, "GB"},
{CTRY_UNITED_STATES, FCC3_FCCA, "US"},
+ {CTRY_UNITED_STATES, FCC3_FCCA_2, "US"},
+ {CTRY_UNITED_STATES2, FCC3_FCCA, "US"},
+ {CTRY_UNITED_STATES3, FCC3_FCCA, "US"},
/* This "PS" is for US public safety actually... to support this we
- * would need to assign new special alpha2 to CRDA db as with the world
- * regdomain and use another alpha2 */
+++ /dev/null
-From: Oever Gonzalez <notengobattery@gmail.com>
-Date: Mon, 7 Jan 2019 01:07:12 +0200
-Subject: [PATCH] ath: regd: add extra coutry codes
-
-This patch adds several country codes to the regd.h and regd_common.h
-files in order to support devices whose country codes are not present in
-the original list. Without this patch, all devices whose manufacturer
-programmed any of these code in their EEPROM will not work.
-
-Signed-off-by: Oever Gonzalez <notengobattery@gmail.com>
----
-
---- a/drivers/net/wireless/ath/regd.h
-+++ b/drivers/net/wireless/ath/regd.h
-@@ -185,7 +185,9 @@ enum CountryCode {
- CTRY_UKRAINE = 804,
- CTRY_UNITED_KINGDOM = 826,
- CTRY_UNITED_STATES = 840,
-+ CTRY_UNITED_STATES2 = 841,
- CTRY_UNITED_STATES_FCC49 = 842,
-+ CTRY_UNITED_STATES3 = 843,
- CTRY_URUGUAY = 858,
- CTRY_UZBEKISTAN = 860,
- CTRY_VENEZUELA = 862,
---- a/drivers/net/wireless/ath/regd_common.h
-+++ b/drivers/net/wireless/ath/regd_common.h
-@@ -486,6 +486,8 @@ static struct country_code_to_enum_rd al
- {CTRY_UNITED_KINGDOM, ETSI1_WORLD, "GB"},
- {CTRY_UNITED_STATES, FCC3_FCCA, "US"},
- {CTRY_UNITED_STATES, FCC3_FCCA_2, "US"},
-+ {CTRY_UNITED_STATES2, FCC3_FCCA, "US"},
-+ {CTRY_UNITED_STATES3, FCC3_FCCA, "US"},
- /* This "PS" is for US public safety actually... to support this we
- * would need to assign new special alpha2 to CRDA db as with the world
- * regdomain and use another alpha2 */
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -833,6 +833,7 @@ static const struct ieee80211_iface_limi
+@@ -831,6 +831,7 @@ static const struct ieee80211_iface_limi
BIT(NL80211_IFTYPE_AP) },
{ .max = 1, .types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
BIT(NL80211_IFTYPE_P2P_GO) },
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -1144,25 +1144,25 @@ static int __init ath9k_init(void)
+@@ -1143,25 +1143,25 @@ static int __init ath9k_init(void)
{
int error;
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
-@@ -850,6 +850,9 @@ static inline int ath9k_dump_btcoex(stru
+@@ -843,6 +843,9 @@ static inline int ath9k_dump_btcoex(stru
#ifdef CPTCFG_MAC80211_LEDS
void ath_init_leds(struct ath_softc *sc);
void ath_deinit_leds(struct ath_softc *sc);
#else
static inline void ath_init_leds(struct ath_softc *sc)
{
-@@ -991,6 +994,13 @@ void ath_ant_comb_scan(struct ath_softc
- #define AIRTIME_USE_NEW_QUEUES BIT(2)
- #define AIRTIME_ACTIVE(flags) (!!(flags & (AIRTIME_USE_TX|AIRTIME_USE_RX)))
+@@ -979,6 +982,13 @@ void ath_ant_comb_scan(struct ath_softc
+
+ #define ATH9K_NUM_CHANCTX 2 /* supports 2 operating channels */
+struct ath_led {
+ struct list_head list;
struct ath_softc {
struct ieee80211_hw *hw;
struct device *dev;
-@@ -1046,9 +1056,8 @@ struct ath_softc {
+@@ -1032,9 +1042,8 @@ struct ath_softc {
spinlock_t chan_lock;
#ifdef CPTCFG_MAC80211_LEDS
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -1056,7 +1056,7 @@ int ath9k_init_device(u16 devid, struct
+@@ -1055,7 +1055,7 @@ int ath9k_init_device(u16 devid, struct
#ifdef CPTCFG_MAC80211_LEDS
/* must be initialized before ieee80211_register_hw */
ops->spectral_scan_config = ar9003_hw_spectral_scan_config;
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -821,7 +821,8 @@ static void ath9k_init_txpower_limits(st
+@@ -819,7 +819,8 @@ static void ath9k_init_txpower_limits(st
if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
ath9k_init_band_txpower(sc, NL80211_BAND_5GHZ);
}
static const struct ieee80211_iface_limit if_limits[] = {
-@@ -1016,6 +1017,18 @@ static void ath9k_set_hw_capab(struct at
- wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST);
+@@ -1015,6 +1016,18 @@ static void ath9k_set_hw_capab(struct at
+ wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_AIRTIME_FAIRNESS);
}
+static void ath_get_initial_entropy(struct ath_softc *sc)
int ath9k_init_device(u16 devid, struct ath_softc *sc,
const struct ath_bus_ops *bus_ops)
{
-@@ -1061,6 +1074,8 @@ int ath9k_init_device(u16 devid, struct
+@@ -1060,6 +1073,8 @@ int ath9k_init_device(u16 devid, struct
ARRAY_SIZE(ath9k_tpt_blink));
#endif
#include "common.h"
#include "debug.h"
-@@ -1001,6 +1002,14 @@ struct ath_led {
+@@ -989,6 +990,14 @@ struct ath_led {
struct led_classdev cdev;
};
struct ath_softc {
struct ieee80211_hw *hw;
struct device *dev;
-@@ -1058,6 +1067,9 @@ struct ath_softc {
+@@ -1044,6 +1053,9 @@ struct ath_softc {
#ifdef CPTCFG_MAC80211_LEDS
const char *led_default_trigger;
struct list_head leds;
---
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
-@@ -1069,6 +1069,7 @@ struct ath_softc {
+@@ -1055,6 +1055,7 @@ struct ath_softc {
struct list_head leds;
#ifdef CONFIG_GPIOLIB
struct ath9k_gpio_chip *gpiochip;
#include "common.h"
#include "debug.h"
-@@ -1023,6 +1024,9 @@ struct ath_softc {
+@@ -1011,6 +1012,9 @@ struct ath_softc {
struct ath_hw *sc_ah;
void __iomem *mem;
int irq;
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
-@@ -2981,6 +2981,16 @@ int ath10k_core_register(struct ath10k *
- ar->dev_type = bus_params->dev_type;
+@@ -3003,6 +3003,16 @@ int ath10k_core_register(struct ath10k *
+
queue_work(ar->workqueue, &ar->register_work);
+ /* OpenWrt requires all PHYs to be initialized to create the
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
-@@ -8414,6 +8414,21 @@ static int ath10k_mac_init_rd(struct ath
+@@ -8483,6 +8483,21 @@ static int ath10k_mac_init_rd(struct ath
return 0;
}
int ath10k_mac_register(struct ath10k *ar)
{
static const u32 cipher_suites[] = {
-@@ -8726,6 +8741,12 @@ int ath10k_mac_register(struct ath10k *a
+@@ -8806,6 +8821,12 @@ int ath10k_mac_register(struct ath10k *a
- wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST);
+ ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER;
+#ifdef CPTCFG_MAC80211_LEDS
+ ieee80211_create_tpt_led_trigger(ar->hw,
--- a/drivers/net/wireless/ath/ath10k/htt.h
+++ b/drivers/net/wireless/ath/ath10k/htt.h
-@@ -237,7 +237,7 @@ enum htt_rx_ring_flags {
+@@ -226,7 +226,7 @@ enum htt_rx_ring_flags {
};
#define HTT_RX_RING_SIZE_MIN 128
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
-@@ -142,7 +142,7 @@ static struct ce_attr host_ce_config_wla
+@@ -131,7 +131,7 @@ static struct ce_attr host_ce_config_wla
.flags = CE_ATTR_FLAGS,
.src_nentries = 0,
.src_sz_max = 2048,
.recv_cb = ath10k_pci_htt_htc_rx_cb,
},
-@@ -151,7 +151,7 @@ static struct ce_attr host_ce_config_wla
+@@ -140,7 +140,7 @@ static struct ce_attr host_ce_config_wla
.flags = CE_ATTR_FLAGS,
.src_nentries = 0,
.src_sz_max = 2048,
.recv_cb = ath10k_pci_htc_rx_cb,
},
-@@ -178,7 +178,7 @@ static struct ce_attr host_ce_config_wla
+@@ -167,7 +167,7 @@ static struct ce_attr host_ce_config_wla
.flags = CE_ATTR_FLAGS,
.src_nentries = 0,
.src_sz_max = 512,
.recv_cb = ath10k_pci_htt_rx_cb,
},
-@@ -203,7 +203,7 @@ static struct ce_attr host_ce_config_wla
+@@ -192,7 +192,7 @@ static struct ce_attr host_ce_config_wla
.flags = CE_ATTR_FLAGS,
.src_nentries = 0,
.src_sz_max = 2048,
3 files changed, 52 insertions(+), 23 deletions(-)
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
-@@ -2486,7 +2486,7 @@ static void ath10k_peer_assoc_h_vht(stru
+@@ -2475,7 +2475,7 @@ static void ath10k_peer_assoc_h_vht(stru
const u16 *vht_mcs_mask;
u8 ampdu_factor;
u8 max_nss, vht_mcs;
if (WARN_ON(ath10k_mac_vif_chan(vif, &def)))
return;
-@@ -2546,23 +2546,45 @@ static void ath10k_peer_assoc_h_vht(stru
+@@ -2535,23 +2535,45 @@ static void ath10k_peer_assoc_h_vht(stru
__le16_to_cpu(vht_cap->vht_mcs.tx_highest);
arg->peer_vht_rates.tx_mcs_set = ath10k_peer_assoc_h_vht_limit(
__le16_to_cpu(vht_cap->vht_mcs.tx_mcs_map), vht_mcs_mask);
}
static void ath10k_peer_assoc_h_qos(struct ath10k *ar,
-@@ -2714,9 +2736,9 @@ static int ath10k_peer_assoc_prepare(str
+@@ -2703,9 +2725,9 @@ static int ath10k_peer_assoc_prepare(str
ath10k_peer_assoc_h_crypto(ar, vif, sta, arg);
ath10k_peer_assoc_h_rates(ar, vif, sta, arg);
ath10k_peer_assoc_h_ht(ar, vif, sta, arg);
}
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
-@@ -7475,12 +7475,7 @@ ath10k_wmi_peer_assoc_fill_10_4(struct a
+@@ -7552,12 +7552,7 @@ ath10k_wmi_peer_assoc_fill_10_4(struct a
struct wmi_10_4_peer_assoc_complete_cmd *cmd = buf;
ath10k_wmi_peer_assoc_fill_10_2(ar, buf, arg);
static int
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
-@@ -6417,7 +6417,19 @@ struct wmi_10_2_peer_assoc_complete_cmd
+@@ -6468,7 +6468,19 @@ struct wmi_10_2_peer_assoc_complete_cmd
__le32 info0; /* WMI_PEER_ASSOC_INFO0_ */
} __packed;
2 files changed, 8 insertions(+), 10 deletions(-)
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
-@@ -4490,13 +4490,6 @@ static struct ieee80211_sta_vht_cap ath1
+@@ -4533,13 +4533,6 @@ static struct ieee80211_sta_vht_cap ath1
vht_cap.cap |= val;
}
if ((i < ar->num_rf_chains) && (ar->cfg_tx_chainmask & BIT(i)))
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
-@@ -1683,13 +1683,18 @@ void ath10k_wmi_put_wmi_channel(struct w
+@@ -1700,13 +1700,18 @@ void ath10k_wmi_put_wmi_channel(struct w
flags |= WMI_CHAN_FLAG_HT40_PLUS;
if (arg->chan_radar)
flags |= WMI_CHAN_FLAG_DFS;
WCN36XX=
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
-@@ -35,6 +35,7 @@
+@@ -24,6 +24,7 @@
#include "testmode.h"
#include "wmi-ops.h"
#include "coredump.h"
unsigned int ath10k_debug_mask;
static unsigned int ath10k_cryptmode_param;
-@@ -66,6 +67,7 @@ static const struct ath10k_hw_params ath
+@@ -55,6 +56,7 @@ static const struct ath10k_hw_params ath
.dev_id = QCA988X_2_0_DEVICE_ID,
.bus = ATH10K_BUS_PCI,
.name = "qca988x hw2.0",
.patch_load_addr = QCA988X_HW_2_0_PATCH_LOAD_ADDR,
.uart_pin = 7,
.cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL,
-@@ -134,6 +136,7 @@ static const struct ath10k_hw_params ath
+@@ -123,6 +125,7 @@ static const struct ath10k_hw_params ath
.dev_id = QCA9887_1_0_DEVICE_ID,
.bus = ATH10K_BUS_PCI,
.name = "qca9887 hw1.0",
.patch_load_addr = QCA9887_HW_1_0_PATCH_LOAD_ADDR,
.uart_pin = 7,
.cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL,
-@@ -308,6 +311,7 @@ static const struct ath10k_hw_params ath
+@@ -297,6 +300,7 @@ static const struct ath10k_hw_params ath
.dev_id = QCA99X0_2_0_DEVICE_ID,
.bus = ATH10K_BUS_PCI,
.name = "qca99x0 hw2.0",
.patch_load_addr = QCA99X0_HW_2_0_PATCH_LOAD_ADDR,
.uart_pin = 7,
.otp_exe_param = 0x00000700,
-@@ -348,6 +352,7 @@ static const struct ath10k_hw_params ath
+@@ -337,6 +341,7 @@ static const struct ath10k_hw_params ath
.dev_id = QCA9984_1_0_DEVICE_ID,
.bus = ATH10K_BUS_PCI,
.name = "qca9984/qca9994 hw1.0",
.patch_load_addr = QCA9984_HW_1_0_PATCH_LOAD_ADDR,
.uart_pin = 7,
.cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH,
-@@ -395,6 +400,7 @@ static const struct ath10k_hw_params ath
+@@ -384,6 +389,7 @@ static const struct ath10k_hw_params ath
.dev_id = QCA9888_2_0_DEVICE_ID,
.bus = ATH10K_BUS_PCI,
.name = "qca9888 hw2.0",
.patch_load_addr = QCA9888_HW_2_0_PATCH_LOAD_ADDR,
.uart_pin = 7,
.cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH,
-@@ -2698,6 +2704,10 @@ int ath10k_core_start(struct ath10k *ar,
+@@ -2720,6 +2726,10 @@ int ath10k_core_start(struct ath10k *ar,
if (status)
goto err_hif_stop;
return 0;
err_hif_stop:
-@@ -2954,9 +2964,18 @@ static void ath10k_core_register_work(st
+@@ -2976,9 +2986,18 @@ static void ath10k_core_register_work(st
goto err_spectral_destroy;
}
err_spectral_destroy:
ath10k_spectral_destroy(ar);
err_debug_destroy:
-@@ -3002,6 +3021,8 @@ void ath10k_core_unregister(struct ath10
+@@ -3024,6 +3043,8 @@ void ath10k_core_unregister(struct ath10
if (!test_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags))
return;
* relayfs debugfs file cleanly. Otherwise the parent debugfs tree
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
-@@ -25,6 +25,7 @@
+@@ -14,6 +14,7 @@
#include <linux/pci.h>
#include <linux/uuid.h>
#include <linux/time.h>
#include "htt.h"
#include "htc.h"
-@@ -1153,6 +1154,13 @@ struct ath10k {
+@@ -1147,6 +1148,13 @@ struct ath10k {
} testmode;
struct {
u32 fw_warm_reset_counter;
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
-@@ -520,6 +520,7 @@ struct ath10k_hw_params {
+@@ -511,6 +511,7 @@ struct ath10k_hw_params {
const char *name;
u32 patch_load_addr;
int uart_pin;
+#endif /* _LEDS_H_ */
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
-@@ -34,6 +34,7 @@
+@@ -23,6 +23,7 @@
#include "wmi-tlv.h"
#include "wmi-ops.h"
#include "wow.h"
/* Rates */
--- a/drivers/net/wireless/ath/ath10k/wmi-ops.h
+++ b/drivers/net/wireless/ath/ath10k/wmi-ops.h
-@@ -222,7 +222,10 @@ struct wmi_ops {
+@@ -216,7 +216,10 @@ struct wmi_ops {
struct sk_buff *(*gen_bb_timing)
(struct ath10k *ar,
const struct wmi_bb_timing_cfg_arg *arg);
};
int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, u32 cmd_id);
-@@ -1060,6 +1063,35 @@ ath10k_wmi_force_fw_hang(struct ath10k *
+@@ -1080,6 +1083,35 @@ ath10k_wmi_force_fw_hang(struct ath10k *
return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->force_fw_hang_cmdid);
}
{
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
-@@ -4168,6 +4168,8 @@ static const struct wmi_ops wmi_tlv_ops
+@@ -4309,6 +4309,8 @@ static const struct wmi_ops wmi_tlv_ops
.gen_echo = ath10k_wmi_tlv_op_gen_echo,
.gen_vdev_spectral_conf = ath10k_wmi_tlv_op_gen_vdev_spectral_conf,
.gen_vdev_spectral_enable = ath10k_wmi_tlv_op_gen_vdev_spectral_enable,
static const struct wmi_peer_flags_map wmi_tlv_peer_flags_map = {
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
-@@ -7295,6 +7295,49 @@ ath10k_wmi_op_gen_peer_set_param(struct
+@@ -7372,6 +7372,49 @@ ath10k_wmi_op_gen_peer_set_param(struct
return skb;
}
static struct sk_buff *
ath10k_wmi_op_gen_set_psmode(struct ath10k *ar, u32 vdev_id,
enum wmi_sta_ps_mode psmode)
-@@ -8927,6 +8970,9 @@ static const struct wmi_ops wmi_ops = {
+@@ -9004,6 +9047,9 @@ static const struct wmi_ops wmi_ops = {
.fw_stats_fill = ath10k_wmi_main_op_fw_stats_fill,
.get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype,
.gen_echo = ath10k_wmi_op_gen_echo,
/* .gen_bcn_tmpl not implemented */
/* .gen_prb_tmpl not implemented */
/* .gen_p2p_go_bcn_ie not implemented */
-@@ -8997,6 +9043,8 @@ static const struct wmi_ops wmi_10_1_ops
+@@ -9074,6 +9120,8 @@ static const struct wmi_ops wmi_10_1_ops
.fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill,
.get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype,
.gen_echo = ath10k_wmi_op_gen_echo,
/* .gen_bcn_tmpl not implemented */
/* .gen_prb_tmpl not implemented */
/* .gen_p2p_go_bcn_ie not implemented */
-@@ -9068,6 +9116,8 @@ static const struct wmi_ops wmi_10_2_ops
+@@ -9146,6 +9194,8 @@ static const struct wmi_ops wmi_10_2_ops
.gen_delba_send = ath10k_wmi_op_gen_delba_send,
.fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill,
.get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype,
/* .gen_pdev_enable_adaptive_cca not implemented */
};
-@@ -9139,6 +9189,8 @@ static const struct wmi_ops wmi_10_2_4_o
+@@ -9217,6 +9267,8 @@ static const struct wmi_ops wmi_10_2_4_o
ath10k_wmi_op_gen_pdev_enable_adaptive_cca,
.get_vdev_subtype = ath10k_wmi_10_2_4_op_get_vdev_subtype,
.gen_bb_timing = ath10k_wmi_10_2_4_op_gen_bb_timing,
/* .gen_bcn_tmpl not implemented */
/* .gen_prb_tmpl not implemented */
/* .gen_p2p_go_bcn_ie not implemented */
-@@ -9218,6 +9270,8 @@ static const struct wmi_ops wmi_10_4_ops
+@@ -9297,6 +9349,8 @@ static const struct wmi_ops wmi_10_4_ops
.gen_pdev_bss_chan_info_req = ath10k_wmi_10_2_op_gen_pdev_bss_chan_info,
.gen_echo = ath10k_wmi_op_gen_echo,
.gen_pdev_get_tpc_config = ath10k_wmi_10_2_4_op_gen_pdev_get_tpc_config,
int ath10k_wmi_attach(struct ath10k *ar)
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
-@@ -2975,6 +2975,41 @@ enum wmi_10_4_feature_mask {
+@@ -2998,6 +2998,41 @@ enum wmi_10_4_feature_mask {
};
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
-@@ -1199,6 +1199,10 @@ struct ath10k {
- struct ath10k_radar_found_info last_radar_info;
+@@ -1195,6 +1195,10 @@ struct ath10k {
struct work_struct radar_confirmation_work;
+ struct ath10k_bus_params bus_param;
+#ifdef CPTCFG_MAC80211_LEDS
+ const char *led_default_trigger;
if (ret)
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
-@@ -8758,7 +8758,7 @@ int ath10k_mac_register(struct ath10k *a
- wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST);
+@@ -8838,7 +8838,7 @@ int ath10k_mac_register(struct ath10k *a
+ ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER;
#ifdef CPTCFG_MAC80211_LEDS
- ieee80211_create_tpt_led_trigger(ar->hw,
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
-@@ -5549,8 +5549,8 @@ static void ath10k_bss_info_changed(stru
+@@ -5604,8 +5604,8 @@ static void ath10k_bss_info_changed(stru
struct cfg80211_chan_def def;
u32 vdev_param, pdev_param, slottime, preamble;
u16 bitrate, hw_value;
enum nl80211_band band;
const struct ieee80211_supported_band *sband;
-@@ -5723,7 +5723,11 @@ static void ath10k_bss_info_changed(stru
+@@ -5792,7 +5792,11 @@ static void ath10k_bss_info_changed(stru
if (changed & BSS_CHANGED_MCAST_RATE &&
!WARN_ON(ath10k_mac_vif_chan(arvif->vif, &def))) {
band = def.chan->band;
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
-@@ -1020,7 +1020,7 @@ static int ath10k_monitor_vdev_start(str
+@@ -1009,7 +1009,7 @@ static int ath10k_monitor_vdev_start(str
arg.channel.min_power = 0;
arg.channel.max_power = channel->max_power * 2;
arg.channel.max_reg_power = channel->max_reg_power * 2;
reinit_completion(&ar->vdev_setup_done);
-@@ -1462,7 +1462,7 @@ static int ath10k_vdev_start_restart(str
+@@ -1451,7 +1451,7 @@ static int ath10k_vdev_start_restart(str
arg.channel.min_power = 0;
arg.channel.max_power = chandef->chan->max_power * 2;
arg.channel.max_reg_power = chandef->chan->max_reg_power * 2;
if (arvif->vdev_type == WMI_VDEV_TYPE_AP) {
arg.ssid = arvif->u.ap.ssid;
-@@ -3139,7 +3139,7 @@ static int ath10k_update_channel_list(st
+@@ -3128,7 +3128,7 @@ static int ath10k_update_channel_list(st
ch->min_power = 0;
ch->max_power = channel->max_power * 2;
ch->max_reg_power = channel->max_reg_power * 2;
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
-@@ -988,6 +988,40 @@ static inline int ath10k_vdev_setup_sync
+@@ -977,6 +977,40 @@ static inline int ath10k_vdev_setup_sync
return ar->last_wmi_vdev_start_status;
}
static int ath10k_monitor_vdev_start(struct ath10k *ar, int vdev_id)
{
struct cfg80211_chan_def *chandef = NULL;
-@@ -1020,7 +1054,8 @@ static int ath10k_monitor_vdev_start(str
+@@ -1009,7 +1043,8 @@ static int ath10k_monitor_vdev_start(str
arg.channel.min_power = 0;
arg.channel.max_power = channel->max_power * 2;
arg.channel.max_reg_power = channel->max_reg_power * 2;
reinit_completion(&ar->vdev_setup_done);
-@@ -1462,7 +1497,8 @@ static int ath10k_vdev_start_restart(str
+@@ -1451,7 +1486,8 @@ static int ath10k_vdev_start_restart(str
arg.channel.min_power = 0;
arg.channel.max_power = chandef->chan->max_power * 2;
arg.channel.max_reg_power = chandef->chan->max_reg_power * 2;
if (arvif->vdev_type == WMI_VDEV_TYPE_AP) {
arg.ssid = arvif->u.ap.ssid;
-@@ -3139,7 +3175,8 @@ static int ath10k_update_channel_list(st
+@@ -3128,7 +3164,8 @@ static int ath10k_update_channel_list(st
ch->min_power = 0;
ch->max_power = channel->max_power * 2;
ch->max_reg_power = channel->max_reg_power * 2;
+++ /dev/null
-From 4d95f99c59b8b814bcf09ba86020d937ec7caa86 Mon Sep 17 00:00:00 2001
-From: Hans de Goede <hdegoede@redhat.com>
-Date: Thu, 20 Dec 2018 17:40:58 +0100
-Subject: [PATCH] brcmfmac: Add DMI nvram filename quirk for PoV TAB-P1006W-232
- tablet
-
-The Point of View TAB-P1006W-232 tablet contains quite generic names in
-the sys_vendor and product_name DMI strings, without this patch brcmfmac
-will try to load: brcmfmac43340-sdio.Insyde-BayTrail.txt as nvram file
-which is a bit too generic.
-
-Add a DMI quirk so that a unique and clearly identifiable nvram file
-name is used on the PoV TAB-P1006W-232 tablet.
-
-Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- .../wireless/broadcom/brcm80211/brcmfmac/dmi.c | 15 +++++++++++++++
- 1 file changed, 15 insertions(+)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c
-@@ -43,6 +43,10 @@ static const struct brcmf_dmi_data meego
- BRCM_CC_43340_CHIP_ID, 2, "meegopad-t08"
- };
-
-+static const struct brcmf_dmi_data pov_tab_p1006w_data = {
-+ BRCM_CC_43340_CHIP_ID, 2, "pov-tab-p1006w-data"
-+};
-+
- static const struct dmi_system_id dmi_platform_data[] = {
- {
- /* Match for the GPDwin which unfortunately uses somewhat
-@@ -81,6 +85,17 @@ static const struct dmi_system_id dmi_pl
- },
- .driver_data = (void *)&meegopad_t08_data,
- },
-+ {
-+ /* Point of View TAB-P1006W-232 */
-+ .matches = {
-+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Insyde"),
-+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "BayTrail"),
-+ /* Note 105b is Foxcon's USB/PCI vendor id */
-+ DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "105B"),
-+ DMI_EXACT_MATCH(DMI_BOARD_NAME, "0E57"),
-+ },
-+ .driver_data = (void *)&pov_tab_p1006w_data,
-+ },
- {}
- };
-
+++ /dev/null
-From 42daad3343be4a4e1ee03e30a5f5cc731dadfef5 Mon Sep 17 00:00:00 2001
-From: Kangjie Lu <kjlu@umn.edu>
-Date: Tue, 25 Dec 2018 19:22:24 -0600
-Subject: [PATCH] brcmfmac: add a check for the status of usb_register
-
-usb_register() may fail, so let's check its status and issue an error
-message if it fails.
-
-Signed-off-by: Kangjie Lu <kjlu@umn.edu>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 6 +++++-
- 1 file changed, 5 insertions(+), 1 deletion(-)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
-@@ -1552,6 +1552,10 @@ void brcmf_usb_exit(void)
-
- void brcmf_usb_register(void)
- {
-+ int ret;
-+
- brcmf_dbg(USB, "Enter\n");
-- usb_register(&brcmf_usbdrvr);
-+ ret = usb_register(&brcmf_usbdrvr);
-+ if (ret)
-+ brcmf_err("usb_register failed %d\n", ret);
- }
+++ /dev/null
-From 3a33bd840523aaa06f4429fbfd38922bf0dc2e8d Mon Sep 17 00:00:00 2001
-From: Lo-Hsiang Lo <double.lo@cypress.com>
-Date: Mon, 7 Jan 2019 08:46:16 +0000
-Subject: [PATCH] brcmfmac: fix system warning message during wowl suspend
-
-There is a system warning message, warn_slowpath-fmt, during suspend
-while using supplicant join AP and enable wowl feature by IW command.
-It's caused by brcmf_pno_remove_request path can't find the reqid.
-This fix will not go to remove pno request function if there is no
-pno scan.
-
-Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
-Signed-off-by: Lo-Hsiang Lo <double.lo@cypress.com>
-Signed-off-by: Chi-Hsien Lin <chi-hsien.lin@cypress.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c | 5 +++++
- 1 file changed, 5 insertions(+)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c
-@@ -496,6 +496,11 @@ int brcmf_pno_stop_sched_scan(struct brc
- brcmf_dbg(TRACE, "reqid=%llu\n", reqid);
-
- pi = ifp_to_pno(ifp);
-+
-+ /* No PNO request */
-+ if (!pi->n_reqs)
-+ return 0;
-+
- err = brcmf_pno_remove_request(pi, reqid);
- if (err)
- return err;
+++ /dev/null
-From 5cc898fbcb352b764f8d51c16e10e2eb0056173d Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Wed, 6 Feb 2019 12:28:15 +0100
-Subject: [PATCH] brcmfmac: modify __brcmf_err() to take bus as a parameter
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-So far __brcmf_err() was using pr_err() which didn't allow identifying
-device that was affected by an error. It's crucial for systems with more
-than 1 device supported by brcmfmac (a common case for home routers).
-
-This change allows passing struct brcmf_bus to the __brcmf_err(). That
-struct has been agreed to be the most common one. It allows accessing
-struct device easily & using dev_err() printing helper.
-
-Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
-Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- .../net/wireless/broadcom/brcm80211/brcmfmac/common.c | 7 +++++--
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h | 8 +++++---
- .../wireless/broadcom/brcm80211/brcmfmac/tracepoint.c | 9 +++++++--
- 3 files changed, 17 insertions(+), 7 deletions(-)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
-@@ -350,7 +350,7 @@ done:
- }
-
- #ifndef CPTCFG_BRCM_TRACING
--void __brcmf_err(const char *func, const char *fmt, ...)
-+void __brcmf_err(struct brcmf_bus *bus, const char *func, const char *fmt, ...)
- {
- struct va_format vaf;
- va_list args;
-@@ -359,7 +359,10 @@ void __brcmf_err(const char *func, const
-
- vaf.fmt = fmt;
- vaf.va = &args;
-- pr_err("%s: %pV", func, &vaf);
-+ if (bus)
-+ dev_err(bus->dev, "%s: %pV", func, &vaf);
-+ else
-+ pr_err("%s: %pV", func, &vaf);
-
- va_end(args);
- }
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
-@@ -45,8 +45,10 @@
- #undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
--__printf(2, 3)
--void __brcmf_err(const char *func, const char *fmt, ...);
-+struct brcmf_bus;
-+
-+__printf(3, 4)
-+void __brcmf_err(struct brcmf_bus *bus, const char *func, const char *fmt, ...);
- /* Macro for error messages. When debugging / tracing the driver all error
- * messages are important to us.
- */
-@@ -55,7 +57,7 @@ void __brcmf_err(const char *func, const
- if (IS_ENABLED(CPTCFG_BRCMDBG) || \
- IS_ENABLED(CPTCFG_BRCM_TRACING) || \
- net_ratelimit()) \
-- __brcmf_err(__func__, fmt, ##__VA_ARGS__); \
-+ __brcmf_err(NULL, __func__, fmt, ##__VA_ARGS__);\
- } while (0)
-
- #if defined(DEBUG) || defined(CPTCFG_BRCM_TRACING)
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c
-@@ -14,14 +14,16 @@
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-+#include <linux/device.h>
- #include <linux/module.h> /* bug in tracepoint.h, it should include this */
-
- #ifndef __CHECKER__
- #define CREATE_TRACE_POINTS
-+#include "bus.h"
- #include "tracepoint.h"
- #include "debug.h"
-
--void __brcmf_err(const char *func, const char *fmt, ...)
-+void __brcmf_err(struct brcmf_bus *bus, const char *func, const char *fmt, ...)
- {
- struct va_format vaf = {
- .fmt = fmt,
-@@ -30,7 +32,10 @@ void __brcmf_err(const char *func, const
-
- va_start(args, fmt);
- vaf.va = &args;
-- pr_err("%s: %pV", func, &vaf);
-+ if (bus)
-+ dev_err(bus->dev, "%s: %pV", func, &vaf);
-+ else
-+ pr_err("%s: %pV", func, &vaf);
- trace_brcmf_err(func, &vaf);
- va_end(args);
- }
+++ /dev/null
-From 8602e62441aba276cafd68034b72162fbc5ca0a6 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Wed, 6 Feb 2019 12:28:16 +0100
-Subject: [PATCH] brcmfmac: pass bus to the __brcmf_err() in pcie.c
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This enables dev_err() usage (instead of pr_err()) in the __brcmf_err().
-It makes error messages more meaningful and is important for debugging
-errors/bugs on systems with multiple brcmfmac supported devices.
-
-All bus files should follow & get updated similarly (soon).
-
-Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- .../broadcom/brcm80211/brcmfmac/debug.h | 2 +
- .../broadcom/brcm80211/brcmfmac/pcie.c | 59 +++++++++++--------
- 2 files changed, 38 insertions(+), 23 deletions(-)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
-@@ -52,6 +52,7 @@ void __brcmf_err(struct brcmf_bus *bus,
- /* Macro for error messages. When debugging / tracing the driver all error
- * messages are important to us.
- */
-+#ifndef brcmf_err
- #define brcmf_err(fmt, ...) \
- do { \
- if (IS_ENABLED(CPTCFG_BRCMDBG) || \
-@@ -59,6 +60,7 @@ void __brcmf_err(struct brcmf_bus *bus,
- net_ratelimit()) \
- __brcmf_err(NULL, __func__, fmt, ##__VA_ARGS__);\
- } while (0)
-+#endif
-
- #if defined(DEBUG) || defined(CPTCFG_BRCM_TRACING)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
-@@ -30,6 +30,15 @@
- #include <brcmu_wifi.h>
- #include <brcm_hw_ids.h>
-
-+/* Custom brcmf_err() that takes bus arg and passes it further */
-+#define brcmf_err(bus, fmt, ...) \
-+ do { \
-+ if (IS_ENABLED(CPTCFG_BRCMDBG) || \
-+ IS_ENABLED(CPTCFG_BRCM_TRACING) || \
-+ net_ratelimit()) \
-+ __brcmf_err(bus, __func__, fmt, ##__VA_ARGS__); \
-+ } while (0)
-+
- #include "debug.h"
- #include "bus.h"
- #include "commonring.h"
-@@ -531,6 +540,7 @@ static void
- brcmf_pcie_select_core(struct brcmf_pciedev_info *devinfo, u16 coreid)
- {
- const struct pci_dev *pdev = devinfo->pdev;
-+ struct brcmf_bus *bus = dev_get_drvdata(&pdev->dev);
- struct brcmf_core *core;
- u32 bar0_win;
-
-@@ -548,7 +558,7 @@ brcmf_pcie_select_core(struct brcmf_pcie
- }
- }
- } else {
-- brcmf_err("Unsupported core selected %x\n", coreid);
-+ brcmf_err(bus, "Unsupported core selected %x\n", coreid);
- }
- }
-
-@@ -848,9 +858,8 @@ static irqreturn_t brcmf_pcie_isr_thread
-
- static int brcmf_pcie_request_irq(struct brcmf_pciedev_info *devinfo)
- {
-- struct pci_dev *pdev;
--
-- pdev = devinfo->pdev;
-+ struct pci_dev *pdev = devinfo->pdev;
-+ struct brcmf_bus *bus = dev_get_drvdata(&pdev->dev);
-
- brcmf_pcie_intr_disable(devinfo);
-
-@@ -861,7 +870,7 @@ static int brcmf_pcie_request_irq(struct
- brcmf_pcie_isr_thread, IRQF_SHARED,
- "brcmf_pcie_intr", devinfo)) {
- pci_disable_msi(pdev);
-- brcmf_err("Failed to request IRQ %d\n", pdev->irq);
-+ brcmf_err(bus, "Failed to request IRQ %d\n", pdev->irq);
- return -EIO;
- }
- devinfo->irq_allocated = true;
-@@ -871,15 +880,14 @@ static int brcmf_pcie_request_irq(struct
-
- static void brcmf_pcie_release_irq(struct brcmf_pciedev_info *devinfo)
- {
-- struct pci_dev *pdev;
-+ struct pci_dev *pdev = devinfo->pdev;
-+ struct brcmf_bus *bus = dev_get_drvdata(&pdev->dev);
- u32 status;
- u32 count;
-
- if (!devinfo->irq_allocated)
- return;
-
-- pdev = devinfo->pdev;
--
- brcmf_pcie_intr_disable(devinfo);
- free_irq(pdev->irq, devinfo);
- pci_disable_msi(pdev);
-@@ -891,7 +899,7 @@ static void brcmf_pcie_release_irq(struc
- count++;
- }
- if (devinfo->in_irq)
-- brcmf_err("Still in IRQ (processing) !!!\n");
-+ brcmf_err(bus, "Still in IRQ (processing) !!!\n");
-
- status = brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT);
- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT, status);
-@@ -1102,6 +1110,7 @@ static void brcmf_pcie_release_ringbuffe
-
- static int brcmf_pcie_init_ringbuffers(struct brcmf_pciedev_info *devinfo)
- {
-+ struct brcmf_bus *bus = dev_get_drvdata(&devinfo->pdev->dev);
- struct brcmf_pcie_ringbuf *ring;
- struct brcmf_pcie_ringbuf *rings;
- u32 d2h_w_idx_ptr;
-@@ -1254,7 +1263,7 @@ static int brcmf_pcie_init_ringbuffers(s
- return 0;
-
- fail:
-- brcmf_err("Allocating ring buffers failed\n");
-+ brcmf_err(bus, "Allocating ring buffers failed\n");
- brcmf_pcie_release_ringbuffers(devinfo);
- return -ENOMEM;
- }
-@@ -1277,6 +1286,7 @@ brcmf_pcie_release_scratchbuffers(struct
-
- static int brcmf_pcie_init_scratchbuffers(struct brcmf_pciedev_info *devinfo)
- {
-+ struct brcmf_bus *bus = dev_get_drvdata(&devinfo->pdev->dev);
- u64 address;
- u32 addr;
-
-@@ -1316,7 +1326,7 @@ static int brcmf_pcie_init_scratchbuffer
- return 0;
-
- fail:
-- brcmf_err("Allocating scratch buffers failed\n");
-+ brcmf_err(bus, "Allocating scratch buffers failed\n");
- brcmf_pcie_release_scratchbuffers(devinfo);
- return -ENOMEM;
- }
-@@ -1437,6 +1447,7 @@ static int
- brcmf_pcie_init_share_ram_info(struct brcmf_pciedev_info *devinfo,
- u32 sharedram_addr)
- {
-+ struct brcmf_bus *bus = dev_get_drvdata(&devinfo->pdev->dev);
- struct brcmf_pcie_shared_info *shared;
- u32 addr;
-
-@@ -1448,7 +1459,8 @@ brcmf_pcie_init_share_ram_info(struct br
- brcmf_dbg(PCIE, "PCIe protocol version %d\n", shared->version);
- if ((shared->version > BRCMF_PCIE_MAX_SHARED_VERSION) ||
- (shared->version < BRCMF_PCIE_MIN_SHARED_VERSION)) {
-- brcmf_err("Unsupported PCIE version %d\n", shared->version);
-+ brcmf_err(bus, "Unsupported PCIE version %d\n",
-+ shared->version);
- return -EINVAL;
- }
-
-@@ -1490,6 +1502,7 @@ static int brcmf_pcie_download_fw_nvram(
- const struct firmware *fw, void *nvram,
- u32 nvram_len)
- {
-+ struct brcmf_bus *bus = dev_get_drvdata(&devinfo->pdev->dev);
- u32 sharedram_addr;
- u32 sharedram_addr_written;
- u32 loop_counter;
-@@ -1544,7 +1557,7 @@ static int brcmf_pcie_download_fw_nvram(
- loop_counter--;
- }
- if (sharedram_addr == sharedram_addr_written) {
-- brcmf_err("FW failed to initialize\n");
-+ brcmf_err(bus, "FW failed to initialize\n");
- return -ENODEV;
- }
- brcmf_dbg(PCIE, "Shared RAM addr: 0x%08x\n", sharedram_addr);
-@@ -1555,16 +1568,15 @@ static int brcmf_pcie_download_fw_nvram(
-
- static int brcmf_pcie_get_resource(struct brcmf_pciedev_info *devinfo)
- {
-- struct pci_dev *pdev;
-+ struct pci_dev *pdev = devinfo->pdev;
-+ struct brcmf_bus *bus = dev_get_drvdata(&pdev->dev);
- int err;
- phys_addr_t bar0_addr, bar1_addr;
- ulong bar1_size;
-
-- pdev = devinfo->pdev;
--
- err = pci_enable_device(pdev);
- if (err) {
-- brcmf_err("pci_enable_device failed err=%d\n", err);
-+ brcmf_err(bus, "pci_enable_device failed err=%d\n", err);
- return err;
- }
-
-@@ -1577,7 +1589,7 @@ static int brcmf_pcie_get_resource(struc
- /* read Bar-1 mapped memory range */
- bar1_size = pci_resource_len(pdev, 2);
- if ((bar1_size == 0) || (bar1_addr == 0)) {
-- brcmf_err("BAR1 Not enabled, device size=%ld, addr=%#016llx\n",
-+ brcmf_err(bus, "BAR1 Not enabled, device size=%ld, addr=%#016llx\n",
- bar1_size, (unsigned long long)bar1_addr);
- return -EINVAL;
- }
-@@ -1586,7 +1598,7 @@ static int brcmf_pcie_get_resource(struc
- devinfo->tcm = ioremap_nocache(bar1_addr, bar1_size);
-
- if (!devinfo->regs || !devinfo->tcm) {
-- brcmf_err("ioremap() failed (%p,%p)\n", devinfo->regs,
-+ brcmf_err(bus, "ioremap() failed (%p,%p)\n", devinfo->regs,
- devinfo->tcm);
- return -EINVAL;
- }
-@@ -1873,7 +1885,7 @@ fail_bus:
- kfree(bus->msgbuf);
- kfree(bus);
- fail:
-- brcmf_err("failed %x:%x\n", pdev->vendor, pdev->device);
-+ brcmf_err(NULL, "failed %x:%x\n", pdev->vendor, pdev->device);
- brcmf_pcie_release_resource(devinfo);
- if (devinfo->ci)
- brcmf_chip_detach(devinfo->ci);
-@@ -1947,7 +1959,7 @@ static int brcmf_pcie_pm_enter_D3(struct
- wait_event_timeout(devinfo->mbdata_resp_wait, devinfo->mbdata_completed,
- BRCMF_PCIE_MBDATA_TIMEOUT);
- if (!devinfo->mbdata_completed) {
-- brcmf_err("Timeout on response for entering D3 substate\n");
-+ brcmf_err(bus, "Timeout on response for entering D3 substate\n");
- brcmf_bus_change_state(bus, BRCMF_BUS_UP);
- return -EIO;
- }
-@@ -1993,7 +2005,7 @@ cleanup:
-
- err = brcmf_pcie_probe(pdev, NULL);
- if (err)
-- brcmf_err("probe after resume failed, err=%d\n", err);
-+ brcmf_err(bus, "probe after resume failed, err=%d\n", err);
-
- return err;
- }
-@@ -2066,7 +2078,8 @@ void brcmf_pcie_register(void)
- brcmf_dbg(PCIE, "Enter\n");
- err = pci_register_driver(&brcmf_pciedrvr);
- if (err)
-- brcmf_err("PCIE driver registration failed, err=%d\n", err);
-+ brcmf_err(NULL, "PCIE driver registration failed, err=%d\n",
-+ err);
- }
-
-
+++ /dev/null
-From 3ef005b82e2ad68107fc5814eaa743d171a6c362 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Wed, 16 Jan 2019 07:28:54 +0100
-Subject: [PATCH] brcmfmac: add bphy_err() and use it in the cfg80211.c
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This new macro uses wiphy_err() which:
-1) Should be the best choice with wiphy already created
-2) Uses dev_err() which allows identifying error-affected device
-
-Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- .../broadcom/brcm80211/brcmfmac/cfg80211.c | 497 ++++++++++--------
- .../broadcom/brcm80211/brcmfmac/debug.h | 9 +
- 2 files changed, 282 insertions(+), 224 deletions(-)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
-@@ -457,6 +457,7 @@ static void convert_key_from_CPU(struct
- static int
- send_key_to_dongle(struct brcmf_if *ifp, struct brcmf_wsec_key *key)
- {
-+ struct wiphy *wiphy = ifp->drvr->wiphy;
- int err;
- struct brcmf_wsec_key_le key_le;
-
-@@ -468,7 +469,7 @@ send_key_to_dongle(struct brcmf_if *ifp,
- sizeof(key_le));
-
- if (err)
-- brcmf_err("wsec_key error (%d)\n", err);
-+ bphy_err(wiphy, "wsec_key error (%d)\n", err);
- return err;
- }
-
-@@ -508,6 +509,7 @@ static int brcmf_get_first_free_bsscfgid
-
- static int brcmf_cfg80211_request_ap_if(struct brcmf_if *ifp)
- {
-+ struct wiphy *wiphy = ifp->drvr->wiphy;
- struct brcmf_mbss_ssid_le mbss_ssid_le;
- int bsscfgidx;
- int err;
-@@ -524,7 +526,7 @@ static int brcmf_cfg80211_request_ap_if(
- err = brcmf_fil_bsscfg_data_set(ifp, "bsscfg:ssid", &mbss_ssid_le,
- sizeof(mbss_ssid_le));
- if (err < 0)
-- brcmf_err("setting ssid failed %d\n", err);
-+ bphy_err(wiphy, "setting ssid failed %d\n", err);
-
- return err;
- }
-@@ -567,7 +569,7 @@ struct wireless_dev *brcmf_ap_add_vif(st
- BRCMF_VIF_EVENT_TIMEOUT);
- brcmf_cfg80211_arm_vif_event(cfg, NULL);
- if (!err) {
-- brcmf_err("timeout occurred\n");
-+ bphy_err(wiphy, "timeout occurred\n");
- err = -EIO;
- goto fail;
- }
-@@ -575,7 +577,7 @@ struct wireless_dev *brcmf_ap_add_vif(st
- /* interface created in firmware */
- ifp = vif->ifp;
- if (!ifp) {
-- brcmf_err("no if pointer provided\n");
-+ bphy_err(wiphy, "no if pointer provided\n");
- err = -ENOENT;
- goto fail;
- }
-@@ -583,7 +585,7 @@ struct wireless_dev *brcmf_ap_add_vif(st
- strncpy(ifp->ndev->name, name, sizeof(ifp->ndev->name) - 1);
- err = brcmf_net_attach(ifp, true);
- if (err) {
-- brcmf_err("Registering netdevice failed\n");
-+ bphy_err(wiphy, "Registering netdevice failed\n");
- free_netdev(ifp->ndev);
- goto fail;
- }
-@@ -620,7 +622,7 @@ static struct wireless_dev *brcmf_cfg802
- brcmf_dbg(TRACE, "enter: %s type %d\n", name, type);
- err = brcmf_vif_add_validate(wiphy_to_cfg(wiphy), type);
- if (err) {
-- brcmf_err("iface validation failed: err=%d\n", err);
-+ bphy_err(wiphy, "iface validation failed: err=%d\n", err);
- return ERR_PTR(err);
- }
- switch (type) {
-@@ -645,8 +647,8 @@ static struct wireless_dev *brcmf_cfg802
- }
-
- if (IS_ERR(wdev))
-- brcmf_err("add iface %s type %d failed: err=%d\n",
-- name, type, (int)PTR_ERR(wdev));
-+ bphy_err(wiphy, "add iface %s type %d failed: err=%d\n", name,
-+ type, (int)PTR_ERR(wdev));
- else
- brcmf_cfg80211_update_proto_addr_mode(wdev);
-
-@@ -661,12 +663,13 @@ static void brcmf_scan_config_mpc(struct
-
- void brcmf_set_mpc(struct brcmf_if *ifp, int mpc)
- {
-+ struct wiphy *wiphy = ifp->drvr->wiphy;
- s32 err = 0;
-
- if (check_vif_up(ifp->vif)) {
- err = brcmf_fil_iovar_int_set(ifp, "mpc", mpc);
- if (err) {
-- brcmf_err("fail to set mpc\n");
-+ bphy_err(wiphy, "fail to set mpc\n");
- return;
- }
- brcmf_dbg(INFO, "MPC : %d\n", mpc);
-@@ -677,6 +680,7 @@ s32 brcmf_notify_escan_complete(struct b
- struct brcmf_if *ifp, bool aborted,
- bool fw_abort)
- {
-+ struct wiphy *wiphy = cfg_to_wiphy(cfg);
- struct brcmf_scan_params_le params_le;
- struct cfg80211_scan_request *scan_request;
- u64 reqid;
-@@ -711,7 +715,7 @@ s32 brcmf_notify_escan_complete(struct b
- err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCAN,
- ¶ms_le, sizeof(params_le));
- if (err)
-- brcmf_err("Scan abort failed\n");
-+ bphy_err(wiphy, "Scan abort failed\n");
- }
-
- brcmf_scan_config_mpc(ifp, 1);
-@@ -763,7 +767,7 @@ static int brcmf_cfg80211_del_ap_iface(s
-
- err = brcmf_fil_bsscfg_data_set(ifp, "interface_remove", NULL, 0);
- if (err) {
-- brcmf_err("interface_remove failed %d\n", err);
-+ bphy_err(wiphy, "interface_remove failed %d\n", err);
- goto err_unarm;
- }
-
-@@ -771,7 +775,7 @@ static int brcmf_cfg80211_del_ap_iface(s
- ret = brcmf_cfg80211_wait_vif_event(cfg, BRCMF_E_IF_DEL,
- BRCMF_VIF_EVENT_TIMEOUT);
- if (!ret) {
-- brcmf_err("timeout occurred\n");
-+ bphy_err(wiphy, "timeout occurred\n");
- err = -EIO;
- goto err_unarm;
- }
-@@ -873,14 +877,14 @@ brcmf_cfg80211_change_iface(struct wiphy
- }
- err = brcmf_vif_change_validate(wiphy_to_cfg(wiphy), vif, type);
- if (err) {
-- brcmf_err("iface validation failed: err=%d\n", err);
-+ bphy_err(wiphy, "iface validation failed: err=%d\n", err);
- return err;
- }
- switch (type) {
- case NL80211_IFTYPE_MONITOR:
- case NL80211_IFTYPE_WDS:
-- brcmf_err("type (%d) : currently we do not support this type\n",
-- type);
-+ bphy_err(wiphy, "type (%d) : currently we do not support this type\n",
-+ type);
- return -EOPNOTSUPP;
- case NL80211_IFTYPE_ADHOC:
- infra = 0;
-@@ -908,7 +912,7 @@ brcmf_cfg80211_change_iface(struct wiphy
- } else {
- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, infra);
- if (err) {
-- brcmf_err("WLC_SET_INFRA error (%d)\n", err);
-+ bphy_err(wiphy, "WLC_SET_INFRA error (%d)\n", err);
- err = -EAGAIN;
- goto done;
- }
-@@ -999,6 +1003,7 @@ static s32
- brcmf_run_escan(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp,
- struct cfg80211_scan_request *request)
- {
-+ struct wiphy *wiphy = cfg_to_wiphy(cfg);
- s32 params_size = BRCMF_SCAN_PARAMS_FIXED_SIZE +
- offsetof(struct brcmf_escan_params_le, params_le);
- struct brcmf_escan_params_le *params;
-@@ -1030,7 +1035,7 @@ brcmf_run_escan(struct brcmf_cfg80211_in
- if (err == -EBUSY)
- brcmf_dbg(INFO, "system busy : escan canceled\n");
- else
-- brcmf_err("error (%d)\n", err);
-+ bphy_err(wiphy, "error (%d)\n", err);
- }
-
- kfree(params);
-@@ -1076,21 +1081,22 @@ brcmf_cfg80211_scan(struct wiphy *wiphy,
- return -EIO;
-
- if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) {
-- brcmf_err("Scanning already: status (%lu)\n", cfg->scan_status);
-+ bphy_err(wiphy, "Scanning already: status (%lu)\n",
-+ cfg->scan_status);
- return -EAGAIN;
- }
- if (test_bit(BRCMF_SCAN_STATUS_ABORT, &cfg->scan_status)) {
-- brcmf_err("Scanning being aborted: status (%lu)\n",
-- cfg->scan_status);
-+ bphy_err(wiphy, "Scanning being aborted: status (%lu)\n",
-+ cfg->scan_status);
- return -EAGAIN;
- }
- if (test_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status)) {
-- brcmf_err("Scanning suppressed: status (%lu)\n",
-- cfg->scan_status);
-+ bphy_err(wiphy, "Scanning suppressed: status (%lu)\n",
-+ cfg->scan_status);
- return -EAGAIN;
- }
- if (test_bit(BRCMF_VIF_STATUS_CONNECTING, &vif->sme_state)) {
-- brcmf_err("Connecting: status (%lu)\n", vif->sme_state);
-+ bphy_err(wiphy, "Connecting: status (%lu)\n", vif->sme_state);
- return -EAGAIN;
- }
-
-@@ -1124,7 +1130,7 @@ brcmf_cfg80211_scan(struct wiphy *wiphy,
- return 0;
-
- scan_out:
-- brcmf_err("scan error (%d)\n", err);
-+ bphy_err(wiphy, "scan error (%d)\n", err);
- clear_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status);
- cfg->scan_request = NULL;
- return err;
-@@ -1132,36 +1138,41 @@ scan_out:
-
- static s32 brcmf_set_rts(struct net_device *ndev, u32 rts_threshold)
- {
-+ struct brcmf_if *ifp = netdev_priv(ndev);
-+ struct wiphy *wiphy = ifp->drvr->wiphy;
- s32 err = 0;
-
-- err = brcmf_fil_iovar_int_set(netdev_priv(ndev), "rtsthresh",
-- rts_threshold);
-+ err = brcmf_fil_iovar_int_set(ifp, "rtsthresh", rts_threshold);
- if (err)
-- brcmf_err("Error (%d)\n", err);
-+ bphy_err(wiphy, "Error (%d)\n", err);
-
- return err;
- }
-
- static s32 brcmf_set_frag(struct net_device *ndev, u32 frag_threshold)
- {
-+ struct brcmf_if *ifp = netdev_priv(ndev);
-+ struct wiphy *wiphy = ifp->drvr->wiphy;
- s32 err = 0;
-
-- err = brcmf_fil_iovar_int_set(netdev_priv(ndev), "fragthresh",
-+ err = brcmf_fil_iovar_int_set(ifp, "fragthresh",
- frag_threshold);
- if (err)
-- brcmf_err("Error (%d)\n", err);
-+ bphy_err(wiphy, "Error (%d)\n", err);
-
- return err;
- }
-
- static s32 brcmf_set_retry(struct net_device *ndev, u32 retry, bool l)
- {
-+ struct brcmf_if *ifp = netdev_priv(ndev);
-+ struct wiphy *wiphy = ifp->drvr->wiphy;
- s32 err = 0;
- u32 cmd = (l ? BRCMF_C_SET_LRL : BRCMF_C_SET_SRL);
-
-- err = brcmf_fil_cmd_int_set(netdev_priv(ndev), cmd, retry);
-+ err = brcmf_fil_cmd_int_set(ifp, cmd, retry);
- if (err) {
-- brcmf_err("cmd (%d) , error (%d)\n", cmd, err);
-+ bphy_err(wiphy, "cmd (%d) , error (%d)\n", cmd, err);
- return err;
- }
- return err;
-@@ -1237,6 +1248,7 @@ static u16 brcmf_map_fw_linkdown_reason(
-
- static int brcmf_set_pmk(struct brcmf_if *ifp, const u8 *pmk_data, u16 pmk_len)
- {
-+ struct wiphy *wiphy = ifp->drvr->wiphy;
- struct brcmf_wsec_pmk_le pmk;
- int i, err;
-
-@@ -1250,8 +1262,8 @@ static int brcmf_set_pmk(struct brcmf_if
- err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_WSEC_PMK,
- &pmk, sizeof(pmk));
- if (err < 0)
-- brcmf_err("failed to change PSK in firmware (len=%u)\n",
-- pmk_len);
-+ bphy_err(wiphy, "failed to change PSK in firmware (len=%u)\n",
-+ pmk_len);
-
- return err;
- }
-@@ -1259,6 +1271,7 @@ static int brcmf_set_pmk(struct brcmf_if
- static void brcmf_link_down(struct brcmf_cfg80211_vif *vif, u16 reason)
- {
- struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(vif->wdev.wiphy);
-+ struct wiphy *wiphy = cfg_to_wiphy(cfg);
- s32 err = 0;
-
- brcmf_dbg(TRACE, "Enter\n");
-@@ -1268,7 +1281,7 @@ static void brcmf_link_down(struct brcmf
- err = brcmf_fil_cmd_data_set(vif->ifp,
- BRCMF_C_DISASSOC, NULL, 0);
- if (err) {
-- brcmf_err("WLC_DISASSOC failed (%d)\n", err);
-+ bphy_err(wiphy, "WLC_DISASSOC failed (%d)\n", err);
- }
- if ((vif->wdev.iftype == NL80211_IFTYPE_STATION) ||
- (vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT))
-@@ -1356,7 +1369,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
-
- err = brcmf_fil_iovar_int_set(ifp, "wsec", wsec);
- if (err) {
-- brcmf_err("wsec failed (%d)\n", err);
-+ bphy_err(wiphy, "wsec failed (%d)\n", err);
- goto done;
- }
-
-@@ -1368,7 +1381,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
-
- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD, bcnprd);
- if (err) {
-- brcmf_err("WLC_SET_BCNPRD failed (%d)\n", err);
-+ bphy_err(wiphy, "WLC_SET_BCNPRD failed (%d)\n", err);
- goto done;
- }
-
-@@ -1413,7 +1426,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_CHANNEL,
- target_channel);
- if (err) {
-- brcmf_err("WLC_SET_CHANNEL failed (%d)\n", err);
-+ bphy_err(wiphy, "WLC_SET_CHANNEL failed (%d)\n", err);
- goto done;
- }
- } else
-@@ -1425,7 +1438,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
- err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
- &join_params, join_params_size);
- if (err) {
-- brcmf_err("WLC_SET_SSID failed (%d)\n", err);
-+ bphy_err(wiphy, "WLC_SET_SSID failed (%d)\n", err);
- goto done;
- }
-
-@@ -1461,6 +1474,8 @@ brcmf_cfg80211_leave_ibss(struct wiphy *
- static s32 brcmf_set_wpa_version(struct net_device *ndev,
- struct cfg80211_connect_params *sme)
- {
-+ struct brcmf_if *ifp = netdev_priv(ndev);
-+ struct wiphy *wiphy = ifp->drvr->wiphy;
- struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
- struct brcmf_cfg80211_security *sec;
- s32 val = 0;
-@@ -1473,9 +1488,9 @@ static s32 brcmf_set_wpa_version(struct
- else
- val = WPA_AUTH_DISABLED;
- brcmf_dbg(CONN, "setting wpa_auth to 0x%0x\n", val);
-- err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wpa_auth", val);
-+ err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", val);
- if (err) {
-- brcmf_err("set wpa_auth failed (%d)\n", err);
-+ bphy_err(wiphy, "set wpa_auth failed (%d)\n", err);
- return err;
- }
- sec = &profile->sec;
-@@ -1486,6 +1501,8 @@ static s32 brcmf_set_wpa_version(struct
- static s32 brcmf_set_auth_type(struct net_device *ndev,
- struct cfg80211_connect_params *sme)
- {
-+ struct brcmf_if *ifp = netdev_priv(ndev);
-+ struct wiphy *wiphy = ifp->drvr->wiphy;
- struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
- struct brcmf_cfg80211_security *sec;
- s32 val = 0;
-@@ -1506,9 +1523,9 @@ static s32 brcmf_set_auth_type(struct ne
- break;
- }
-
-- err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "auth", val);
-+ err = brcmf_fil_bsscfg_int_set(ifp, "auth", val);
- if (err) {
-- brcmf_err("set auth failed (%d)\n", err);
-+ bphy_err(wiphy, "set auth failed (%d)\n", err);
- return err;
- }
- sec = &profile->sec;
-@@ -1520,6 +1537,8 @@ static s32
- brcmf_set_wsec_mode(struct net_device *ndev,
- struct cfg80211_connect_params *sme)
- {
-+ struct brcmf_if *ifp = netdev_priv(ndev);
-+ struct wiphy *wiphy = ifp->drvr->wiphy;
- struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
- struct brcmf_cfg80211_security *sec;
- s32 pval = 0;
-@@ -1543,8 +1562,8 @@ brcmf_set_wsec_mode(struct net_device *n
- pval = AES_ENABLED;
- break;
- default:
-- brcmf_err("invalid cipher pairwise (%d)\n",
-- sme->crypto.ciphers_pairwise[0]);
-+ bphy_err(wiphy, "invalid cipher pairwise (%d)\n",
-+ sme->crypto.ciphers_pairwise[0]);
- return -EINVAL;
- }
- }
-@@ -1564,8 +1583,8 @@ brcmf_set_wsec_mode(struct net_device *n
- gval = AES_ENABLED;
- break;
- default:
-- brcmf_err("invalid cipher group (%d)\n",
-- sme->crypto.cipher_group);
-+ bphy_err(wiphy, "invalid cipher group (%d)\n",
-+ sme->crypto.cipher_group);
- return -EINVAL;
- }
- }
-@@ -1578,9 +1597,9 @@ brcmf_set_wsec_mode(struct net_device *n
- pval = AES_ENABLED;
-
- wsec = pval | gval;
-- err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wsec", wsec);
-+ err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
- if (err) {
-- brcmf_err("error (%d)\n", err);
-+ bphy_err(wiphy, "error (%d)\n", err);
- return err;
- }
-
-@@ -1595,6 +1614,7 @@ static s32
- brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme)
- {
- struct brcmf_if *ifp = netdev_priv(ndev);
-+ struct wiphy *wiphy = ifp->drvr->wiphy;
- struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
- s32 val;
- s32 err;
-@@ -1613,7 +1633,7 @@ brcmf_set_key_mgmt(struct net_device *nd
-
- err = brcmf_fil_bsscfg_int_get(netdev_priv(ndev), "wpa_auth", &val);
- if (err) {
-- brcmf_err("could not get wpa_auth (%d)\n", err);
-+ bphy_err(wiphy, "could not get wpa_auth (%d)\n", err);
- return err;
- }
- if (val & (WPA_AUTH_PSK | WPA_AUTH_UNSPECIFIED)) {
-@@ -1627,8 +1647,8 @@ brcmf_set_key_mgmt(struct net_device *nd
- val = WPA_AUTH_PSK;
- break;
- default:
-- brcmf_err("invalid cipher group (%d)\n",
-- sme->crypto.cipher_group);
-+ bphy_err(wiphy, "invalid cipher group (%d)\n",
-+ sme->crypto.cipher_group);
- return -EINVAL;
- }
- } else if (val & (WPA2_AUTH_PSK | WPA2_AUTH_UNSPECIFIED)) {
-@@ -1658,8 +1678,8 @@ brcmf_set_key_mgmt(struct net_device *nd
- val = WPA2_AUTH_PSK | WPA2_AUTH_FT;
- break;
- default:
-- brcmf_err("invalid cipher group (%d)\n",
-- sme->crypto.cipher_group);
-+ bphy_err(wiphy, "invalid cipher group (%d)\n",
-+ sme->crypto.cipher_group);
- return -EINVAL;
- }
- }
-@@ -1705,7 +1725,7 @@ skip_mfp_config:
- brcmf_dbg(CONN, "setting wpa_auth to %d\n", val);
- err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wpa_auth", val);
- if (err) {
-- brcmf_err("could not set wpa_auth (%d)\n", err);
-+ bphy_err(wiphy, "could not set wpa_auth (%d)\n", err);
- return err;
- }
-
-@@ -1716,6 +1736,8 @@ static s32
- brcmf_set_sharedkey(struct net_device *ndev,
- struct cfg80211_connect_params *sme)
- {
-+ struct brcmf_if *ifp = netdev_priv(ndev);
-+ struct wiphy *wiphy = ifp->drvr->wiphy;
- struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
- struct brcmf_cfg80211_security *sec;
- struct brcmf_wsec_key key;
-@@ -1742,7 +1764,7 @@ brcmf_set_sharedkey(struct net_device *n
- key.len = (u32) sme->key_len;
- key.index = (u32) sme->key_idx;
- if (key.len > sizeof(key.data)) {
-- brcmf_err("Too long key length (%u)\n", key.len);
-+ bphy_err(wiphy, "Too long key length (%u)\n", key.len);
- return -EINVAL;
- }
- memcpy(key.data, sme->key, key.len);
-@@ -1755,24 +1777,24 @@ brcmf_set_sharedkey(struct net_device *n
- key.algo = CRYPTO_ALGO_WEP128;
- break;
- default:
-- brcmf_err("Invalid algorithm (%d)\n",
-- sme->crypto.ciphers_pairwise[0]);
-+ bphy_err(wiphy, "Invalid algorithm (%d)\n",
-+ sme->crypto.ciphers_pairwise[0]);
- return -EINVAL;
- }
- /* Set the new key/index */
- brcmf_dbg(CONN, "key length (%d) key index (%d) algo (%d)\n",
- key.len, key.index, key.algo);
- brcmf_dbg(CONN, "key \"%s\"\n", key.data);
-- err = send_key_to_dongle(netdev_priv(ndev), &key);
-+ err = send_key_to_dongle(ifp, &key);
- if (err)
- return err;
-
- if (sec->auth_type == NL80211_AUTHTYPE_SHARED_KEY) {
- brcmf_dbg(CONN, "set auth_type to shared key\n");
- val = WL_AUTH_SHARED_KEY; /* shared key */
-- err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "auth", val);
-+ err = brcmf_fil_bsscfg_int_set(ifp, "auth", val);
- if (err)
-- brcmf_err("set auth failed (%d)\n", err);
-+ bphy_err(wiphy, "set auth failed (%d)\n", err);
- }
- return err;
- }
-@@ -1792,6 +1814,7 @@ enum nl80211_auth_type brcmf_war_auth_ty
- static void brcmf_set_join_pref(struct brcmf_if *ifp,
- struct cfg80211_bss_selection *bss_select)
- {
-+ struct wiphy *wiphy = ifp->drvr->wiphy;
- struct brcmf_join_pref_params join_pref_params[2];
- enum nl80211_band band;
- int err, i = 0;
-@@ -1830,7 +1853,7 @@ static void brcmf_set_join_pref(struct b
- err = brcmf_fil_iovar_data_set(ifp, "join_pref", join_pref_params,
- sizeof(join_pref_params));
- if (err)
-- brcmf_err("Set join_pref error (%d)\n", err);
-+ bphy_err(wiphy, "Set join_pref error (%d)\n", err);
- }
-
- static s32
-@@ -1857,7 +1880,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
- return -EIO;
-
- if (!sme->ssid) {
-- brcmf_err("Invalid ssid\n");
-+ bphy_err(wiphy, "Invalid ssid\n");
- return -EOPNOTSUPP;
- }
-
-@@ -1886,7 +1909,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
- err = brcmf_vif_set_mgmt_ie(ifp->vif, BRCMF_VNDR_IE_ASSOCREQ_FLAG,
- sme->ie, sme->ie_len);
- if (err)
-- brcmf_err("Set Assoc REQ IE Failed\n");
-+ bphy_err(wiphy, "Set Assoc REQ IE Failed\n");
- else
- brcmf_dbg(TRACE, "Applied Vndr IEs for Assoc request\n");
-
-@@ -1907,32 +1930,32 @@ brcmf_cfg80211_connect(struct wiphy *wip
-
- err = brcmf_set_wpa_version(ndev, sme);
- if (err) {
-- brcmf_err("wl_set_wpa_version failed (%d)\n", err);
-+ bphy_err(wiphy, "wl_set_wpa_version failed (%d)\n", err);
- goto done;
- }
-
- sme->auth_type = brcmf_war_auth_type(ifp, sme->auth_type);
- err = brcmf_set_auth_type(ndev, sme);
- if (err) {
-- brcmf_err("wl_set_auth_type failed (%d)\n", err);
-+ bphy_err(wiphy, "wl_set_auth_type failed (%d)\n", err);
- goto done;
- }
-
- err = brcmf_set_wsec_mode(ndev, sme);
- if (err) {
-- brcmf_err("wl_set_set_cipher failed (%d)\n", err);
-+ bphy_err(wiphy, "wl_set_set_cipher failed (%d)\n", err);
- goto done;
- }
-
- err = brcmf_set_key_mgmt(ndev, sme);
- if (err) {
-- brcmf_err("wl_set_key_mgmt failed (%d)\n", err);
-+ bphy_err(wiphy, "wl_set_key_mgmt failed (%d)\n", err);
- goto done;
- }
-
- err = brcmf_set_sharedkey(ndev, sme);
- if (err) {
-- brcmf_err("brcmf_set_sharedkey failed (%d)\n", err);
-+ bphy_err(wiphy, "brcmf_set_sharedkey failed (%d)\n", err);
- goto done;
- }
-
-@@ -1949,7 +1972,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
- /* enable firmware supplicant for this interface */
- err = brcmf_fil_iovar_int_set(ifp, "sup_wpa", 1);
- if (err < 0) {
-- brcmf_err("failed to enable fw supplicant\n");
-+ bphy_err(wiphy, "failed to enable fw supplicant\n");
- goto done;
- }
- }
-@@ -2044,7 +2067,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
- err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
- &join_params, join_params_size);
- if (err)
-- brcmf_err("BRCMF_C_SET_SSID failed (%d)\n", err);
-+ bphy_err(wiphy, "BRCMF_C_SET_SSID failed (%d)\n", err);
-
- done:
- if (err)
-@@ -2075,7 +2098,7 @@ brcmf_cfg80211_disconnect(struct wiphy *
- err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_DISASSOC,
- &scbval, sizeof(scbval));
- if (err)
-- brcmf_err("error (%d)\n", err);
-+ bphy_err(wiphy, "error (%d)\n", err);
-
- brcmf_dbg(TRACE, "Exit\n");
- return err;
-@@ -2102,7 +2125,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy
- case NL80211_TX_POWER_LIMITED:
- case NL80211_TX_POWER_FIXED:
- if (mbm < 0) {
-- brcmf_err("TX_POWER_FIXED - dbm is negative\n");
-+ bphy_err(wiphy, "TX_POWER_FIXED - dbm is negative\n");
- err = -EINVAL;
- goto done;
- }
-@@ -2112,7 +2135,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy
- qdbm |= WL_TXPWR_OVERRIDE;
- break;
- default:
-- brcmf_err("Unsupported type %d\n", type);
-+ bphy_err(wiphy, "Unsupported type %d\n", type);
- err = -EINVAL;
- goto done;
- }
-@@ -2120,11 +2143,11 @@ brcmf_cfg80211_set_tx_power(struct wiphy
- disable = WL_RADIO_SW_DISABLE << 16;
- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_RADIO, disable);
- if (err)
-- brcmf_err("WLC_SET_RADIO error (%d)\n", err);
-+ bphy_err(wiphy, "WLC_SET_RADIO error (%d)\n", err);
-
- err = brcmf_fil_iovar_int_set(ifp, "qtxpower", qdbm);
- if (err)
-- brcmf_err("qtxpower error (%d)\n", err);
-+ bphy_err(wiphy, "qtxpower error (%d)\n", err);
-
- done:
- brcmf_dbg(TRACE, "Exit %d (qdbm)\n", qdbm & ~WL_TXPWR_OVERRIDE);
-@@ -2145,7 +2168,7 @@ brcmf_cfg80211_get_tx_power(struct wiphy
-
- err = brcmf_fil_iovar_int_get(vif->ifp, "qtxpower", &qdbm);
- if (err) {
-- brcmf_err("error (%d)\n", err);
-+ bphy_err(wiphy, "error (%d)\n", err);
- goto done;
- }
- *dbm = (qdbm & ~WL_TXPWR_OVERRIDE) / 4;
-@@ -2171,7 +2194,7 @@ brcmf_cfg80211_config_default_key(struct
-
- err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
- if (err) {
-- brcmf_err("WLC_GET_WSEC error (%d)\n", err);
-+ bphy_err(wiphy, "WLC_GET_WSEC error (%d)\n", err);
- goto done;
- }
-
-@@ -2181,7 +2204,7 @@ brcmf_cfg80211_config_default_key(struct
- err = brcmf_fil_cmd_int_set(ifp,
- BRCMF_C_SET_KEY_PRIMARY, index);
- if (err)
-- brcmf_err("error (%d)\n", err);
-+ bphy_err(wiphy, "error (%d)\n", err);
- }
- done:
- brcmf_dbg(TRACE, "Exit\n");
-@@ -2245,7 +2268,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip
-
- if (key_idx >= BRCMF_MAX_DEFAULT_KEYS) {
- /* we ignore this key index in this case */
-- brcmf_err("invalid key index (%d)\n", key_idx);
-+ bphy_err(wiphy, "invalid key index (%d)\n", key_idx);
- return -EINVAL;
- }
-
-@@ -2254,7 +2277,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip
- mac_addr);
-
- if (params->key_len > sizeof(key->data)) {
-- brcmf_err("Too long key length (%u)\n", params->key_len);
-+ bphy_err(wiphy, "Too long key length (%u)\n", params->key_len);
- return -EINVAL;
- }
-
-@@ -2308,7 +2331,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip
- brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_CCMP\n");
- break;
- default:
-- brcmf_err("Invalid cipher (0x%x)\n", params->cipher);
-+ bphy_err(wiphy, "Invalid cipher (0x%x)\n", params->cipher);
- err = -EINVAL;
- goto done;
- }
-@@ -2319,13 +2342,13 @@ brcmf_cfg80211_add_key(struct wiphy *wip
-
- err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
- if (err) {
-- brcmf_err("get wsec error (%d)\n", err);
-+ bphy_err(wiphy, "get wsec error (%d)\n", err);
- goto done;
- }
- wsec |= val;
- err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
- if (err) {
-- brcmf_err("set wsec error (%d)\n", err);
-+ bphy_err(wiphy, "set wsec error (%d)\n", err);
- goto done;
- }
-
-@@ -2356,7 +2379,7 @@ brcmf_cfg80211_get_key(struct wiphy *wip
-
- err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
- if (err) {
-- brcmf_err("WLC_GET_WSEC error (%d)\n", err);
-+ bphy_err(wiphy, "WLC_GET_WSEC error (%d)\n", err);
- /* Ignore this error, may happen during DISASSOC */
- err = -EAGAIN;
- goto done;
-@@ -2377,7 +2400,7 @@ brcmf_cfg80211_get_key(struct wiphy *wip
- params.cipher = WLAN_CIPHER_SUITE_AES_CMAC;
- brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_AES_CMAC\n");
- } else {
-- brcmf_err("Invalid algo (0x%x)\n", wsec);
-+ bphy_err(wiphy, "Invalid algo (0x%x)\n", wsec);
- err = -EINVAL;
- goto done;
- }
-@@ -2407,6 +2430,7 @@ brcmf_cfg80211_config_default_mgmt_key(s
- static void
- brcmf_cfg80211_reconfigure_wep(struct brcmf_if *ifp)
- {
-+ struct wiphy *wiphy = ifp->drvr->wiphy;
- s32 err;
- u8 key_idx;
- struct brcmf_wsec_key *key;
-@@ -2423,18 +2447,18 @@ brcmf_cfg80211_reconfigure_wep(struct br
-
- err = send_key_to_dongle(ifp, key);
- if (err) {
-- brcmf_err("Setting WEP key failed (%d)\n", err);
-+ bphy_err(wiphy, "Setting WEP key failed (%d)\n", err);
- return;
- }
- err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
- if (err) {
-- brcmf_err("get wsec error (%d)\n", err);
-+ bphy_err(wiphy, "get wsec error (%d)\n", err);
- return;
- }
- wsec |= WEP_ENABLED;
- err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
- if (err)
-- brcmf_err("set wsec error (%d)\n", err);
-+ bphy_err(wiphy, "set wsec error (%d)\n", err);
- }
-
- static void brcmf_convert_sta_flags(u32 fw_sta_flags, struct station_info *si)
-@@ -2460,6 +2484,7 @@ static void brcmf_convert_sta_flags(u32
-
- static void brcmf_fill_bss_param(struct brcmf_if *ifp, struct station_info *si)
- {
-+ struct wiphy *wiphy = ifp->drvr->wiphy;
- struct {
- __le32 len;
- struct brcmf_bss_info_le bss_le;
-@@ -2475,7 +2500,7 @@ static void brcmf_fill_bss_param(struct
- err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO, buf,
- WL_BSS_INFO_MAX);
- if (err) {
-- brcmf_err("Failed to get bss info (%d)\n", err);
-+ bphy_err(wiphy, "Failed to get bss info (%d)\n", err);
- goto out_kfree;
- }
- si->filled |= BIT_ULL(NL80211_STA_INFO_BSS_PARAM);
-@@ -2497,6 +2522,7 @@ static s32
- brcmf_cfg80211_get_station_ibss(struct brcmf_if *ifp,
- struct station_info *sinfo)
- {
-+ struct wiphy *wiphy = ifp->drvr->wiphy;
- struct brcmf_scb_val_le scbval;
- struct brcmf_pktcnt_le pktcnt;
- s32 err;
-@@ -2506,7 +2532,7 @@ brcmf_cfg80211_get_station_ibss(struct b
- /* Get the current tx rate */
- err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_RATE, &rate);
- if (err < 0) {
-- brcmf_err("BRCMF_C_GET_RATE error (%d)\n", err);
-+ bphy_err(wiphy, "BRCMF_C_GET_RATE error (%d)\n", err);
- return err;
- }
- sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE);
-@@ -2516,7 +2542,7 @@ brcmf_cfg80211_get_station_ibss(struct b
- err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI, &scbval,
- sizeof(scbval));
- if (err) {
-- brcmf_err("BRCMF_C_GET_RSSI error (%d)\n", err);
-+ bphy_err(wiphy, "BRCMF_C_GET_RSSI error (%d)\n", err);
- return err;
- }
- rssi = le32_to_cpu(scbval.val);
-@@ -2526,7 +2552,7 @@ brcmf_cfg80211_get_station_ibss(struct b
- err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_GET_PKTCNTS, &pktcnt,
- sizeof(pktcnt));
- if (err) {
-- brcmf_err("BRCMF_C_GET_GET_PKTCNTS error (%d)\n", err);
-+ bphy_err(wiphy, "BRCMF_C_GET_GET_PKTCNTS error (%d)\n", err);
- return err;
- }
- sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_PACKETS) |
-@@ -2574,7 +2600,7 @@ brcmf_cfg80211_get_station(struct wiphy
- &sta_info_le,
- sizeof(sta_info_le));
- if (err < 0) {
-- brcmf_err("GET STA INFO failed, %d\n", err);
-+ bphy_err(wiphy, "GET STA INFO failed, %d\n", err);
- goto done;
- }
- }
-@@ -2643,7 +2669,8 @@ brcmf_cfg80211_get_station(struct wiphy
- err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI,
- &scb_val, sizeof(scb_val));
- if (err) {
-- brcmf_err("Could not get rssi (%d)\n", err);
-+ bphy_err(wiphy, "Could not get rssi (%d)\n",
-+ err);
- goto done;
- } else {
- rssi = le32_to_cpu(scb_val.val);
-@@ -2674,8 +2701,8 @@ brcmf_cfg80211_dump_station(struct wiphy
- &cfg->assoclist,
- sizeof(cfg->assoclist));
- if (err) {
-- brcmf_err("BRCMF_C_GET_ASSOCLIST unsupported, err=%d\n",
-- err);
-+ bphy_err(wiphy, "BRCMF_C_GET_ASSOCLIST unsupported, err=%d\n",
-+ err);
- cfg->assoclist.count = 0;
- return -EOPNOTSUPP;
- }
-@@ -2723,9 +2750,9 @@ brcmf_cfg80211_set_power_mgmt(struct wip
- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM, pm);
- if (err) {
- if (err == -ENODEV)
-- brcmf_err("net_device is not ready yet\n");
-+ bphy_err(wiphy, "net_device is not ready yet\n");
- else
-- brcmf_err("error (%d)\n", err);
-+ bphy_err(wiphy, "error (%d)\n", err);
- }
- done:
- brcmf_dbg(TRACE, "Exit\n");
-@@ -2748,7 +2775,7 @@ static s32 brcmf_inform_single_bss(struc
- struct cfg80211_inform_bss bss_data = {};
-
- if (le32_to_cpu(bi->length) > WL_BSS_INFO_MAX) {
-- brcmf_err("Bss info is larger than buffer. Discarding\n");
-+ bphy_err(wiphy, "Bss info is larger than buffer. Discarding\n");
- return 0;
- }
-
-@@ -2807,6 +2834,7 @@ next_bss_le(struct brcmf_scan_results *l
-
- static s32 brcmf_inform_bss(struct brcmf_cfg80211_info *cfg)
- {
-+ struct wiphy *wiphy = cfg_to_wiphy(cfg);
- struct brcmf_scan_results *bss_list;
- struct brcmf_bss_info_le *bi = NULL; /* must be initialized */
- s32 err = 0;
-@@ -2815,8 +2843,8 @@ static s32 brcmf_inform_bss(struct brcmf
- bss_list = (struct brcmf_scan_results *)cfg->escan_info.escan_buf;
- if (bss_list->count != 0 &&
- bss_list->version != BRCMF_BSS_INFO_VERSION) {
-- brcmf_err("Version %d != WL_BSS_INFO_VERSION\n",
-- bss_list->version);
-+ bphy_err(wiphy, "Version %d != WL_BSS_INFO_VERSION\n",
-+ bss_list->version);
- return -EOPNOTSUPP;
- }
- brcmf_dbg(SCAN, "scanned AP count (%d)\n", bss_list->count);
-@@ -2860,7 +2888,7 @@ static s32 brcmf_inform_ibss(struct brcm
- err = brcmf_fil_cmd_data_get(netdev_priv(ndev), BRCMF_C_GET_BSS_INFO,
- buf, WL_BSS_INFO_MAX);
- if (err) {
-- brcmf_err("WLC_GET_BSS_INFO failed: %d\n", err);
-+ bphy_err(wiphy, "WLC_GET_BSS_INFO failed: %d\n", err);
- goto CleanUp;
- }
-
-@@ -2914,6 +2942,7 @@ CleanUp:
- static s32 brcmf_update_bss_info(struct brcmf_cfg80211_info *cfg,
- struct brcmf_if *ifp)
- {
-+ struct wiphy *wiphy = cfg_to_wiphy(cfg);
- struct brcmf_bss_info_le *bi;
- const struct brcmf_tlv *tim;
- u16 beacon_interval;
-@@ -2930,7 +2959,7 @@ static s32 brcmf_update_bss_info(struct
- err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO,
- cfg->extra_buf, WL_EXTRA_BUF_MAX);
- if (err) {
-- brcmf_err("Could not get bss info %d\n", err);
-+ bphy_err(wiphy, "Could not get bss info %d\n", err);
- goto update_bss_info_out;
- }
-
-@@ -2955,7 +2984,7 @@ static s32 brcmf_update_bss_info(struct
- u32 var;
- err = brcmf_fil_iovar_int_get(ifp, "dtim_assoc", &var);
- if (err) {
-- brcmf_err("wl dtim_assoc failed (%d)\n", err);
-+ bphy_err(wiphy, "wl dtim_assoc failed (%d)\n", err);
- goto update_bss_info_out;
- }
- dtim_period = (u8)var;
-@@ -2993,9 +3022,10 @@ static void brcmf_escan_timeout(struct t
- {
- struct brcmf_cfg80211_info *cfg =
- from_timer(cfg, t, escan_timeout);
-+ struct wiphy *wiphy = cfg_to_wiphy(cfg);
-
- if (cfg->int_escan_map || cfg->scan_request) {
-- brcmf_err("timer expired\n");
-+ bphy_err(wiphy, "timer expired\n");
- schedule_work(&cfg->escan_timeout_work);
- }
- }
-@@ -3044,6 +3074,7 @@ brcmf_cfg80211_escan_handler(struct brcm
- const struct brcmf_event_msg *e, void *data)
- {
- struct brcmf_cfg80211_info *cfg = ifp->drvr->config;
-+ struct wiphy *wiphy = cfg_to_wiphy(cfg);
- s32 status;
- struct brcmf_escan_result_le *escan_result_le;
- u32 escan_buflen;
-@@ -3060,32 +3091,33 @@ brcmf_cfg80211_escan_handler(struct brcm
- goto exit;
-
- if (!test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) {
-- brcmf_err("scan not ready, bsscfgidx=%d\n", ifp->bsscfgidx);
-+ bphy_err(wiphy, "scan not ready, bsscfgidx=%d\n",
-+ ifp->bsscfgidx);
- return -EPERM;
- }
-
- if (status == BRCMF_E_STATUS_PARTIAL) {
- brcmf_dbg(SCAN, "ESCAN Partial result\n");
- if (e->datalen < sizeof(*escan_result_le)) {
-- brcmf_err("invalid event data length\n");
-+ bphy_err(wiphy, "invalid event data length\n");
- goto exit;
- }
- escan_result_le = (struct brcmf_escan_result_le *) data;
- if (!escan_result_le) {
-- brcmf_err("Invalid escan result (NULL pointer)\n");
-+ bphy_err(wiphy, "Invalid escan result (NULL pointer)\n");
- goto exit;
- }
- escan_buflen = le32_to_cpu(escan_result_le->buflen);
- if (escan_buflen > BRCMF_ESCAN_BUF_SIZE ||
- escan_buflen > e->datalen ||
- escan_buflen < sizeof(*escan_result_le)) {
-- brcmf_err("Invalid escan buffer length: %d\n",
-- escan_buflen);
-+ bphy_err(wiphy, "Invalid escan buffer length: %d\n",
-+ escan_buflen);
- goto exit;
- }
- if (le16_to_cpu(escan_result_le->bss_count) != 1) {
-- brcmf_err("Invalid bss_count %d: ignoring\n",
-- escan_result_le->bss_count);
-+ bphy_err(wiphy, "Invalid bss_count %d: ignoring\n",
-+ escan_result_le->bss_count);
- goto exit;
- }
- bss_info_le = &escan_result_le->bss_info_le;
-@@ -3100,8 +3132,8 @@ brcmf_cfg80211_escan_handler(struct brcm
-
- bi_length = le32_to_cpu(bss_info_le->length);
- if (bi_length != escan_buflen - WL_ESCAN_RESULTS_FIXED_SIZE) {
-- brcmf_err("Ignoring invalid bss_info length: %d\n",
-- bi_length);
-+ bphy_err(wiphy, "Ignoring invalid bss_info length: %d\n",
-+ bi_length);
- goto exit;
- }
-
-@@ -3109,7 +3141,7 @@ brcmf_cfg80211_escan_handler(struct brcm
- BIT(NL80211_IFTYPE_ADHOC))) {
- if (le16_to_cpu(bss_info_le->capability) &
- WLAN_CAPABILITY_IBSS) {
-- brcmf_err("Ignoring IBSS result\n");
-+ bphy_err(wiphy, "Ignoring IBSS result\n");
- goto exit;
- }
- }
-@@ -3117,7 +3149,7 @@ brcmf_cfg80211_escan_handler(struct brcm
- list = (struct brcmf_scan_results *)
- cfg->escan_info.escan_buf;
- if (bi_length > BRCMF_ESCAN_BUF_SIZE - list->buflen) {
-- brcmf_err("Buffer is too small: ignoring\n");
-+ bphy_err(wiphy, "Buffer is too small: ignoring\n");
- goto exit;
- }
-
-@@ -3309,14 +3341,14 @@ brcmf_notify_sched_scan_results(struct b
- WARN_ON(status != BRCMF_PNO_SCAN_COMPLETE);
- brcmf_dbg(SCAN, "PFN NET FOUND event. count: %d\n", result_count);
- if (!result_count) {
-- brcmf_err("FALSE PNO Event. (pfn_count == 0)\n");
-+ bphy_err(wiphy, "FALSE PNO Event. (pfn_count == 0)\n");
- goto out_err;
- }
-
- netinfo_start = brcmf_get_netinfo_array(pfn_result);
- datalen = e->datalen - ((void *)netinfo_start - (void *)pfn_result);
- if (datalen < result_count * sizeof(*netinfo)) {
-- brcmf_err("insufficient event data\n");
-+ bphy_err(wiphy, "insufficient event data\n");
- goto out_err;
- }
-
-@@ -3370,8 +3402,8 @@ brcmf_cfg80211_sched_scan_start(struct w
- req->n_match_sets, req->n_ssids);
-
- if (test_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status)) {
-- brcmf_err("Scanning suppressed: status=%lu\n",
-- cfg->scan_status);
-+ bphy_err(wiphy, "Scanning suppressed: status=%lu\n",
-+ cfg->scan_status);
- return -EAGAIN;
- }
-
-@@ -3450,6 +3482,7 @@ brcmf_wowl_nd_results(struct brcmf_if *i
- void *data)
- {
- struct brcmf_cfg80211_info *cfg = ifp->drvr->config;
-+ struct wiphy *wiphy = cfg_to_wiphy(cfg);
- struct brcmf_pno_scanresults_le *pfn_result;
- struct brcmf_pno_net_info_le *netinfo;
-
-@@ -3468,8 +3501,8 @@ brcmf_wowl_nd_results(struct brcmf_if *i
- }
-
- if (le32_to_cpu(pfn_result->count) < 1) {
-- brcmf_err("Invalid result count, expected 1 (%d)\n",
-- le32_to_cpu(pfn_result->count));
-+ bphy_err(wiphy, "Invalid result count, expected 1 (%d)\n",
-+ le32_to_cpu(pfn_result->count));
- return -EINVAL;
- }
-
-@@ -3506,7 +3539,7 @@ static void brcmf_report_wowl_wakeind(st
- err = brcmf_fil_iovar_data_get(ifp, "wowl_wakeind", &wake_ind_le,
- sizeof(wake_ind_le));
- if (err) {
-- brcmf_err("Get wowl_wakeind failed, err = %d\n", err);
-+ bphy_err(wiphy, "Get wowl_wakeind failed, err = %d\n", err);
- return;
- }
-
-@@ -3547,7 +3580,7 @@ static void brcmf_report_wowl_wakeind(st
- cfg->wowl.nd_data_completed,
- BRCMF_ND_INFO_TIMEOUT);
- if (!timeout)
-- brcmf_err("No result for wowl net detect\n");
-+ bphy_err(wiphy, "No result for wowl net detect\n");
- else
- wakeup_data.net_detect = cfg->wowl.nd_info;
- }
-@@ -3755,7 +3788,7 @@ brcmf_cfg80211_set_pmksa(struct wiphy *w
- cfg->pmk_list.npmk = cpu_to_le32(npmk);
- }
- } else {
-- brcmf_err("Too many PMKSA entries cached %d\n", npmk);
-+ bphy_err(wiphy, "Too many PMKSA entries cached %d\n", npmk);
- return -EINVAL;
- }
-
-@@ -3801,7 +3834,7 @@ brcmf_cfg80211_del_pmksa(struct wiphy *w
- memset(&pmk[i], 0, sizeof(*pmk));
- cfg->pmk_list.npmk = cpu_to_le32(npmk - 1);
- } else {
-- brcmf_err("Cache entry not found\n");
-+ bphy_err(wiphy, "Cache entry not found\n");
- return -EINVAL;
- }
-
-@@ -3833,19 +3866,20 @@ brcmf_cfg80211_flush_pmksa(struct wiphy
-
- static s32 brcmf_configure_opensecurity(struct brcmf_if *ifp)
- {
-+ struct wiphy *wiphy = ifp->drvr->wiphy;
- s32 err;
- s32 wpa_val;
-
- /* set auth */
- err = brcmf_fil_bsscfg_int_set(ifp, "auth", 0);
- if (err < 0) {
-- brcmf_err("auth error %d\n", err);
-+ bphy_err(wiphy, "auth error %d\n", err);
- return err;
- }
- /* set wsec */
- err = brcmf_fil_bsscfg_int_set(ifp, "wsec", 0);
- if (err < 0) {
-- brcmf_err("wsec error %d\n", err);
-+ bphy_err(wiphy, "wsec error %d\n", err);
- return err;
- }
- /* set upper-layer auth */
-@@ -3855,7 +3889,7 @@ static s32 brcmf_configure_opensecurity(
- wpa_val = WPA_AUTH_DISABLED;
- err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", wpa_val);
- if (err < 0) {
-- brcmf_err("wpa_auth error %d\n", err);
-+ bphy_err(wiphy, "wpa_auth error %d\n", err);
- return err;
- }
-
-@@ -3875,6 +3909,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
- const struct brcmf_vs_tlv *wpa_ie,
- bool is_rsn_ie)
- {
-+ struct wiphy *wiphy = ifp->drvr->wiphy;
- u32 auth = 0; /* d11 open authentication */
- u16 count;
- s32 err = 0;
-@@ -3905,13 +3940,13 @@ brcmf_configure_wpaie(struct brcmf_if *i
- /* check for multicast cipher suite */
- if (offset + WPA_IE_MIN_OUI_LEN > len) {
- err = -EINVAL;
-- brcmf_err("no multicast cipher suite\n");
-+ bphy_err(wiphy, "no multicast cipher suite\n");
- goto exit;
- }
-
- if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) {
- err = -EINVAL;
-- brcmf_err("ivalid OUI\n");
-+ bphy_err(wiphy, "ivalid OUI\n");
- goto exit;
- }
- offset += TLV_OUI_LEN;
-@@ -3933,7 +3968,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
- break;
- default:
- err = -EINVAL;
-- brcmf_err("Invalid multi cast cipher info\n");
-+ bphy_err(wiphy, "Invalid multi cast cipher info\n");
- goto exit;
- }
-
-@@ -3944,13 +3979,13 @@ brcmf_configure_wpaie(struct brcmf_if *i
- /* Check for unicast suite(s) */
- if (offset + (WPA_IE_MIN_OUI_LEN * count) > len) {
- err = -EINVAL;
-- brcmf_err("no unicast cipher suite\n");
-+ bphy_err(wiphy, "no unicast cipher suite\n");
- goto exit;
- }
- for (i = 0; i < count; i++) {
- if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) {
- err = -EINVAL;
-- brcmf_err("ivalid OUI\n");
-+ bphy_err(wiphy, "ivalid OUI\n");
- goto exit;
- }
- offset += TLV_OUI_LEN;
-@@ -3968,7 +4003,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
- pval |= AES_ENABLED;
- break;
- default:
-- brcmf_err("Invalid unicast security info\n");
-+ bphy_err(wiphy, "Invalid unicast security info\n");
- }
- offset++;
- }
-@@ -3978,13 +4013,13 @@ brcmf_configure_wpaie(struct brcmf_if *i
- /* Check for auth key management suite(s) */
- if (offset + (WPA_IE_MIN_OUI_LEN * count) > len) {
- err = -EINVAL;
-- brcmf_err("no auth key mgmt suite\n");
-+ bphy_err(wiphy, "no auth key mgmt suite\n");
- goto exit;
- }
- for (i = 0; i < count; i++) {
- if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) {
- err = -EINVAL;
-- brcmf_err("ivalid OUI\n");
-+ bphy_err(wiphy, "ivalid OUI\n");
- goto exit;
- }
- offset += TLV_OUI_LEN;
-@@ -4012,7 +4047,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
- wpa_auth |= WPA2_AUTH_1X_SHA256;
- break;
- default:
-- brcmf_err("Invalid key mgmt info\n");
-+ bphy_err(wiphy, "Invalid key mgmt info\n");
- }
- offset++;
- }
-@@ -4054,7 +4089,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
- err = brcmf_fil_bsscfg_int_set(ifp, "wme_bss_disable",
- wme_bss_disable);
- if (err < 0) {
-- brcmf_err("wme_bss_disable error %d\n", err);
-+ bphy_err(wiphy, "wme_bss_disable error %d\n", err);
- goto exit;
- }
-
-@@ -4068,7 +4103,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
- &data[offset],
- WPA_IE_MIN_OUI_LEN);
- if (err < 0) {
-- brcmf_err("bip error %d\n", err);
-+ bphy_err(wiphy, "bip error %d\n", err);
- goto exit;
- }
- }
-@@ -4079,13 +4114,13 @@ brcmf_configure_wpaie(struct brcmf_if *i
- /* set auth */
- err = brcmf_fil_bsscfg_int_set(ifp, "auth", auth);
- if (err < 0) {
-- brcmf_err("auth error %d\n", err);
-+ bphy_err(wiphy, "auth error %d\n", err);
- goto exit;
- }
- /* set wsec */
- err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
- if (err < 0) {
-- brcmf_err("wsec error %d\n", err);
-+ bphy_err(wiphy, "wsec error %d\n", err);
- goto exit;
- }
- /* Configure MFP, this needs to go after wsec otherwise the wsec command
-@@ -4094,14 +4129,14 @@ brcmf_configure_wpaie(struct brcmf_if *i
- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MFP)) {
- err = brcmf_fil_bsscfg_int_set(ifp, "mfp", mfp);
- if (err < 0) {
-- brcmf_err("mfp error %d\n", err);
-+ bphy_err(wiphy, "mfp error %d\n", err);
- goto exit;
- }
- }
- /* set upper-layer auth */
- err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", wpa_auth);
- if (err < 0) {
-- brcmf_err("wpa_auth error %d\n", err);
-+ bphy_err(wiphy, "wpa_auth error %d\n", err);
- goto exit;
- }
-
-@@ -4188,6 +4223,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
- const u8 *vndr_ie_buf, u32 vndr_ie_len)
- {
- struct brcmf_if *ifp;
-+ struct wiphy *wiphy;
- struct vif_saved_ie *saved_ie;
- s32 err = 0;
- u8 *iovar_ie_buf;
-@@ -4208,6 +4244,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
- if (!vif)
- return -ENODEV;
- ifp = vif->ifp;
-+ wiphy = ifp->drvr->wiphy;
- saved_ie = &vif->saved_ie;
-
- brcmf_dbg(TRACE, "bsscfgidx %d, pktflag : 0x%02X\n", ifp->bsscfgidx,
-@@ -4239,13 +4276,13 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
- break;
- default:
- err = -EPERM;
-- brcmf_err("not suitable type\n");
-+ bphy_err(wiphy, "not suitable type\n");
- goto exit;
- }
-
- if (vndr_ie_len > mgmt_ie_buf_len) {
- err = -ENOMEM;
-- brcmf_err("extra IE size too big\n");
-+ bphy_err(wiphy, "extra IE size too big\n");
- goto exit;
- }
-
-@@ -4306,8 +4343,8 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
- /* verify remained buf size before copy data */
- if (remained_buf_len < (vndrie_info->vndrie.len +
- VNDR_IE_VSIE_OFFSET)) {
-- brcmf_err("no space in mgmt_ie_buf: len left %d",
-- remained_buf_len);
-+ bphy_err(wiphy, "no space in mgmt_ie_buf: len left %d",
-+ remained_buf_len);
- break;
- }
- remained_buf_len -= (vndrie_info->ie_len +
-@@ -4338,7 +4375,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
- err = brcmf_fil_bsscfg_data_set(ifp, "vndr_ie", iovar_ie_buf,
- total_ie_buf_len);
- if (err)
-- brcmf_err("vndr ie set error : %d\n", err);
-+ bphy_err(wiphy, "vndr ie set error : %d\n", err);
- }
-
- exit:
-@@ -4366,13 +4403,14 @@ static s32
- brcmf_config_ap_mgmt_ie(struct brcmf_cfg80211_vif *vif,
- struct cfg80211_beacon_data *beacon)
- {
-+ struct wiphy *wiphy = vif->ifp->drvr->wiphy;
- s32 err;
-
- /* Set Beacon IEs to FW */
- err = brcmf_vif_set_mgmt_ie(vif, BRCMF_VNDR_IE_BEACON_FLAG,
- beacon->tail, beacon->tail_len);
- if (err) {
-- brcmf_err("Set Beacon IE Failed\n");
-+ bphy_err(wiphy, "Set Beacon IE Failed\n");
- return err;
- }
- brcmf_dbg(TRACE, "Applied Vndr IEs for Beacon\n");
-@@ -4382,7 +4420,7 @@ brcmf_config_ap_mgmt_ie(struct brcmf_cfg
- beacon->proberesp_ies,
- beacon->proberesp_ies_len);
- if (err)
-- brcmf_err("Set Probe Resp IE Failed\n");
-+ bphy_err(wiphy, "Set Probe Resp IE Failed\n");
- else
- brcmf_dbg(TRACE, "Applied Vndr IEs for Probe Resp\n");
-
-@@ -4491,7 +4529,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY,
- is_11d);
- if (err < 0) {
-- brcmf_err("Regulatory Set Error, %d\n", err);
-+ bphy_err(wiphy, "Regulatory Set Error, %d\n",
-+ err);
- goto exit;
- }
- }
-@@ -4499,8 +4538,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD,
- settings->beacon_interval);
- if (err < 0) {
-- brcmf_err("Beacon Interval Set Error, %d\n",
-- err);
-+ bphy_err(wiphy, "Beacon Interval Set Error, %d\n",
-+ err);
- goto exit;
- }
- }
-@@ -4508,7 +4547,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_DTIMPRD,
- settings->dtim_period);
- if (err < 0) {
-- brcmf_err("DTIM Interval Set Error, %d\n", err);
-+ bphy_err(wiphy, "DTIM Interval Set Error, %d\n",
-+ err);
- goto exit;
- }
- }
-@@ -4518,7 +4558,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
- !brcmf_feat_is_enabled(ifp, BRCMF_FEAT_RSDB))) {
- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1);
- if (err < 0) {
-- brcmf_err("BRCMF_C_DOWN error %d\n", err);
-+ bphy_err(wiphy, "BRCMF_C_DOWN error %d\n",
-+ err);
- goto exit;
- }
- brcmf_fil_iovar_int_set(ifp, "apsta", 0);
-@@ -4526,7 +4567,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
-
- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, 1);
- if (err < 0) {
-- brcmf_err("SET INFRA error %d\n", err);
-+ bphy_err(wiphy, "SET INFRA error %d\n", err);
- goto exit;
- }
- } else if (WARN_ON(supports_11d && (is_11d != ifp->vif->is_11d))) {
-@@ -4542,7 +4583,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
-
- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 1);
- if (err < 0) {
-- brcmf_err("setting AP mode failed %d\n", err);
-+ bphy_err(wiphy, "setting AP mode failed %d\n",
-+ err);
- goto exit;
- }
- if (!mbss) {
-@@ -4551,14 +4593,14 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
- */
- err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec);
- if (err < 0) {
-- brcmf_err("Set Channel failed: chspec=%d, %d\n",
-- chanspec, err);
-+ bphy_err(wiphy, "Set Channel failed: chspec=%d, %d\n",
-+ chanspec, err);
- goto exit;
- }
- }
- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1);
- if (err < 0) {
-- brcmf_err("BRCMF_C_UP error (%d)\n", err);
-+ bphy_err(wiphy, "BRCMF_C_UP error (%d)\n", err);
- goto exit;
- }
- /* On DOWN the firmware removes the WEP keys, reconfigure
-@@ -4573,14 +4615,14 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
- err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
- &join_params, sizeof(join_params));
- if (err < 0) {
-- brcmf_err("SET SSID error (%d)\n", err);
-+ bphy_err(wiphy, "SET SSID error (%d)\n", err);
- goto exit;
- }
-
- if (settings->hidden_ssid) {
- err = brcmf_fil_iovar_int_set(ifp, "closednet", 1);
- if (err) {
-- brcmf_err("closednet error (%d)\n", err);
-+ bphy_err(wiphy, "closednet error (%d)\n", err);
- goto exit;
- }
- }
-@@ -4589,14 +4631,14 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
- } else if (dev_role == NL80211_IFTYPE_P2P_GO) {
- err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec);
- if (err < 0) {
-- brcmf_err("Set Channel failed: chspec=%d, %d\n",
-- chanspec, err);
-+ bphy_err(wiphy, "Set Channel failed: chspec=%d, %d\n",
-+ chanspec, err);
- goto exit;
- }
- err = brcmf_fil_bsscfg_data_set(ifp, "ssid", &ssid_le,
- sizeof(ssid_le));
- if (err < 0) {
-- brcmf_err("setting ssid failed %d\n", err);
-+ bphy_err(wiphy, "setting ssid failed %d\n", err);
- goto exit;
- }
- bss_enable.bsscfgidx = cpu_to_le32(ifp->bsscfgidx);
-@@ -4604,7 +4646,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
- err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable,
- sizeof(bss_enable));
- if (err < 0) {
-- brcmf_err("bss_enable config failed %d\n", err);
-+ bphy_err(wiphy, "bss_enable config failed %d\n", err);
- goto exit;
- }
-
-@@ -4652,13 +4694,13 @@ static int brcmf_cfg80211_stop_ap(struct
- err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
- &join_params, sizeof(join_params));
- if (err < 0)
-- brcmf_err("SET SSID error (%d)\n", err);
-+ bphy_err(wiphy, "SET SSID error (%d)\n", err);
- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1);
- if (err < 0)
-- brcmf_err("BRCMF_C_DOWN error %d\n", err);
-+ bphy_err(wiphy, "BRCMF_C_DOWN error %d\n", err);
- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 0);
- if (err < 0)
-- brcmf_err("setting AP mode failed %d\n", err);
-+ bphy_err(wiphy, "setting AP mode failed %d\n", err);
- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS))
- brcmf_fil_iovar_int_set(ifp, "mbss", 0);
- brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY,
-@@ -4666,7 +4708,7 @@ static int brcmf_cfg80211_stop_ap(struct
- /* Bring device back up so it can be used again */
- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1);
- if (err < 0)
-- brcmf_err("BRCMF_C_UP error %d\n", err);
-+ bphy_err(wiphy, "BRCMF_C_UP error %d\n", err);
-
- brcmf_vif_clear_mgmt_ies(ifp->vif);
- } else {
-@@ -4675,7 +4717,7 @@ static int brcmf_cfg80211_stop_ap(struct
- err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable,
- sizeof(bss_enable));
- if (err < 0)
-- brcmf_err("bss_enable config failed %d\n", err);
-+ bphy_err(wiphy, "bss_enable config failed %d\n", err);
- }
- brcmf_set_mpc(ifp, 1);
- brcmf_configure_arp_nd_offload(ifp, true);
-@@ -4723,7 +4765,8 @@ brcmf_cfg80211_del_station(struct wiphy
- err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCB_DEAUTHENTICATE_FOR_REASON,
- &scbval, sizeof(scbval));
- if (err)
-- brcmf_err("SCB_DEAUTHENTICATE_FOR_REASON failed %d\n", err);
-+ bphy_err(wiphy, "SCB_DEAUTHENTICATE_FOR_REASON failed %d\n",
-+ err);
-
- brcmf_dbg(TRACE, "Exit\n");
- return err;
-@@ -4753,7 +4796,7 @@ brcmf_cfg80211_change_station(struct wip
- err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SCB_DEAUTHORIZE,
- (void *)mac, ETH_ALEN);
- if (err < 0)
-- brcmf_err("Setting SCB (de-)authorize failed, %d\n", err);
-+ bphy_err(wiphy, "Setting SCB (de-)authorize failed, %d\n", err);
-
- return err;
- }
-@@ -4803,7 +4846,7 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wip
- mgmt = (const struct ieee80211_mgmt *)buf;
-
- if (!ieee80211_is_mgmt(mgmt->frame_control)) {
-- brcmf_err("Driver only allows MGMT packet type\n");
-+ bphy_err(wiphy, "Driver only allows MGMT packet type\n");
- return -EPERM;
- }
-
-@@ -4834,13 +4877,13 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wip
- GFP_KERNEL);
- } else if (ieee80211_is_action(mgmt->frame_control)) {
- if (len > BRCMF_FIL_ACTION_FRAME_SIZE + DOT11_MGMT_HDR_LEN) {
-- brcmf_err("invalid action frame length\n");
-+ bphy_err(wiphy, "invalid action frame length\n");
- err = -EINVAL;
- goto exit;
- }
- af_params = kzalloc(sizeof(*af_params), GFP_KERNEL);
- if (af_params == NULL) {
-- brcmf_err("unable to allocate frame\n");
-+ bphy_err(wiphy, "unable to allocate frame\n");
- err = -ENOMEM;
- goto exit;
- }
-@@ -4898,7 +4941,7 @@ brcmf_cfg80211_cancel_remain_on_channel(
-
- vif = cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif;
- if (vif == NULL) {
-- brcmf_err("No p2p device available for probe response\n");
-+ bphy_err(wiphy, "No p2p device available for probe response\n");
- err = -ENODEV;
- goto exit;
- }
-@@ -4926,7 +4969,7 @@ static int brcmf_cfg80211_get_channel(st
-
- err = brcmf_fil_iovar_int_get(ifp, "chanspec", &chanspec);
- if (err) {
-- brcmf_err("chanspec failed (%d)\n", err);
-+ bphy_err(wiphy, "chanspec failed (%d)\n", err);
- return err;
- }
-
-@@ -5065,7 +5108,7 @@ static int brcmf_cfg80211_tdls_oper(stru
- ret = brcmf_fil_iovar_data_set(ifp, "tdls_endpoint",
- &info, sizeof(info));
- if (ret < 0)
-- brcmf_err("tdls_endpoint iovar failed: ret=%d\n", ret);
-+ bphy_err(wiphy, "tdls_endpoint iovar failed: ret=%d\n", ret);
-
- return ret;
- }
-@@ -5086,7 +5129,7 @@ brcmf_cfg80211_update_conn_params(struct
- err = brcmf_vif_set_mgmt_ie(ifp->vif, BRCMF_VNDR_IE_ASSOCREQ_FLAG,
- sme->ie, sme->ie_len);
- if (err)
-- brcmf_err("Set Assoc REQ IE Failed\n");
-+ bphy_err(wiphy, "Set Assoc REQ IE Failed\n");
- else
- brcmf_dbg(TRACE, "Applied Vndr IEs for Assoc request\n");
-
-@@ -5112,7 +5155,7 @@ brcmf_cfg80211_set_rekey_data(struct wip
- ret = brcmf_fil_iovar_data_set(ifp, "gtk_key_info", >k_le,
- sizeof(gtk_le));
- if (ret < 0)
-- brcmf_err("gtk_key_info iovar failed: ret=%d\n", ret);
-+ bphy_err(wiphy, "gtk_key_info iovar failed: ret=%d\n", ret);
-
- return ret;
- }
-@@ -5344,6 +5387,7 @@ static void brcmf_clear_assoc_ies(struct
- static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg,
- struct brcmf_if *ifp)
- {
-+ struct wiphy *wiphy = cfg_to_wiphy(cfg);
- struct brcmf_cfg80211_assoc_ielen_le *assoc_info;
- struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg);
- u32 req_len;
-@@ -5355,7 +5399,7 @@ static s32 brcmf_get_assoc_ies(struct br
- err = brcmf_fil_iovar_data_get(ifp, "assoc_info",
- cfg->extra_buf, WL_ASSOC_INFO_MAX);
- if (err) {
-- brcmf_err("could not get assoc info (%d)\n", err);
-+ bphy_err(wiphy, "could not get assoc info (%d)\n", err);
- return err;
- }
- assoc_info =
-@@ -5367,7 +5411,7 @@ static s32 brcmf_get_assoc_ies(struct br
- cfg->extra_buf,
- WL_ASSOC_INFO_MAX);
- if (err) {
-- brcmf_err("could not get assoc req (%d)\n", err);
-+ bphy_err(wiphy, "could not get assoc req (%d)\n", err);
- return err;
- }
- conn_info->req_ie_len = req_len;
-@@ -5383,7 +5427,7 @@ static s32 brcmf_get_assoc_ies(struct br
- cfg->extra_buf,
- WL_ASSOC_INFO_MAX);
- if (err) {
-- brcmf_err("could not get assoc resp (%d)\n", err);
-+ bphy_err(wiphy, "could not get assoc resp (%d)\n", err);
- return err;
- }
- conn_info->resp_ie_len = resp_len;
-@@ -5510,6 +5554,7 @@ brcmf_notify_connect_status_ap(struct br
- struct net_device *ndev,
- const struct brcmf_event_msg *e, void *data)
- {
-+ struct wiphy *wiphy = cfg_to_wiphy(cfg);
- static int generation;
- u32 event = e->event_code;
- u32 reason = e->reason;
-@@ -5527,7 +5572,7 @@ brcmf_notify_connect_status_ap(struct br
- if (((event == BRCMF_E_ASSOC_IND) || (event == BRCMF_E_REASSOC_IND)) &&
- (reason == BRCMF_E_STATUS_SUCCESS)) {
- if (!data) {
-- brcmf_err("No IEs present in ASSOC/REASSOC_IND");
-+ bphy_err(wiphy, "No IEs present in ASSOC/REASSOC_IND\n");
- return -EINVAL;
- }
-
-@@ -5819,6 +5864,7 @@ static void init_vif_event(struct brcmf_
-
- static s32 brcmf_dongle_roam(struct brcmf_if *ifp)
- {
-+ struct wiphy *wiphy = ifp->drvr->wiphy;
- s32 err;
- u32 bcn_timeout;
- __le32 roamtrigger[2];
-@@ -5831,7 +5877,7 @@ static s32 brcmf_dongle_roam(struct brcm
- bcn_timeout = BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_ON;
- err = brcmf_fil_iovar_int_set(ifp, "bcn_timeout", bcn_timeout);
- if (err) {
-- brcmf_err("bcn_timeout error (%d)\n", err);
-+ bphy_err(wiphy, "bcn_timeout error (%d)\n", err);
- goto roam_setup_done;
- }
-
-@@ -5843,7 +5889,7 @@ static s32 brcmf_dongle_roam(struct brcm
- err = brcmf_fil_iovar_int_set(ifp, "roam_off",
- ifp->drvr->settings->roamoff);
- if (err) {
-- brcmf_err("roam_off error (%d)\n", err);
-+ bphy_err(wiphy, "roam_off error (%d)\n", err);
- goto roam_setup_done;
- }
-
-@@ -5852,7 +5898,7 @@ static s32 brcmf_dongle_roam(struct brcm
- err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_ROAM_TRIGGER,
- (void *)roamtrigger, sizeof(roamtrigger));
- if (err) {
-- brcmf_err("WLC_SET_ROAM_TRIGGER error (%d)\n", err);
-+ bphy_err(wiphy, "WLC_SET_ROAM_TRIGGER error (%d)\n", err);
- goto roam_setup_done;
- }
-
-@@ -5861,7 +5907,7 @@ static s32 brcmf_dongle_roam(struct brcm
- err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_ROAM_DELTA,
- (void *)roam_delta, sizeof(roam_delta));
- if (err) {
-- brcmf_err("WLC_SET_ROAM_DELTA error (%d)\n", err);
-+ bphy_err(wiphy, "WLC_SET_ROAM_DELTA error (%d)\n", err);
- goto roam_setup_done;
- }
-
-@@ -5872,25 +5918,26 @@ roam_setup_done:
- static s32
- brcmf_dongle_scantime(struct brcmf_if *ifp)
- {
-+ struct wiphy *wiphy = ifp->drvr->wiphy;
- s32 err = 0;
-
- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_CHANNEL_TIME,
- BRCMF_SCAN_CHANNEL_TIME);
- if (err) {
-- brcmf_err("Scan assoc time error (%d)\n", err);
-+ bphy_err(wiphy, "Scan assoc time error (%d)\n", err);
- goto dongle_scantime_out;
- }
- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_UNASSOC_TIME,
- BRCMF_SCAN_UNASSOC_TIME);
- if (err) {
-- brcmf_err("Scan unassoc time error (%d)\n", err);
-+ bphy_err(wiphy, "Scan unassoc time error (%d)\n", err);
- goto dongle_scantime_out;
- }
-
- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_PASSIVE_TIME,
- BRCMF_SCAN_PASSIVE_TIME);
- if (err) {
-- brcmf_err("Scan passive time error (%d)\n", err);
-+ bphy_err(wiphy, "Scan passive time error (%d)\n", err);
- goto dongle_scantime_out;
- }
-
-@@ -5922,10 +5969,10 @@ static void brcmf_update_bw40_channel_fl
- static int brcmf_construct_chaninfo(struct brcmf_cfg80211_info *cfg,
- u32 bw_cap[])
- {
-+ struct wiphy *wiphy = cfg_to_wiphy(cfg);
- struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
- struct ieee80211_supported_band *band;
- struct ieee80211_channel *channel;
-- struct wiphy *wiphy;
- struct brcmf_chanspec_list *list;
- struct brcmu_chan ch;
- int err;
-@@ -5944,11 +5991,10 @@ static int brcmf_construct_chaninfo(stru
- err = brcmf_fil_iovar_data_get(ifp, "chanspecs", pbuf,
- BRCMF_DCMD_MEDLEN);
- if (err) {
-- brcmf_err("get chanspecs error (%d)\n", err);
-+ bphy_err(wiphy, "get chanspecs error (%d)\n", err);
- goto fail_pbuf;
- }
-
-- wiphy = cfg_to_wiphy(cfg);
- band = wiphy->bands[NL80211_BAND_2GHZ];
- if (band)
- for (i = 0; i < band->n_channels; i++)
-@@ -5968,7 +6014,8 @@ static int brcmf_construct_chaninfo(stru
- } else if (ch.band == BRCMU_CHAN_BAND_5G) {
- band = wiphy->bands[NL80211_BAND_5GHZ];
- } else {
-- brcmf_err("Invalid channel Spec. 0x%x.\n", ch.chspec);
-+ bphy_err(wiphy, "Invalid channel Spec. 0x%x.\n",
-+ ch.chspec);
- continue;
- }
- if (!band)
-@@ -5991,8 +6038,8 @@ static int brcmf_construct_chaninfo(stru
- /* It seems firmware supports some channel we never
- * considered. Something new in IEEE standard?
- */
-- brcmf_err("Ignoring unexpected firmware channel %d\n",
-- ch.control_ch_num);
-+ bphy_err(wiphy, "Ignoring unexpected firmware channel %d\n",
-+ ch.control_ch_num);
- continue;
- }
-
-@@ -6038,6 +6085,7 @@ fail_pbuf:
-
- static int brcmf_enable_bw40_2g(struct brcmf_cfg80211_info *cfg)
- {
-+ struct wiphy *wiphy = cfg_to_wiphy(cfg);
- struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
- struct ieee80211_supported_band *band;
- struct brcmf_fil_bwcap_le band_bwcap;
-@@ -6084,7 +6132,7 @@ static int brcmf_enable_bw40_2g(struct b
- err = brcmf_fil_iovar_data_get(ifp, "chanspecs", pbuf,
- BRCMF_DCMD_MEDLEN);
- if (err) {
-- brcmf_err("get chanspecs error (%d)\n", err);
-+ bphy_err(wiphy, "get chanspecs error (%d)\n", err);
- kfree(pbuf);
- return err;
- }
-@@ -6115,6 +6163,7 @@ static int brcmf_enable_bw40_2g(struct b
-
- static void brcmf_get_bwcap(struct brcmf_if *ifp, u32 bw_cap[])
- {
-+ struct wiphy *wiphy = ifp->drvr->wiphy;
- u32 band, mimo_bwcap;
- int err;
-
-@@ -6150,7 +6199,7 @@ static void brcmf_get_bwcap(struct brcmf
- bw_cap[NL80211_BAND_5GHZ] |= WLC_BW_20MHZ_BIT;
- break;
- default:
-- brcmf_err("invalid mimo_bw_cap value\n");
-+ bphy_err(wiphy, "invalid mimo_bw_cap value\n");
- }
- }
-
-@@ -6226,7 +6275,7 @@ static void brcmf_update_vht_cap(struct
- static int brcmf_setup_wiphybands(struct brcmf_cfg80211_info *cfg)
- {
- struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
-- struct wiphy *wiphy;
-+ struct wiphy *wiphy = cfg_to_wiphy(cfg);
- u32 nmode = 0;
- u32 vhtmode = 0;
- u32 bw_cap[2] = { WLC_BW_20MHZ_BIT, WLC_BW_20MHZ_BIT };
-@@ -6242,7 +6291,7 @@ static int brcmf_setup_wiphybands(struct
- (void)brcmf_fil_iovar_int_get(ifp, "vhtmode", &vhtmode);
- err = brcmf_fil_iovar_int_get(ifp, "nmode", &nmode);
- if (err) {
-- brcmf_err("nmode error (%d)\n", err);
-+ bphy_err(wiphy, "nmode error (%d)\n", err);
- } else {
- brcmf_get_bwcap(ifp, bw_cap);
- }
-@@ -6252,7 +6301,7 @@ static int brcmf_setup_wiphybands(struct
-
- err = brcmf_fil_iovar_int_get(ifp, "rxchain", &rxchain);
- if (err) {
-- brcmf_err("rxchain error (%d)\n", err);
-+ bphy_err(wiphy, "rxchain error (%d)\n", err);
- nchain = 1;
- } else {
- for (nchain = 0; rxchain; nchain++)
-@@ -6262,7 +6311,7 @@ static int brcmf_setup_wiphybands(struct
-
- err = brcmf_construct_chaninfo(cfg, bw_cap);
- if (err) {
-- brcmf_err("brcmf_construct_chaninfo failed (%d)\n", err);
-+ bphy_err(wiphy, "brcmf_construct_chaninfo failed (%d)\n", err);
- return err;
- }
-
-@@ -6274,7 +6323,6 @@ static int brcmf_setup_wiphybands(struct
- &txbf_bfr_cap);
- }
-
-- wiphy = cfg_to_wiphy(cfg);
- for (i = 0; i < ARRAY_SIZE(wiphy->bands); i++) {
- band = wiphy->bands[i];
- if (band == NULL)
-@@ -6475,7 +6523,7 @@ static void brcmf_wiphy_wowl_params(stru
- wowl = kmemdup(&brcmf_wowlan_support, sizeof(brcmf_wowlan_support),
- GFP_KERNEL);
- if (!wowl) {
-- brcmf_err("only support basic wowlan features\n");
-+ bphy_err(wiphy, "only support basic wowlan features\n");
- wiphy->wowlan = &brcmf_wowlan_support;
- return;
- }
-@@ -6572,7 +6620,7 @@ static int brcmf_setup_wiphy(struct wiph
- err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BANDLIST, &bandlist,
- sizeof(bandlist));
- if (err) {
-- brcmf_err("could not obtain band info: err=%d\n", err);
-+ bphy_err(wiphy, "could not obtain band info: err=%d\n", err);
- return err;
- }
- /* first entry in bandlist is number of bands */
-@@ -6621,6 +6669,7 @@ static int brcmf_setup_wiphy(struct wiph
-
- static s32 brcmf_config_dongle(struct brcmf_cfg80211_info *cfg)
- {
-+ struct wiphy *wiphy = cfg_to_wiphy(cfg);
- struct net_device *ndev;
- struct wireless_dev *wdev;
- struct brcmf_if *ifp;
-@@ -6658,7 +6707,7 @@ static s32 brcmf_config_dongle(struct br
-
- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_FAKEFRAG, 1);
- if (err) {
-- brcmf_err("failed to set frameburst mode\n");
-+ bphy_err(wiphy, "failed to set frameburst mode\n");
- goto default_conf_out;
- }
-
-@@ -6850,8 +6899,8 @@ static void brcmf_cfg80211_reg_notifier(
- /* ignore non-ISO3166 country codes */
- for (i = 0; i < 2; i++)
- if (req->alpha2[i] < 'A' || req->alpha2[i] > 'Z') {
-- brcmf_err("not an ISO3166 code (0x%02x 0x%02x)\n",
-- req->alpha2[0], req->alpha2[1]);
-+ bphy_err(wiphy, "not an ISO3166 code (0x%02x 0x%02x)\n",
-+ req->alpha2[0], req->alpha2[1]);
- return;
- }
-
-@@ -6860,7 +6909,7 @@ static void brcmf_cfg80211_reg_notifier(
-
- err = brcmf_fil_iovar_data_get(ifp, "country", &ccreq, sizeof(ccreq));
- if (err) {
-- brcmf_err("Country code iovar returned err = %d\n", err);
-+ bphy_err(wiphy, "Country code iovar returned err = %d\n", err);
- return;
- }
-
-@@ -6870,7 +6919,7 @@ static void brcmf_cfg80211_reg_notifier(
-
- err = brcmf_fil_iovar_data_set(ifp, "country", &ccreq, sizeof(ccreq));
- if (err) {
-- brcmf_err("Firmware rejected country setting\n");
-+ bphy_err(wiphy, "Firmware rejected country setting\n");
- return;
- }
- brcmf_setup_wiphybands(cfg);
-@@ -6916,13 +6965,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802
- u16 *cap = NULL;
-
- if (!ndev) {
-- brcmf_err("ndev is invalid\n");
-+ bphy_err(wiphy, "ndev is invalid\n");
- return NULL;
- }
-
- cfg = kzalloc(sizeof(*cfg), GFP_KERNEL);
- if (!cfg) {
-- brcmf_err("Could not allocate wiphy device\n");
-+ bphy_err(wiphy, "Could not allocate wiphy device\n");
- return NULL;
- }
-
-@@ -6943,7 +6992,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
-
- err = wl_init_priv(cfg);
- if (err) {
-- brcmf_err("Failed to init iwm_priv (%d)\n", err);
-+ bphy_err(wiphy, "Failed to init iwm_priv (%d)\n", err);
- brcmf_free_vif(vif);
- goto wiphy_out;
- }
-@@ -6952,7 +7001,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
- /* determine d11 io type before wiphy setup */
- err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_VERSION, &io_type);
- if (err) {
-- brcmf_err("Failed to get D11 version (%d)\n", err);
-+ bphy_err(wiphy, "Failed to get D11 version (%d)\n", err);
- goto priv_out;
- }
- cfg->d11inf.io_type = (u8)io_type;
-@@ -6986,13 +7035,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802
- #endif
- err = wiphy_register(wiphy);
- if (err < 0) {
-- brcmf_err("Could not register wiphy device (%d)\n", err);
-+ bphy_err(wiphy, "Could not register wiphy device (%d)\n", err);
- goto priv_out;
- }
-
- err = brcmf_setup_wiphybands(cfg);
- if (err) {
-- brcmf_err("Setting wiphy bands failed (%d)\n", err);
-+ bphy_err(wiphy, "Setting wiphy bands failed (%d)\n", err);
- goto wiphy_unreg_out;
- }
-
-@@ -7010,24 +7059,24 @@ struct brcmf_cfg80211_info *brcmf_cfg802
-
- err = brcmf_fweh_activate_events(ifp);
- if (err) {
-- brcmf_err("FWEH activation failed (%d)\n", err);
-+ bphy_err(wiphy, "FWEH activation failed (%d)\n", err);
- goto wiphy_unreg_out;
- }
-
- err = brcmf_p2p_attach(cfg, p2pdev_forced);
- if (err) {
-- brcmf_err("P2P initialisation failed (%d)\n", err);
-+ bphy_err(wiphy, "P2P initialisation failed (%d)\n", err);
- goto wiphy_unreg_out;
- }
- err = brcmf_btcoex_attach(cfg);
- if (err) {
-- brcmf_err("BT-coex initialisation failed (%d)\n", err);
-+ bphy_err(wiphy, "BT-coex initialisation failed (%d)\n", err);
- brcmf_p2p_detach(&cfg->p2p);
- goto wiphy_unreg_out;
- }
- err = brcmf_pno_attach(cfg);
- if (err) {
-- brcmf_err("PNO initialisation failed (%d)\n", err);
-+ bphy_err(wiphy, "PNO initialisation failed (%d)\n", err);
- brcmf_btcoex_detach(cfg);
- brcmf_p2p_detach(&cfg->p2p);
- goto wiphy_unreg_out;
-@@ -7047,7 +7096,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
- /* (re-) activate FWEH event handling */
- err = brcmf_fweh_activate_events(ifp);
- if (err) {
-- brcmf_err("FWEH activation failed (%d)\n", err);
-+ bphy_err(wiphy, "FWEH activation failed (%d)\n", err);
- goto detach;
- }
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
-@@ -62,6 +62,15 @@ void __brcmf_err(struct brcmf_bus *bus,
- } while (0)
- #endif
-
-+#define bphy_err(wiphy, fmt, ...) \
-+ do { \
-+ if (IS_ENABLED(CPTCFG_BRCMDBG) || \
-+ IS_ENABLED(CPTCFG_BRCM_TRACING) || \
-+ net_ratelimit()) \
-+ wiphy_err(wiphy, "%s: " fmt, __func__, \
-+ ##__VA_ARGS__); \
-+ } while (0)
-+
- #if defined(DEBUG) || defined(CPTCFG_BRCM_TRACING)
-
- /* For debug/tracing purposes treat info messages as errors */
+++ /dev/null
-From 2359dd09f9819c7d57d81e05173541f0f9f820c7 Mon Sep 17 00:00:00 2001
-From: Matteo Croce <mcroce@redhat.com>
-Date: Tue, 29 Jan 2019 18:47:17 +0100
-Subject: [PATCH] brcmfmac: fix typos
-
-Fix spelling mistakes in brcmfmac: "lenght" -> "length".
-The typos are also in the special comment blocks which
-translates to documentation.
-
-Signed-off-by: Matteo Croce <mcroce@redhat.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h | 2 +-
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c | 2 +-
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h | 2 +-
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 2 +-
- 4 files changed, 4 insertions(+), 4 deletions(-)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
-@@ -36,7 +36,7 @@
- #define BRCMF_DCMD_MEDLEN 1536
- #define BRCMF_DCMD_MAXLEN 8192
-
--/* IOCTL from host to device are limited in lenght. A device can only handle
-+/* IOCTL from host to device are limited in length. A device can only handle
- * ethernet frame size. This limitation is to be applied by protocol layer.
- */
- #define BRCMF_TX_IOCTL_MAX_MSG_SIZE (ETH_FRAME_LEN+ETH_FCS_LEN)
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
-@@ -47,7 +47,7 @@ enum nvram_parser_state {
- * @state: current parser state.
- * @data: input buffer being parsed.
- * @nvram: output buffer with parse result.
-- * @nvram_len: lenght of parse result.
-+ * @nvram_len: length of parse result.
- * @line: current line.
- * @column: current column in line.
- * @pos: byte offset in input buffer.
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h
-@@ -266,7 +266,7 @@ struct brcmf_event {
- * @status: status information.
- * @reason: reason code.
- * @auth_type: authentication type.
-- * @datalen: lenght of event data buffer.
-+ * @datalen: length of event data buffer.
- * @addr: ether address.
- * @ifname: interface name.
- * @ifidx: interface index.
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
-@@ -508,7 +508,7 @@ static void brcmf_usb_rx_complete(struct
- skb = req->skb;
- req->skb = NULL;
-
-- /* zero lenght packets indicate usb "failure". Do not refill */
-+ /* zero length packets indicate usb "failure". Do not refill */
- if (urb->status != 0 || !urb->actual_length) {
- brcmu_pkt_buf_free_skb(skb);
- brcmf_usb_enq(devinfo, &devinfo->rx_freeq, req, NULL);
+++ /dev/null
-From e665988be29ccea3584528967b432a5cfd801ca4 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Fri, 8 Feb 2019 07:42:30 +0100
-Subject: [PATCH] brcmfmac: support monitor frames with the hardware/ucode
- header
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-So far there were two monitor frame formats:
-1) 802.11 frames (with frame (sub)type & all addresses)
-2) 802.11 frames with the radiotap header
-
-Testing the latest FullMAC firmwares for 4366b1/4366c0 resulted in
-discovering a new format being used. It seems (almost?) identical to the
-one known from ucode used in SoftMAC devices which is most likely the
-same codebase anyway.
-
-While new firmwares will /announce/ radiotap header support using the
-"rtap" fw capability string it seems no string was added for the new
-ucode header format.
-
-All above means that:
-1) We need new format support when dealing with a received frame
-2) A new feature bit & mapping quirks have to be added manually
-
-As for now only an empty radiotap is being created. Adding support for
-extracting some info (band, channel, signal, etc.) is planned for the
-future.
-
-Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
-Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- .../broadcom/brcm80211/brcmfmac/core.c | 55 +++++++++++++++++++
- .../broadcom/brcm80211/brcmfmac/feature.c | 4 ++
- .../broadcom/brcm80211/brcmfmac/feature.h | 4 +-
- 3 files changed, 62 insertions(+), 1 deletion(-)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-@@ -43,6 +43,36 @@
-
- #define BRCMF_BSSIDX_INVALID -1
-
-+#define RXS_PBPRES BIT(2)
-+
-+#define D11_PHY_HDR_LEN 6
-+
-+struct d11rxhdr_le {
-+ __le16 RxFrameSize;
-+ u16 PAD;
-+ __le16 PhyRxStatus_0;
-+ __le16 PhyRxStatus_1;
-+ __le16 PhyRxStatus_2;
-+ __le16 PhyRxStatus_3;
-+ __le16 PhyRxStatus_4;
-+ __le16 PhyRxStatus_5;
-+ __le16 RxStatus1;
-+ __le16 RxStatus2;
-+ __le16 RxTSFTime;
-+ __le16 RxChan;
-+ u8 unknown[12];
-+} __packed;
-+
-+struct wlc_d11rxhdr {
-+ struct d11rxhdr_le rxhdr;
-+ __le32 tsf_l;
-+ s8 rssi;
-+ s8 rxpwr0;
-+ s8 rxpwr1;
-+ s8 do_rssi_ma;
-+ s8 rxpwr[4];
-+} __packed;
-+
- char *brcmf_ifname(struct brcmf_if *ifp)
- {
- if (!ifp)
-@@ -409,6 +439,31 @@ void brcmf_netif_mon_rx(struct brcmf_if
- {
- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MONITOR_FMT_RADIOTAP)) {
- /* Do nothing */
-+ } else if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MONITOR_FMT_HW_RX_HDR)) {
-+ struct wlc_d11rxhdr *wlc_rxhdr = (struct wlc_d11rxhdr *)skb->data;
-+ struct ieee80211_radiotap_header *radiotap;
-+ unsigned int offset;
-+ u16 RxStatus1;
-+
-+ RxStatus1 = le16_to_cpu(wlc_rxhdr->rxhdr.RxStatus1);
-+
-+ offset = sizeof(struct wlc_d11rxhdr);
-+ /* MAC inserts 2 pad bytes for a4 headers or QoS or A-MSDU
-+ * subframes
-+ */
-+ if (RxStatus1 & RXS_PBPRES)
-+ offset += 2;
-+ offset += D11_PHY_HDR_LEN;
-+
-+ skb_pull(skb, offset);
-+
-+ /* TODO: use RX header to fill some radiotap data */
-+ radiotap = skb_push(skb, sizeof(*radiotap));
-+ memset(radiotap, 0, sizeof(*radiotap));
-+ radiotap->it_len = cpu_to_le16(sizeof(*radiotap));
-+
-+ /* TODO: 4 bytes with receive status? */
-+ skb->len -= 4;
- } else {
- struct ieee80211_radiotap_header *radiotap;
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
-@@ -103,6 +103,10 @@ static const struct brcmf_feat_fwfeat br
- { "01-6cb8e269", BIT(BRCMF_FEAT_MONITOR) },
- /* brcmfmac4366b-pcie.bin from linux-firmware.git commit 52442afee990 */
- { "01-c47a91a4", BIT(BRCMF_FEAT_MONITOR) },
-+ /* brcmfmac4366b-pcie.bin from linux-firmware.git commit 211de1679a68 */
-+ { "01-801fb449", BIT(BRCMF_FEAT_MONITOR_FMT_HW_RX_HDR) },
-+ /* brcmfmac4366c-pcie.bin from linux-firmware.git commit 211de1679a68 */
-+ { "01-d2cbb8fd", BIT(BRCMF_FEAT_MONITOR_FMT_HW_RX_HDR) },
- };
-
- static void brcmf_feat_firmware_overrides(struct brcmf_pub *drv)
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h
-@@ -35,6 +35,7 @@
- * FWSUP: Firmware supplicant.
- * MONITOR: firmware can pass monitor packets to host.
- * MONITOR_FMT_RADIOTAP: firmware provides monitor packets with radiotap header
-+ * MONITOR_FMT_HW_RX_HDR: firmware provides monitor packets with hw/ucode header
- */
- #define BRCMF_FEAT_LIST \
- BRCMF_FEAT_DEF(MBSS) \
-@@ -52,7 +53,8 @@
- BRCMF_FEAT_DEF(GSCAN) \
- BRCMF_FEAT_DEF(FWSUP) \
- BRCMF_FEAT_DEF(MONITOR) \
-- BRCMF_FEAT_DEF(MONITOR_FMT_RADIOTAP)
-+ BRCMF_FEAT_DEF(MONITOR_FMT_RADIOTAP) \
-+ BRCMF_FEAT_DEF(MONITOR_FMT_HW_RX_HDR)
-
- /*
- * Quirks:
+++ /dev/null
-From 1b5e2423164b3670e8bc9174e4762d297990deff Mon Sep 17 00:00:00 2001
-From: Arend van Spriel <arend.vanspriel@broadcom.com>
-Date: Thu, 14 Feb 2019 13:43:47 +0100
-Subject: [PATCH] brcmfmac: assure SSID length from firmware is limited
-
-The SSID length as received from firmware should not exceed
-IEEE80211_MAX_SSID_LEN as that would result in heap overflow.
-
-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>
----
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 2 ++
- 1 file changed, 2 insertions(+)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
-@@ -3507,6 +3507,8 @@ brcmf_wowl_nd_results(struct brcmf_if *i
- }
-
- netinfo = brcmf_get_netinfo_array(pfn_result);
-+ if (netinfo->SSID_len > IEEE80211_MAX_SSID_LEN)
-+ netinfo->SSID_len = IEEE80211_MAX_SSID_LEN;
- memcpy(cfg->wowl.nd->ssid.ssid, netinfo->SSID, netinfo->SSID_len);
- cfg->wowl.nd->ssid.ssid_len = netinfo->SSID_len;
- cfg->wowl.nd->n_channels = 1;
+++ /dev/null
-From a4176ec356c73a46c07c181c6d04039fafa34a9f Mon Sep 17 00:00:00 2001
-From: Arend van Spriel <arend.vanspriel@broadcom.com>
-Date: Thu, 14 Feb 2019 13:43:48 +0100
-Subject: [PATCH] brcmfmac: add subtype check for event handling in data path
-
-For USB there is no separate channel being used to pass events
-from firmware to the host driver and as such are passed over the
-data path. In order to detect mock event messages an additional
-check is needed on event subtype. This check is added conditionally
-using unlikely() keyword.
-
-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/core.c | 5 +++--
- .../wireless/broadcom/brcm80211/brcmfmac/fweh.h | 16 ++++++++++++----
- .../broadcom/brcm80211/brcmfmac/msgbuf.c | 2 +-
- 3 files changed, 16 insertions(+), 7 deletions(-)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-@@ -519,7 +519,8 @@ void brcmf_rx_frame(struct device *dev,
- } else {
- /* Process special event packets */
- if (handle_event)
-- brcmf_fweh_process_skb(ifp->drvr, skb);
-+ brcmf_fweh_process_skb(ifp->drvr, skb,
-+ BCMILCP_SUBTYPE_VENDOR_LONG);
-
- brcmf_netif_rx(ifp, skb);
- }
-@@ -536,7 +537,7 @@ void brcmf_rx_event(struct device *dev,
- if (brcmf_rx_hdrpull(drvr, skb, &ifp))
- return;
-
-- brcmf_fweh_process_skb(ifp->drvr, skb);
-+ brcmf_fweh_process_skb(ifp->drvr, skb, 0);
- brcmu_pkt_buf_free_skb(skb);
- }
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h
-@@ -211,7 +211,7 @@ enum brcmf_fweh_event_code {
- */
- #define BRCM_OUI "\x00\x10\x18"
- #define BCMILCP_BCM_SUBTYPE_EVENT 1
--
-+#define BCMILCP_SUBTYPE_VENDOR_LONG 32769
-
- /**
- * struct brcm_ethhdr - broadcom specific ether header.
-@@ -334,10 +334,10 @@ void brcmf_fweh_process_event(struct brc
- void brcmf_fweh_p2pdev_setup(struct brcmf_if *ifp, bool ongoing);
-
- static inline void brcmf_fweh_process_skb(struct brcmf_pub *drvr,
-- struct sk_buff *skb)
-+ struct sk_buff *skb, u16 stype)
- {
- struct brcmf_event *event_packet;
-- u16 usr_stype;
-+ u16 subtype, usr_stype;
-
- /* only process events when protocol matches */
- if (skb->protocol != cpu_to_be16(ETH_P_LINK_CTL))
-@@ -346,8 +346,16 @@ static inline void brcmf_fweh_process_sk
- if ((skb->len + ETH_HLEN) < sizeof(*event_packet))
- return;
-
-- /* check for BRCM oui match */
- event_packet = (struct brcmf_event *)skb_mac_header(skb);
-+
-+ /* check subtype if needed */
-+ if (unlikely(stype)) {
-+ subtype = get_unaligned_be16(&event_packet->hdr.subtype);
-+ if (subtype != stype)
-+ return;
-+ }
-+
-+ /* check for BRCM oui match */
- if (memcmp(BRCM_OUI, &event_packet->hdr.oui[0],
- sizeof(event_packet->hdr.oui)))
- return;
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
-@@ -1116,7 +1116,7 @@ static void brcmf_msgbuf_process_event(s
-
- skb->protocol = eth_type_trans(skb, ifp->ndev);
-
-- brcmf_fweh_process_skb(ifp->drvr, skb);
-+ brcmf_fweh_process_skb(ifp->drvr, skb, 0);
-
- exit:
- brcmu_pkt_buf_free_skb(skb);
+++ /dev/null
-From aaf6a5e86e36766abbeedf220462bde8031f9a72 Mon Sep 17 00:00:00 2001
-From: Arend van Spriel <arend.vanspriel@broadcom.com>
-Date: Thu, 14 Feb 2019 13:43:49 +0100
-Subject: [PATCH] brcmfmac: create debugfs files for bus-specific layer
-
-Since we moved the drivers debugfs directory under ieee80211 debugfs the
-debugfs entries need to be added after wiphy_register() has been called.
-For most part that has been done accordingly, but for the debugfs entries
-added by SDIO it was not and failed silently. This patch fixes that by
-adding a bus-layer callback for it.
-
-Fixes: 856d5a011c86 ("brcmfmac: allocate struct brcmf_pub instance using wiphy_new()")
-Reported-by: Russel King <linux@armlinux.org.uk>
-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>
----
- .../net/wireless/broadcom/brcm80211/brcmfmac/bus.h | 10 ++++++++++
- .../net/wireless/broadcom/brcm80211/brcmfmac/core.c | 1 +
- .../net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 12 +++++++-----
- 3 files changed, 18 insertions(+), 5 deletions(-)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
-@@ -90,6 +90,7 @@ struct brcmf_bus_ops {
- int (*get_memdump)(struct device *dev, void *data, size_t len);
- int (*get_fwname)(struct device *dev, const char *ext,
- unsigned char *fw_name);
-+ void (*debugfs_create)(struct device *dev);
- };
-
-
-@@ -235,6 +236,15 @@ int brcmf_bus_get_fwname(struct brcmf_bu
- return bus->ops->get_fwname(bus->dev, ext, fw_name);
- }
-
-+static inline
-+void brcmf_bus_debugfs_create(struct brcmf_bus *bus)
-+{
-+ if (!bus->ops->debugfs_create)
-+ return;
-+
-+ return bus->ops->debugfs_create(bus->dev);
-+}
-+
- /*
- * interface functions from common layer
- */
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-@@ -1177,6 +1177,7 @@ static int brcmf_bus_started(struct brcm
- brcmf_debugfs_add_entry(drvr, "revinfo", brcmf_revinfo_read);
- brcmf_feat_debugfs_create(drvr);
- brcmf_proto_debugfs_create(drvr);
-+ brcmf_bus_debugfs_create(bus_if);
-
- return 0;
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
-@@ -3143,9 +3143,12 @@ static int brcmf_debugfs_sdio_count_read
- return 0;
- }
-
--static void brcmf_sdio_debugfs_create(struct brcmf_sdio *bus)
-+static void brcmf_sdio_debugfs_create(struct device *dev)
- {
-- struct brcmf_pub *drvr = bus->sdiodev->bus_if->drvr;
-+ struct brcmf_bus *bus_if = dev_get_drvdata(dev);
-+ struct brcmf_pub *drvr = bus_if->drvr;
-+ struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
-+ struct brcmf_sdio *bus = sdiodev->bus;
- struct dentry *dentry = brcmf_debugfs_get_devdir(drvr);
-
- if (IS_ERR_OR_NULL(dentry))
-@@ -3165,7 +3168,7 @@ static int brcmf_sdio_checkdied(struct b
- return 0;
- }
-
--static void brcmf_sdio_debugfs_create(struct brcmf_sdio *bus)
-+static void brcmf_sdio_debugfs_create(struct device *dev)
- {
- }
- #endif /* DEBUG */
-@@ -3477,8 +3480,6 @@ static int brcmf_sdio_bus_preinit(struct
- if (bus->rxbuf)
- bus->rxblen = value;
-
-- brcmf_sdio_debugfs_create(bus);
--
- /* the commands below use the terms tx and rx from
- * a device perspective, ie. bus:txglom affects the
- * bus transfers from device to host.
-@@ -4088,6 +4089,7 @@ static const struct brcmf_bus_ops brcmf_
- .get_ramsize = brcmf_sdio_bus_get_ramsize,
- .get_memdump = brcmf_sdio_bus_get_memdump,
- .get_fwname = brcmf_sdio_get_fwname,
-+ .debugfs_create = brcmf_sdio_debugfs_create
- };
-
- #define BRCMF_SDIO_FW_CODE 0
+++ /dev/null
-From 92d3b88b1029c46f9bf27302c502dc0e3541805b Mon Sep 17 00:00:00 2001
-From: Arend van Spriel <arend.vanspriel@broadcom.com>
-Date: Thu, 14 Feb 2019 13:43:50 +0100
-Subject: [PATCH] brcmfmac: disable MBSS feature for bcm4330 device
-
-The MBSS feature was already disabled for bcm43362 as it resulted in a
-beacon with BRCM_TEST_SSID regardless user configuration in hostapd. Now
-the same has been reported for bcm4330 so disable the feature for this
-device as well.
-
-Reported-by: Russell King <linux@armlinux.org.uk>
-Tested-by: Christopher Martin <chrsmrtn@gmail.com>
-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>
----
- .../net/wireless/broadcom/brcm80211/brcmfmac/feature.c | 10 ++++++++--
- 1 file changed, 8 insertions(+), 2 deletions(-)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
-@@ -272,9 +272,15 @@ void brcmf_feat_attach(struct brcmf_pub
- BIT(BRCMF_FEAT_WOWL_GTK);
- }
- }
-- /* MBSS does not work for 43362 */
-- if (drvr->bus_if->chip == BRCM_CC_43362_CHIP_ID)
-+ /* MBSS does not work for all chips */
-+ switch (drvr->bus_if->chip) {
-+ case BRCM_CC_4330_CHIP_ID:
-+ case BRCM_CC_43362_CHIP_ID:
- ifp->drvr->feat_flags &= ~BIT(BRCMF_FEAT_MBSS);
-+ break;
-+ default:
-+ break;
-+ }
- brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_RSDB, "rsdb_mode");
- brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_TDLS, "tdls_enable");
- brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_MFP, "mfp");
+++ /dev/null
-From 4ab2cf03da91785f2c34d79a302e53da06928bc1 Mon Sep 17 00:00:00 2001
-From: Arend van Spriel <arend.vanspriel@broadcom.com>
-Date: Thu, 14 Feb 2019 13:43:51 +0100
-Subject: [PATCH] brcmfmac: check and dump trap info during sdio probe
-
-When the firmware crashes during the probe sequence we provide little
-information on what really failed. This patch checks the sdpcm shared
-location and show the trap information if a firmware trap has happened.
-
-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>
----
- .../broadcom/brcm80211/brcmfmac/sdio.c | 59 +++++++++++++------
- 1 file changed, 40 insertions(+), 19 deletions(-)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
-@@ -2999,21 +2999,35 @@ static int brcmf_sdio_trap_info(struct s
- if (error < 0)
- return error;
-
-- seq_printf(seq,
-- "dongle trap info: type 0x%x @ epc 0x%08x\n"
-- " cpsr 0x%08x spsr 0x%08x sp 0x%08x\n"
-- " lr 0x%08x pc 0x%08x offset 0x%x\n"
-- " r0 0x%08x r1 0x%08x r2 0x%08x r3 0x%08x\n"
-- " r4 0x%08x r5 0x%08x r6 0x%08x r7 0x%08x\n",
-- le32_to_cpu(tr.type), le32_to_cpu(tr.epc),
-- le32_to_cpu(tr.cpsr), le32_to_cpu(tr.spsr),
-- le32_to_cpu(tr.r13), le32_to_cpu(tr.r14),
-- le32_to_cpu(tr.pc), sh->trap_addr,
-- le32_to_cpu(tr.r0), le32_to_cpu(tr.r1),
-- le32_to_cpu(tr.r2), le32_to_cpu(tr.r3),
-- le32_to_cpu(tr.r4), le32_to_cpu(tr.r5),
-- le32_to_cpu(tr.r6), le32_to_cpu(tr.r7));
--
-+ if (seq)
-+ seq_printf(seq,
-+ "dongle trap info: type 0x%x @ epc 0x%08x\n"
-+ " cpsr 0x%08x spsr 0x%08x sp 0x%08x\n"
-+ " lr 0x%08x pc 0x%08x offset 0x%x\n"
-+ " r0 0x%08x r1 0x%08x r2 0x%08x r3 0x%08x\n"
-+ " r4 0x%08x r5 0x%08x r6 0x%08x r7 0x%08x\n",
-+ le32_to_cpu(tr.type), le32_to_cpu(tr.epc),
-+ le32_to_cpu(tr.cpsr), le32_to_cpu(tr.spsr),
-+ le32_to_cpu(tr.r13), le32_to_cpu(tr.r14),
-+ le32_to_cpu(tr.pc), sh->trap_addr,
-+ le32_to_cpu(tr.r0), le32_to_cpu(tr.r1),
-+ le32_to_cpu(tr.r2), le32_to_cpu(tr.r3),
-+ le32_to_cpu(tr.r4), le32_to_cpu(tr.r5),
-+ le32_to_cpu(tr.r6), le32_to_cpu(tr.r7));
-+ else
-+ pr_debug("dongle trap info: type 0x%x @ epc 0x%08x\n"
-+ " cpsr 0x%08x spsr 0x%08x sp 0x%08x\n"
-+ " lr 0x%08x pc 0x%08x offset 0x%x\n"
-+ " r0 0x%08x r1 0x%08x r2 0x%08x r3 0x%08x\n"
-+ " r4 0x%08x r5 0x%08x r6 0x%08x r7 0x%08x\n",
-+ le32_to_cpu(tr.type), le32_to_cpu(tr.epc),
-+ le32_to_cpu(tr.cpsr), le32_to_cpu(tr.spsr),
-+ le32_to_cpu(tr.r13), le32_to_cpu(tr.r14),
-+ le32_to_cpu(tr.pc), sh->trap_addr,
-+ le32_to_cpu(tr.r0), le32_to_cpu(tr.r1),
-+ le32_to_cpu(tr.r2), le32_to_cpu(tr.r3),
-+ le32_to_cpu(tr.r4), le32_to_cpu(tr.r5),
-+ le32_to_cpu(tr.r6), le32_to_cpu(tr.r7));
- return 0;
- }
-
-@@ -3067,8 +3081,10 @@ static int brcmf_sdio_checkdied(struct b
- else if (sh.flags & SDPCM_SHARED_ASSERT)
- brcmf_err("assertion in dongle\n");
-
-- if (sh.flags & SDPCM_SHARED_TRAP)
-+ if (sh.flags & SDPCM_SHARED_TRAP) {
- brcmf_err("firmware trap in dongle\n");
-+ brcmf_sdio_trap_info(NULL, bus, &sh);
-+ }
-
- return 0;
- }
-@@ -4199,7 +4215,7 @@ static void brcmf_sdio_firmware_callback
- } else {
- /* Disable F2 again */
- sdio_disable_func(sdiod->func2);
-- goto release;
-+ goto checkdied;
- }
-
- if (brcmf_chip_sr_capable(bus->ci)) {
-@@ -4220,8 +4236,10 @@ static void brcmf_sdio_firmware_callback
- }
-
- /* If we didn't come up, turn off backplane clock */
-- if (err != 0)
-+ if (err != 0) {
- brcmf_sdio_clkctl(bus, CLK_NONE, false);
-+ goto checkdied;
-+ }
-
- sdio_release_host(sdiod->func1);
-
-@@ -4235,12 +4253,15 @@ static void brcmf_sdio_firmware_callback
- err = brcmf_attach(sdiod->dev, sdiod->settings);
- if (err != 0) {
- brcmf_err("brcmf_attach failed\n");
-- goto fail;
-+ sdio_claim_host(sdiod->func1);
-+ goto checkdied;
- }
-
- /* ready */
- return;
-
-+checkdied:
-+ brcmf_sdio_checkdied(bus);
- release:
- sdio_release_host(sdiod->func1);
- fail:
+++ /dev/null
-From a250c91c1762e85c736e67cb4a9a95ebae72e62d Mon Sep 17 00:00:00 2001
-From: Arend van Spriel <arend.vanspriel@broadcom.com>
-Date: Thu, 14 Feb 2019 13:43:52 +0100
-Subject: [PATCH] brcmfmac: use chipname in brcmf_fw_alloc_request() for error
- path as well
-
-The local variable chipname is string representation of chip id and revision
-which is printed in the good flow of brcmf_fw_alloc_request(). Also use it
-for the error path, ie. for unknown/unsupported devices.
-
-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>
----
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
-@@ -719,8 +719,10 @@ brcmf_fw_alloc_request(u32 chip, u32 chi
- break;
- }
-
-+ brcmf_chip_name(chip, chiprev, chipname, sizeof(chipname));
-+
- if (i == table_size) {
-- brcmf_err("Unknown chipid %d [%d]\n", chip, chiprev);
-+ brcmf_err("Unknown chip %s\n", chipname);
- return NULL;
- }
-
-@@ -729,8 +731,6 @@ brcmf_fw_alloc_request(u32 chip, u32 chi
- if (!fwreq)
- return NULL;
-
-- brcmf_chip_name(chip, chiprev, chipname, sizeof(chipname));
--
- brcmf_info("using %s for chip %s\n",
- mapping_table[i].fw_base, chipname);
-
+++ /dev/null
-From c988b78244df8216902e20de536434e2f474a37e Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Fri, 8 Feb 2019 15:24:39 +0100
-Subject: [PATCH] brcmfmac: print firmware reported ring status errors
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Firmware is capable of reporting ring status. It's used e.g. to signal
-some problem with a specific ring setup. This patch adds support for
-printing ring & error number which may be useful for debugging setup
-issues.
-
-Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- .../broadcom/brcm80211/brcmfmac/msgbuf.c | 25 +++++++++++++++++++
- 1 file changed, 25 insertions(+)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
-@@ -134,6 +134,14 @@ struct msgbuf_completion_hdr {
- __le16 flow_ring_id;
- };
-
-+/* Data struct for the MSGBUF_TYPE_RING_STATUS */
-+struct msgbuf_ring_status {
-+ struct msgbuf_common_hdr msg;
-+ struct msgbuf_completion_hdr compl_hdr;
-+ __le16 write_idx;
-+ __le32 rsvd0[5];
-+};
-+
- struct msgbuf_rx_event {
- struct msgbuf_common_hdr msg;
- struct msgbuf_completion_hdr compl_hdr;
-@@ -1180,6 +1188,19 @@ brcmf_msgbuf_process_rx_complete(struct
- brcmf_netif_rx(ifp, skb);
- }
-
-+static void brcmf_msgbuf_process_ring_status(struct brcmf_msgbuf *msgbuf,
-+ void *buf)
-+{
-+ struct msgbuf_ring_status *ring_status = buf;
-+ int err;
-+
-+ err = le16_to_cpu(ring_status->compl_hdr.status);
-+ if (err) {
-+ int ring = le16_to_cpu(ring_status->compl_hdr.flow_ring_id);
-+
-+ brcmf_err("Firmware reported ring %d error: %d\n", ring, err);
-+ }
-+}
-
- static void
- brcmf_msgbuf_process_flow_ring_create_response(struct brcmf_msgbuf *msgbuf,
-@@ -1241,6 +1262,10 @@ static void brcmf_msgbuf_process_msgtype
-
- msg = (struct msgbuf_common_hdr *)buf;
- switch (msg->msgtype) {
-+ case MSGBUF_TYPE_RING_STATUS:
-+ brcmf_dbg(MSGBUF, "MSGBUF_TYPE_RING_STATUS\n");
-+ brcmf_msgbuf_process_ring_status(msgbuf, buf);
-+ break;
- case MSGBUF_TYPE_FLOW_RING_CREATE_CMPLT:
- brcmf_dbg(MSGBUF, "MSGBUF_TYPE_FLOW_RING_CREATE_CMPLT\n");
- brcmf_msgbuf_process_flow_ring_create_response(msgbuf, buf);
+++ /dev/null
-From f4e183293b871c96c0220dcc549d5ca4c72628ad Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Mon, 11 Feb 2019 23:04:53 +0100
-Subject: [PATCH] brcmfmac: improve code handling bandwidth of firmware
- reported channels
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-1) Use switch to simplify/improve the code & avoid some duplication
-2) Add warning for unsupported values
-
-Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- .../wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 13 ++++++++++---
- 1 file changed, 10 insertions(+), 3 deletions(-)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
-@@ -6051,11 +6051,18 @@ static int brcmf_construct_chaninfo(stru
- /* assuming the chanspecs order is HT20,
- * HT40 upper, HT40 lower, and VHT80.
- */
-- if (ch.bw == BRCMU_CHAN_BW_80) {
-+ switch (ch.bw) {
-+ case BRCMU_CHAN_BW_80:
- channel->flags &= ~IEEE80211_CHAN_NO_80MHZ;
-- } else if (ch.bw == BRCMU_CHAN_BW_40) {
-+ break;
-+ case BRCMU_CHAN_BW_40:
- brcmf_update_bw40_channel_flag(channel, &ch);
-- } else {
-+ break;
-+ default:
-+ wiphy_warn(wiphy, "Firmware reported unsupported bandwidth %d\n",
-+ ch.bw);
-+ /* fall through */
-+ case BRCMU_CHAN_BW_20:
- /* enable the channel and disable other bandwidths
- * for now as mentioned order assure they are enabled
- * for subsequent chanspecs.
+++ /dev/null
-From 30519cbe339a45bd11a57ca8ece07f4f6a1cda2e Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Mon, 11 Feb 2019 23:04:54 +0100
-Subject: [PATCH] brcmfmac: support firmware reporting 160 MHz channels
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-So far 160 MHz channels were treated as 20 MHz ones which was breaking
-support for 40/80 MHz due to the brcmf_construct_chaninfo() logic and
-its assumptions.
-
-Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 3 +++
- 1 file changed, 3 insertions(+)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
-@@ -6052,6 +6052,9 @@ static int brcmf_construct_chaninfo(stru
- * HT40 upper, HT40 lower, and VHT80.
- */
- switch (ch.bw) {
-+ case BRCMU_CHAN_BW_160:
-+ channel->flags &= ~IEEE80211_CHAN_NO_160MHZ;
-+ break;
- case BRCMU_CHAN_BW_80:
- channel->flags &= ~IEEE80211_CHAN_NO_80MHZ;
- break;
+++ /dev/null
-From 16e646768396339b3d354985b99bcd3f1f195a7d Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Fri, 15 Feb 2019 15:45:54 +0100
-Subject: [PATCH] brcmfmac: rework bphy_err() to take struct brcmf_pub argument
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This macro will be used in more places not just the cfg80211.c. It makes
-sense to pass some common struct to it as "struct wiphy" is mostly
-referenced in cfg80211 code only.
-
-A very common one (used above the bus abstraction layer) is struct
-brcmf_pub. Many functions already keep reference to it which will make
-using bphy_err() simpler. It should also allow extending that macro's
-logic if it's ever needed.
-
-This improves code recently added in the commit 3ef005b82e2a ("brcmfmac:
-add bphy_err() and use it in the cfg80211.c").
-
-Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- .../broadcom/brcm80211/brcmfmac/cfg80211.c | 510 ++++++++++--------
- .../broadcom/brcm80211/brcmfmac/debug.h | 4 +-
- 2 files changed, 281 insertions(+), 233 deletions(-)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
-@@ -457,7 +457,7 @@ static void convert_key_from_CPU(struct
- static int
- send_key_to_dongle(struct brcmf_if *ifp, struct brcmf_wsec_key *key)
- {
-- struct wiphy *wiphy = ifp->drvr->wiphy;
-+ struct brcmf_pub *drvr = ifp->drvr;
- int err;
- struct brcmf_wsec_key_le key_le;
-
-@@ -469,7 +469,7 @@ send_key_to_dongle(struct brcmf_if *ifp,
- sizeof(key_le));
-
- if (err)
-- bphy_err(wiphy, "wsec_key error (%d)\n", err);
-+ bphy_err(drvr, "wsec_key error (%d)\n", err);
- return err;
- }
-
-@@ -509,7 +509,7 @@ static int brcmf_get_first_free_bsscfgid
-
- static int brcmf_cfg80211_request_ap_if(struct brcmf_if *ifp)
- {
-- struct wiphy *wiphy = ifp->drvr->wiphy;
-+ struct brcmf_pub *drvr = ifp->drvr;
- struct brcmf_mbss_ssid_le mbss_ssid_le;
- int bsscfgidx;
- int err;
-@@ -526,7 +526,7 @@ static int brcmf_cfg80211_request_ap_if(
- err = brcmf_fil_bsscfg_data_set(ifp, "bsscfg:ssid", &mbss_ssid_le,
- sizeof(mbss_ssid_le));
- if (err < 0)
-- bphy_err(wiphy, "setting ssid failed %d\n", err);
-+ bphy_err(drvr, "setting ssid failed %d\n", err);
-
- return err;
- }
-@@ -544,6 +544,7 @@ struct wireless_dev *brcmf_ap_add_vif(st
- {
- struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
- struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg));
-+ struct brcmf_pub *drvr = cfg->pub;
- struct brcmf_cfg80211_vif *vif;
- int err;
-
-@@ -569,7 +570,7 @@ struct wireless_dev *brcmf_ap_add_vif(st
- BRCMF_VIF_EVENT_TIMEOUT);
- brcmf_cfg80211_arm_vif_event(cfg, NULL);
- if (!err) {
-- bphy_err(wiphy, "timeout occurred\n");
-+ bphy_err(drvr, "timeout occurred\n");
- err = -EIO;
- goto fail;
- }
-@@ -577,7 +578,7 @@ struct wireless_dev *brcmf_ap_add_vif(st
- /* interface created in firmware */
- ifp = vif->ifp;
- if (!ifp) {
-- bphy_err(wiphy, "no if pointer provided\n");
-+ bphy_err(drvr, "no if pointer provided\n");
- err = -ENOENT;
- goto fail;
- }
-@@ -585,7 +586,7 @@ struct wireless_dev *brcmf_ap_add_vif(st
- strncpy(ifp->ndev->name, name, sizeof(ifp->ndev->name) - 1);
- err = brcmf_net_attach(ifp, true);
- if (err) {
-- bphy_err(wiphy, "Registering netdevice failed\n");
-+ bphy_err(drvr, "Registering netdevice failed\n");
- free_netdev(ifp->ndev);
- goto fail;
- }
-@@ -616,13 +617,15 @@ static struct wireless_dev *brcmf_cfg802
- enum nl80211_iftype type,
- struct vif_params *params)
- {
-+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
-+ struct brcmf_pub *drvr = cfg->pub;
- struct wireless_dev *wdev;
- int err;
-
- brcmf_dbg(TRACE, "enter: %s type %d\n", name, type);
- err = brcmf_vif_add_validate(wiphy_to_cfg(wiphy), type);
- if (err) {
-- bphy_err(wiphy, "iface validation failed: err=%d\n", err);
-+ bphy_err(drvr, "iface validation failed: err=%d\n", err);
- return ERR_PTR(err);
- }
- switch (type) {
-@@ -647,7 +650,7 @@ static struct wireless_dev *brcmf_cfg802
- }
-
- if (IS_ERR(wdev))
-- bphy_err(wiphy, "add iface %s type %d failed: err=%d\n", name,
-+ bphy_err(drvr, "add iface %s type %d failed: err=%d\n", name,
- type, (int)PTR_ERR(wdev));
- else
- brcmf_cfg80211_update_proto_addr_mode(wdev);
-@@ -663,13 +666,13 @@ static void brcmf_scan_config_mpc(struct
-
- void brcmf_set_mpc(struct brcmf_if *ifp, int mpc)
- {
-- struct wiphy *wiphy = ifp->drvr->wiphy;
-+ struct brcmf_pub *drvr = ifp->drvr;
- s32 err = 0;
-
- if (check_vif_up(ifp->vif)) {
- err = brcmf_fil_iovar_int_set(ifp, "mpc", mpc);
- if (err) {
-- bphy_err(wiphy, "fail to set mpc\n");
-+ bphy_err(drvr, "fail to set mpc\n");
- return;
- }
- brcmf_dbg(INFO, "MPC : %d\n", mpc);
-@@ -680,7 +683,7 @@ s32 brcmf_notify_escan_complete(struct b
- struct brcmf_if *ifp, bool aborted,
- bool fw_abort)
- {
-- struct wiphy *wiphy = cfg_to_wiphy(cfg);
-+ struct brcmf_pub *drvr = cfg->pub;
- struct brcmf_scan_params_le params_le;
- struct cfg80211_scan_request *scan_request;
- u64 reqid;
-@@ -715,7 +718,7 @@ s32 brcmf_notify_escan_complete(struct b
- err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCAN,
- ¶ms_le, sizeof(params_le));
- if (err)
-- bphy_err(wiphy, "Scan abort failed\n");
-+ bphy_err(drvr, "Scan abort failed\n");
- }
-
- brcmf_scan_config_mpc(ifp, 1);
-@@ -760,6 +763,7 @@ static int brcmf_cfg80211_del_ap_iface(s
- struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
- struct net_device *ndev = wdev->netdev;
- struct brcmf_if *ifp = netdev_priv(ndev);
-+ struct brcmf_pub *drvr = cfg->pub;
- int ret;
- int err;
-
-@@ -767,7 +771,7 @@ static int brcmf_cfg80211_del_ap_iface(s
-
- err = brcmf_fil_bsscfg_data_set(ifp, "interface_remove", NULL, 0);
- if (err) {
-- bphy_err(wiphy, "interface_remove failed %d\n", err);
-+ bphy_err(drvr, "interface_remove failed %d\n", err);
- goto err_unarm;
- }
-
-@@ -775,7 +779,7 @@ static int brcmf_cfg80211_del_ap_iface(s
- ret = brcmf_cfg80211_wait_vif_event(cfg, BRCMF_E_IF_DEL,
- BRCMF_VIF_EVENT_TIMEOUT);
- if (!ret) {
-- bphy_err(wiphy, "timeout occurred\n");
-+ bphy_err(drvr, "timeout occurred\n");
- err = -EIO;
- goto err_unarm;
- }
-@@ -838,6 +842,7 @@ brcmf_cfg80211_change_iface(struct wiphy
- struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
- struct brcmf_if *ifp = netdev_priv(ndev);
- struct brcmf_cfg80211_vif *vif = ifp->vif;
-+ struct brcmf_pub *drvr = cfg->pub;
- s32 infra = 0;
- s32 ap = 0;
- s32 err = 0;
-@@ -877,13 +882,13 @@ brcmf_cfg80211_change_iface(struct wiphy
- }
- err = brcmf_vif_change_validate(wiphy_to_cfg(wiphy), vif, type);
- if (err) {
-- bphy_err(wiphy, "iface validation failed: err=%d\n", err);
-+ bphy_err(drvr, "iface validation failed: err=%d\n", err);
- return err;
- }
- switch (type) {
- case NL80211_IFTYPE_MONITOR:
- case NL80211_IFTYPE_WDS:
-- bphy_err(wiphy, "type (%d) : currently we do not support this type\n",
-+ bphy_err(drvr, "type (%d) : currently we do not support this type\n",
- type);
- return -EOPNOTSUPP;
- case NL80211_IFTYPE_ADHOC:
-@@ -912,7 +917,7 @@ brcmf_cfg80211_change_iface(struct wiphy
- } else {
- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, infra);
- if (err) {
-- bphy_err(wiphy, "WLC_SET_INFRA error (%d)\n", err);
-+ bphy_err(drvr, "WLC_SET_INFRA error (%d)\n", err);
- err = -EAGAIN;
- goto done;
- }
-@@ -1003,7 +1008,7 @@ static s32
- brcmf_run_escan(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp,
- struct cfg80211_scan_request *request)
- {
-- struct wiphy *wiphy = cfg_to_wiphy(cfg);
-+ struct brcmf_pub *drvr = cfg->pub;
- s32 params_size = BRCMF_SCAN_PARAMS_FIXED_SIZE +
- offsetof(struct brcmf_escan_params_le, params_le);
- struct brcmf_escan_params_le *params;
-@@ -1035,7 +1040,7 @@ brcmf_run_escan(struct brcmf_cfg80211_in
- if (err == -EBUSY)
- brcmf_dbg(INFO, "system busy : escan canceled\n");
- else
-- bphy_err(wiphy, "error (%d)\n", err);
-+ bphy_err(drvr, "error (%d)\n", err);
- }
-
- kfree(params);
-@@ -1072,6 +1077,7 @@ static s32
- brcmf_cfg80211_scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
- {
- struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
-+ struct brcmf_pub *drvr = cfg->pub;
- struct brcmf_cfg80211_vif *vif;
- s32 err = 0;
-
-@@ -1081,22 +1087,22 @@ brcmf_cfg80211_scan(struct wiphy *wiphy,
- return -EIO;
-
- if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) {
-- bphy_err(wiphy, "Scanning already: status (%lu)\n",
-+ bphy_err(drvr, "Scanning already: status (%lu)\n",
- cfg->scan_status);
- return -EAGAIN;
- }
- if (test_bit(BRCMF_SCAN_STATUS_ABORT, &cfg->scan_status)) {
-- bphy_err(wiphy, "Scanning being aborted: status (%lu)\n",
-+ bphy_err(drvr, "Scanning being aborted: status (%lu)\n",
- cfg->scan_status);
- return -EAGAIN;
- }
- if (test_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status)) {
-- bphy_err(wiphy, "Scanning suppressed: status (%lu)\n",
-+ bphy_err(drvr, "Scanning suppressed: status (%lu)\n",
- cfg->scan_status);
- return -EAGAIN;
- }
- if (test_bit(BRCMF_VIF_STATUS_CONNECTING, &vif->sme_state)) {
-- bphy_err(wiphy, "Connecting: status (%lu)\n", vif->sme_state);
-+ bphy_err(drvr, "Connecting: status (%lu)\n", vif->sme_state);
- return -EAGAIN;
- }
-
-@@ -1130,7 +1136,7 @@ brcmf_cfg80211_scan(struct wiphy *wiphy,
- return 0;
-
- scan_out:
-- bphy_err(wiphy, "scan error (%d)\n", err);
-+ bphy_err(drvr, "scan error (%d)\n", err);
- clear_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status);
- cfg->scan_request = NULL;
- return err;
-@@ -1139,12 +1145,12 @@ scan_out:
- static s32 brcmf_set_rts(struct net_device *ndev, u32 rts_threshold)
- {
- struct brcmf_if *ifp = netdev_priv(ndev);
-- struct wiphy *wiphy = ifp->drvr->wiphy;
-+ struct brcmf_pub *drvr = ifp->drvr;
- s32 err = 0;
-
- err = brcmf_fil_iovar_int_set(ifp, "rtsthresh", rts_threshold);
- if (err)
-- bphy_err(wiphy, "Error (%d)\n", err);
-+ bphy_err(drvr, "Error (%d)\n", err);
-
- return err;
- }
-@@ -1152,13 +1158,13 @@ static s32 brcmf_set_rts(struct net_devi
- static s32 brcmf_set_frag(struct net_device *ndev, u32 frag_threshold)
- {
- struct brcmf_if *ifp = netdev_priv(ndev);
-- struct wiphy *wiphy = ifp->drvr->wiphy;
-+ struct brcmf_pub *drvr = ifp->drvr;
- s32 err = 0;
-
- err = brcmf_fil_iovar_int_set(ifp, "fragthresh",
- frag_threshold);
- if (err)
-- bphy_err(wiphy, "Error (%d)\n", err);
-+ bphy_err(drvr, "Error (%d)\n", err);
-
- return err;
- }
-@@ -1166,13 +1172,13 @@ static s32 brcmf_set_frag(struct net_dev
- static s32 brcmf_set_retry(struct net_device *ndev, u32 retry, bool l)
- {
- struct brcmf_if *ifp = netdev_priv(ndev);
-- struct wiphy *wiphy = ifp->drvr->wiphy;
-+ struct brcmf_pub *drvr = ifp->drvr;
- s32 err = 0;
- u32 cmd = (l ? BRCMF_C_SET_LRL : BRCMF_C_SET_SRL);
-
- err = brcmf_fil_cmd_int_set(ifp, cmd, retry);
- if (err) {
-- bphy_err(wiphy, "cmd (%d) , error (%d)\n", cmd, err);
-+ bphy_err(drvr, "cmd (%d) , error (%d)\n", cmd, err);
- return err;
- }
- return err;
-@@ -1248,7 +1254,7 @@ static u16 brcmf_map_fw_linkdown_reason(
-
- static int brcmf_set_pmk(struct brcmf_if *ifp, const u8 *pmk_data, u16 pmk_len)
- {
-- struct wiphy *wiphy = ifp->drvr->wiphy;
-+ struct brcmf_pub *drvr = ifp->drvr;
- struct brcmf_wsec_pmk_le pmk;
- int i, err;
-
-@@ -1262,7 +1268,7 @@ static int brcmf_set_pmk(struct brcmf_if
- err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_WSEC_PMK,
- &pmk, sizeof(pmk));
- if (err < 0)
-- bphy_err(wiphy, "failed to change PSK in firmware (len=%u)\n",
-+ bphy_err(drvr, "failed to change PSK in firmware (len=%u)\n",
- pmk_len);
-
- return err;
-@@ -1271,7 +1277,7 @@ static int brcmf_set_pmk(struct brcmf_if
- static void brcmf_link_down(struct brcmf_cfg80211_vif *vif, u16 reason)
- {
- struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(vif->wdev.wiphy);
-- struct wiphy *wiphy = cfg_to_wiphy(cfg);
-+ struct brcmf_pub *drvr = cfg->pub;
- s32 err = 0;
-
- brcmf_dbg(TRACE, "Enter\n");
-@@ -1281,7 +1287,7 @@ static void brcmf_link_down(struct brcmf
- err = brcmf_fil_cmd_data_set(vif->ifp,
- BRCMF_C_DISASSOC, NULL, 0);
- if (err) {
-- bphy_err(wiphy, "WLC_DISASSOC failed (%d)\n", err);
-+ bphy_err(drvr, "WLC_DISASSOC failed (%d)\n", err);
- }
- if ((vif->wdev.iftype == NL80211_IFTYPE_STATION) ||
- (vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT))
-@@ -1305,6 +1311,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
- struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
- struct brcmf_if *ifp = netdev_priv(ndev);
- struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
-+ struct brcmf_pub *drvr = cfg->pub;
- struct brcmf_join_params join_params;
- size_t join_params_size = 0;
- s32 err = 0;
-@@ -1369,7 +1376,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
-
- err = brcmf_fil_iovar_int_set(ifp, "wsec", wsec);
- if (err) {
-- bphy_err(wiphy, "wsec failed (%d)\n", err);
-+ bphy_err(drvr, "wsec failed (%d)\n", err);
- goto done;
- }
-
-@@ -1381,7 +1388,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
-
- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD, bcnprd);
- if (err) {
-- bphy_err(wiphy, "WLC_SET_BCNPRD failed (%d)\n", err);
-+ bphy_err(drvr, "WLC_SET_BCNPRD failed (%d)\n", err);
- goto done;
- }
-
-@@ -1426,7 +1433,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_CHANNEL,
- target_channel);
- if (err) {
-- bphy_err(wiphy, "WLC_SET_CHANNEL failed (%d)\n", err);
-+ bphy_err(drvr, "WLC_SET_CHANNEL failed (%d)\n", err);
- goto done;
- }
- } else
-@@ -1438,7 +1445,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
- err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
- &join_params, join_params_size);
- if (err) {
-- bphy_err(wiphy, "WLC_SET_SSID failed (%d)\n", err);
-+ bphy_err(drvr, "WLC_SET_SSID failed (%d)\n", err);
- goto done;
- }
-
-@@ -1475,8 +1482,8 @@ static s32 brcmf_set_wpa_version(struct
- struct cfg80211_connect_params *sme)
- {
- struct brcmf_if *ifp = netdev_priv(ndev);
-- struct wiphy *wiphy = ifp->drvr->wiphy;
- struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
-+ struct brcmf_pub *drvr = ifp->drvr;
- struct brcmf_cfg80211_security *sec;
- s32 val = 0;
- s32 err = 0;
-@@ -1490,7 +1497,7 @@ static s32 brcmf_set_wpa_version(struct
- brcmf_dbg(CONN, "setting wpa_auth to 0x%0x\n", val);
- err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", val);
- if (err) {
-- bphy_err(wiphy, "set wpa_auth failed (%d)\n", err);
-+ bphy_err(drvr, "set wpa_auth failed (%d)\n", err);
- return err;
- }
- sec = &profile->sec;
-@@ -1502,8 +1509,8 @@ static s32 brcmf_set_auth_type(struct ne
- struct cfg80211_connect_params *sme)
- {
- struct brcmf_if *ifp = netdev_priv(ndev);
-- struct wiphy *wiphy = ifp->drvr->wiphy;
- struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
-+ struct brcmf_pub *drvr = ifp->drvr;
- struct brcmf_cfg80211_security *sec;
- s32 val = 0;
- s32 err = 0;
-@@ -1525,7 +1532,7 @@ static s32 brcmf_set_auth_type(struct ne
-
- err = brcmf_fil_bsscfg_int_set(ifp, "auth", val);
- if (err) {
-- bphy_err(wiphy, "set auth failed (%d)\n", err);
-+ bphy_err(drvr, "set auth failed (%d)\n", err);
- return err;
- }
- sec = &profile->sec;
-@@ -1538,8 +1545,8 @@ brcmf_set_wsec_mode(struct net_device *n
- struct cfg80211_connect_params *sme)
- {
- struct brcmf_if *ifp = netdev_priv(ndev);
-- struct wiphy *wiphy = ifp->drvr->wiphy;
- struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
-+ struct brcmf_pub *drvr = ifp->drvr;
- struct brcmf_cfg80211_security *sec;
- s32 pval = 0;
- s32 gval = 0;
-@@ -1562,7 +1569,7 @@ brcmf_set_wsec_mode(struct net_device *n
- pval = AES_ENABLED;
- break;
- default:
-- bphy_err(wiphy, "invalid cipher pairwise (%d)\n",
-+ bphy_err(drvr, "invalid cipher pairwise (%d)\n",
- sme->crypto.ciphers_pairwise[0]);
- return -EINVAL;
- }
-@@ -1583,7 +1590,7 @@ brcmf_set_wsec_mode(struct net_device *n
- gval = AES_ENABLED;
- break;
- default:
-- bphy_err(wiphy, "invalid cipher group (%d)\n",
-+ bphy_err(drvr, "invalid cipher group (%d)\n",
- sme->crypto.cipher_group);
- return -EINVAL;
- }
-@@ -1599,7 +1606,7 @@ brcmf_set_wsec_mode(struct net_device *n
- wsec = pval | gval;
- err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
- if (err) {
-- bphy_err(wiphy, "error (%d)\n", err);
-+ bphy_err(drvr, "error (%d)\n", err);
- return err;
- }
-
-@@ -1614,8 +1621,8 @@ static s32
- brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme)
- {
- struct brcmf_if *ifp = netdev_priv(ndev);
-- struct wiphy *wiphy = ifp->drvr->wiphy;
- struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
-+ struct brcmf_pub *drvr = ifp->drvr;
- s32 val;
- s32 err;
- const struct brcmf_tlv *rsn_ie;
-@@ -1633,7 +1640,7 @@ brcmf_set_key_mgmt(struct net_device *nd
-
- err = brcmf_fil_bsscfg_int_get(netdev_priv(ndev), "wpa_auth", &val);
- if (err) {
-- bphy_err(wiphy, "could not get wpa_auth (%d)\n", err);
-+ bphy_err(drvr, "could not get wpa_auth (%d)\n", err);
- return err;
- }
- if (val & (WPA_AUTH_PSK | WPA_AUTH_UNSPECIFIED)) {
-@@ -1647,7 +1654,7 @@ brcmf_set_key_mgmt(struct net_device *nd
- val = WPA_AUTH_PSK;
- break;
- default:
-- bphy_err(wiphy, "invalid cipher group (%d)\n",
-+ bphy_err(drvr, "invalid cipher group (%d)\n",
- sme->crypto.cipher_group);
- return -EINVAL;
- }
-@@ -1678,7 +1685,7 @@ brcmf_set_key_mgmt(struct net_device *nd
- val = WPA2_AUTH_PSK | WPA2_AUTH_FT;
- break;
- default:
-- bphy_err(wiphy, "invalid cipher group (%d)\n",
-+ bphy_err(drvr, "invalid cipher group (%d)\n",
- sme->crypto.cipher_group);
- return -EINVAL;
- }
-@@ -1725,7 +1732,7 @@ skip_mfp_config:
- brcmf_dbg(CONN, "setting wpa_auth to %d\n", val);
- err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wpa_auth", val);
- if (err) {
-- bphy_err(wiphy, "could not set wpa_auth (%d)\n", err);
-+ bphy_err(drvr, "could not set wpa_auth (%d)\n", err);
- return err;
- }
-
-@@ -1737,7 +1744,7 @@ brcmf_set_sharedkey(struct net_device *n
- struct cfg80211_connect_params *sme)
- {
- struct brcmf_if *ifp = netdev_priv(ndev);
-- struct wiphy *wiphy = ifp->drvr->wiphy;
-+ struct brcmf_pub *drvr = ifp->drvr;
- struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
- struct brcmf_cfg80211_security *sec;
- struct brcmf_wsec_key key;
-@@ -1764,7 +1771,7 @@ brcmf_set_sharedkey(struct net_device *n
- key.len = (u32) sme->key_len;
- key.index = (u32) sme->key_idx;
- if (key.len > sizeof(key.data)) {
-- bphy_err(wiphy, "Too long key length (%u)\n", key.len);
-+ bphy_err(drvr, "Too long key length (%u)\n", key.len);
- return -EINVAL;
- }
- memcpy(key.data, sme->key, key.len);
-@@ -1777,7 +1784,7 @@ brcmf_set_sharedkey(struct net_device *n
- key.algo = CRYPTO_ALGO_WEP128;
- break;
- default:
-- bphy_err(wiphy, "Invalid algorithm (%d)\n",
-+ bphy_err(drvr, "Invalid algorithm (%d)\n",
- sme->crypto.ciphers_pairwise[0]);
- return -EINVAL;
- }
-@@ -1794,7 +1801,7 @@ brcmf_set_sharedkey(struct net_device *n
- val = WL_AUTH_SHARED_KEY; /* shared key */
- err = brcmf_fil_bsscfg_int_set(ifp, "auth", val);
- if (err)
-- bphy_err(wiphy, "set auth failed (%d)\n", err);
-+ bphy_err(drvr, "set auth failed (%d)\n", err);
- }
- return err;
- }
-@@ -1814,7 +1821,7 @@ enum nl80211_auth_type brcmf_war_auth_ty
- static void brcmf_set_join_pref(struct brcmf_if *ifp,
- struct cfg80211_bss_selection *bss_select)
- {
-- struct wiphy *wiphy = ifp->drvr->wiphy;
-+ struct brcmf_pub *drvr = ifp->drvr;
- struct brcmf_join_pref_params join_pref_params[2];
- enum nl80211_band band;
- int err, i = 0;
-@@ -1853,7 +1860,7 @@ static void brcmf_set_join_pref(struct b
- err = brcmf_fil_iovar_data_set(ifp, "join_pref", join_pref_params,
- sizeof(join_pref_params));
- if (err)
-- bphy_err(wiphy, "Set join_pref error (%d)\n", err);
-+ bphy_err(drvr, "Set join_pref error (%d)\n", err);
- }
-
- static s32
-@@ -1864,6 +1871,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
- struct brcmf_if *ifp = netdev_priv(ndev);
- struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
- struct ieee80211_channel *chan = sme->channel;
-+ struct brcmf_pub *drvr = ifp->drvr;
- struct brcmf_join_params join_params;
- size_t join_params_size;
- const struct brcmf_tlv *rsn_ie;
-@@ -1880,7 +1888,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
- return -EIO;
-
- if (!sme->ssid) {
-- bphy_err(wiphy, "Invalid ssid\n");
-+ bphy_err(drvr, "Invalid ssid\n");
- return -EOPNOTSUPP;
- }
-
-@@ -1909,7 +1917,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
- err = brcmf_vif_set_mgmt_ie(ifp->vif, BRCMF_VNDR_IE_ASSOCREQ_FLAG,
- sme->ie, sme->ie_len);
- if (err)
-- bphy_err(wiphy, "Set Assoc REQ IE Failed\n");
-+ bphy_err(drvr, "Set Assoc REQ IE Failed\n");
- else
- brcmf_dbg(TRACE, "Applied Vndr IEs for Assoc request\n");
-
-@@ -1930,32 +1938,32 @@ brcmf_cfg80211_connect(struct wiphy *wip
-
- err = brcmf_set_wpa_version(ndev, sme);
- if (err) {
-- bphy_err(wiphy, "wl_set_wpa_version failed (%d)\n", err);
-+ bphy_err(drvr, "wl_set_wpa_version failed (%d)\n", err);
- goto done;
- }
-
- sme->auth_type = brcmf_war_auth_type(ifp, sme->auth_type);
- err = brcmf_set_auth_type(ndev, sme);
- if (err) {
-- bphy_err(wiphy, "wl_set_auth_type failed (%d)\n", err);
-+ bphy_err(drvr, "wl_set_auth_type failed (%d)\n", err);
- goto done;
- }
-
- err = brcmf_set_wsec_mode(ndev, sme);
- if (err) {
-- bphy_err(wiphy, "wl_set_set_cipher failed (%d)\n", err);
-+ bphy_err(drvr, "wl_set_set_cipher failed (%d)\n", err);
- goto done;
- }
-
- err = brcmf_set_key_mgmt(ndev, sme);
- if (err) {
-- bphy_err(wiphy, "wl_set_key_mgmt failed (%d)\n", err);
-+ bphy_err(drvr, "wl_set_key_mgmt failed (%d)\n", err);
- goto done;
- }
-
- err = brcmf_set_sharedkey(ndev, sme);
- if (err) {
-- bphy_err(wiphy, "brcmf_set_sharedkey failed (%d)\n", err);
-+ bphy_err(drvr, "brcmf_set_sharedkey failed (%d)\n", err);
- goto done;
- }
-
-@@ -1972,7 +1980,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
- /* enable firmware supplicant for this interface */
- err = brcmf_fil_iovar_int_set(ifp, "sup_wpa", 1);
- if (err < 0) {
-- bphy_err(wiphy, "failed to enable fw supplicant\n");
-+ bphy_err(drvr, "failed to enable fw supplicant\n");
- goto done;
- }
- }
-@@ -2067,7 +2075,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
- err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
- &join_params, join_params_size);
- if (err)
-- bphy_err(wiphy, "BRCMF_C_SET_SSID failed (%d)\n", err);
-+ bphy_err(drvr, "BRCMF_C_SET_SSID failed (%d)\n", err);
-
- done:
- if (err)
-@@ -2080,8 +2088,10 @@ static s32
- brcmf_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *ndev,
- u16 reason_code)
- {
-+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
- struct brcmf_if *ifp = netdev_priv(ndev);
- struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
-+ struct brcmf_pub *drvr = cfg->pub;
- struct brcmf_scb_val_le scbval;
- s32 err = 0;
-
-@@ -2098,7 +2108,7 @@ brcmf_cfg80211_disconnect(struct wiphy *
- err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_DISASSOC,
- &scbval, sizeof(scbval));
- if (err)
-- bphy_err(wiphy, "error (%d)\n", err);
-+ bphy_err(drvr, "error (%d)\n", err);
-
- brcmf_dbg(TRACE, "Exit\n");
- return err;
-@@ -2111,6 +2121,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy
- struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
- struct net_device *ndev = cfg_to_ndev(cfg);
- struct brcmf_if *ifp = netdev_priv(ndev);
-+ struct brcmf_pub *drvr = cfg->pub;
- s32 err;
- s32 disable;
- u32 qdbm = 127;
-@@ -2125,7 +2136,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy
- case NL80211_TX_POWER_LIMITED:
- case NL80211_TX_POWER_FIXED:
- if (mbm < 0) {
-- bphy_err(wiphy, "TX_POWER_FIXED - dbm is negative\n");
-+ bphy_err(drvr, "TX_POWER_FIXED - dbm is negative\n");
- err = -EINVAL;
- goto done;
- }
-@@ -2135,7 +2146,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy
- qdbm |= WL_TXPWR_OVERRIDE;
- break;
- default:
-- bphy_err(wiphy, "Unsupported type %d\n", type);
-+ bphy_err(drvr, "Unsupported type %d\n", type);
- err = -EINVAL;
- goto done;
- }
-@@ -2143,11 +2154,11 @@ brcmf_cfg80211_set_tx_power(struct wiphy
- disable = WL_RADIO_SW_DISABLE << 16;
- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_RADIO, disable);
- if (err)
-- bphy_err(wiphy, "WLC_SET_RADIO error (%d)\n", err);
-+ bphy_err(drvr, "WLC_SET_RADIO error (%d)\n", err);
-
- err = brcmf_fil_iovar_int_set(ifp, "qtxpower", qdbm);
- if (err)
-- bphy_err(wiphy, "qtxpower error (%d)\n", err);
-+ bphy_err(drvr, "qtxpower error (%d)\n", err);
-
- done:
- brcmf_dbg(TRACE, "Exit %d (qdbm)\n", qdbm & ~WL_TXPWR_OVERRIDE);
-@@ -2158,7 +2169,9 @@ static s32
- brcmf_cfg80211_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
- s32 *dbm)
- {
-+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
- struct brcmf_cfg80211_vif *vif = wdev_to_vif(wdev);
-+ struct brcmf_pub *drvr = cfg->pub;
- s32 qdbm = 0;
- s32 err;
-
-@@ -2168,7 +2181,7 @@ brcmf_cfg80211_get_tx_power(struct wiphy
-
- err = brcmf_fil_iovar_int_get(vif->ifp, "qtxpower", &qdbm);
- if (err) {
-- bphy_err(wiphy, "error (%d)\n", err);
-+ bphy_err(drvr, "error (%d)\n", err);
- goto done;
- }
- *dbm = (qdbm & ~WL_TXPWR_OVERRIDE) / 4;
-@@ -2183,6 +2196,7 @@ brcmf_cfg80211_config_default_key(struct
- u8 key_idx, bool unicast, bool multicast)
- {
- struct brcmf_if *ifp = netdev_priv(ndev);
-+ struct brcmf_pub *drvr = ifp->drvr;
- u32 index;
- u32 wsec;
- s32 err = 0;
-@@ -2194,7 +2208,7 @@ brcmf_cfg80211_config_default_key(struct
-
- err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
- if (err) {
-- bphy_err(wiphy, "WLC_GET_WSEC error (%d)\n", err);
-+ bphy_err(drvr, "WLC_GET_WSEC error (%d)\n", err);
- goto done;
- }
-
-@@ -2204,7 +2218,7 @@ brcmf_cfg80211_config_default_key(struct
- err = brcmf_fil_cmd_int_set(ifp,
- BRCMF_C_SET_KEY_PRIMARY, index);
- if (err)
-- bphy_err(wiphy, "error (%d)\n", err);
-+ bphy_err(drvr, "error (%d)\n", err);
- }
- done:
- brcmf_dbg(TRACE, "Exit\n");
-@@ -2253,7 +2267,9 @@ brcmf_cfg80211_add_key(struct wiphy *wip
- u8 key_idx, bool pairwise, const u8 *mac_addr,
- struct key_params *params)
- {
-+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
- struct brcmf_if *ifp = netdev_priv(ndev);
-+ struct brcmf_pub *drvr = cfg->pub;
- struct brcmf_wsec_key *key;
- s32 val;
- s32 wsec;
-@@ -2268,7 +2284,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip
-
- if (key_idx >= BRCMF_MAX_DEFAULT_KEYS) {
- /* we ignore this key index in this case */
-- bphy_err(wiphy, "invalid key index (%d)\n", key_idx);
-+ bphy_err(drvr, "invalid key index (%d)\n", key_idx);
- return -EINVAL;
- }
-
-@@ -2277,7 +2293,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip
- mac_addr);
-
- if (params->key_len > sizeof(key->data)) {
-- bphy_err(wiphy, "Too long key length (%u)\n", params->key_len);
-+ bphy_err(drvr, "Too long key length (%u)\n", params->key_len);
- return -EINVAL;
- }
-
-@@ -2331,7 +2347,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip
- brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_CCMP\n");
- break;
- default:
-- bphy_err(wiphy, "Invalid cipher (0x%x)\n", params->cipher);
-+ bphy_err(drvr, "Invalid cipher (0x%x)\n", params->cipher);
- err = -EINVAL;
- goto done;
- }
-@@ -2342,13 +2358,13 @@ brcmf_cfg80211_add_key(struct wiphy *wip
-
- err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
- if (err) {
-- bphy_err(wiphy, "get wsec error (%d)\n", err);
-+ bphy_err(drvr, "get wsec error (%d)\n", err);
- goto done;
- }
- wsec |= val;
- err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
- if (err) {
-- bphy_err(wiphy, "set wsec error (%d)\n", err);
-+ bphy_err(drvr, "set wsec error (%d)\n", err);
- goto done;
- }
-
-@@ -2363,9 +2379,11 @@ brcmf_cfg80211_get_key(struct wiphy *wip
- void (*callback)(void *cookie,
- struct key_params *params))
- {
-+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
- struct key_params params;
- struct brcmf_if *ifp = netdev_priv(ndev);
- struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
-+ struct brcmf_pub *drvr = cfg->pub;
- struct brcmf_cfg80211_security *sec;
- s32 wsec;
- s32 err = 0;
-@@ -2379,7 +2397,7 @@ brcmf_cfg80211_get_key(struct wiphy *wip
-
- err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
- if (err) {
-- bphy_err(wiphy, "WLC_GET_WSEC error (%d)\n", err);
-+ bphy_err(drvr, "WLC_GET_WSEC error (%d)\n", err);
- /* Ignore this error, may happen during DISASSOC */
- err = -EAGAIN;
- goto done;
-@@ -2400,7 +2418,7 @@ brcmf_cfg80211_get_key(struct wiphy *wip
- params.cipher = WLAN_CIPHER_SUITE_AES_CMAC;
- brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_AES_CMAC\n");
- } else {
-- bphy_err(wiphy, "Invalid algo (0x%x)\n", wsec);
-+ bphy_err(drvr, "Invalid algo (0x%x)\n", wsec);
- err = -EINVAL;
- goto done;
- }
-@@ -2430,7 +2448,7 @@ brcmf_cfg80211_config_default_mgmt_key(s
- static void
- brcmf_cfg80211_reconfigure_wep(struct brcmf_if *ifp)
- {
-- struct wiphy *wiphy = ifp->drvr->wiphy;
-+ struct brcmf_pub *drvr = ifp->drvr;
- s32 err;
- u8 key_idx;
- struct brcmf_wsec_key *key;
-@@ -2447,18 +2465,18 @@ brcmf_cfg80211_reconfigure_wep(struct br
-
- err = send_key_to_dongle(ifp, key);
- if (err) {
-- bphy_err(wiphy, "Setting WEP key failed (%d)\n", err);
-+ bphy_err(drvr, "Setting WEP key failed (%d)\n", err);
- return;
- }
- err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
- if (err) {
-- bphy_err(wiphy, "get wsec error (%d)\n", err);
-+ bphy_err(drvr, "get wsec error (%d)\n", err);
- return;
- }
- wsec |= WEP_ENABLED;
- err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
- if (err)
-- bphy_err(wiphy, "set wsec error (%d)\n", err);
-+ bphy_err(drvr, "set wsec error (%d)\n", err);
- }
-
- static void brcmf_convert_sta_flags(u32 fw_sta_flags, struct station_info *si)
-@@ -2484,7 +2502,7 @@ static void brcmf_convert_sta_flags(u32
-
- static void brcmf_fill_bss_param(struct brcmf_if *ifp, struct station_info *si)
- {
-- struct wiphy *wiphy = ifp->drvr->wiphy;
-+ struct brcmf_pub *drvr = ifp->drvr;
- struct {
- __le32 len;
- struct brcmf_bss_info_le bss_le;
-@@ -2500,7 +2518,7 @@ static void brcmf_fill_bss_param(struct
- err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO, buf,
- WL_BSS_INFO_MAX);
- if (err) {
-- bphy_err(wiphy, "Failed to get bss info (%d)\n", err);
-+ bphy_err(drvr, "Failed to get bss info (%d)\n", err);
- goto out_kfree;
- }
- si->filled |= BIT_ULL(NL80211_STA_INFO_BSS_PARAM);
-@@ -2522,7 +2540,7 @@ static s32
- brcmf_cfg80211_get_station_ibss(struct brcmf_if *ifp,
- struct station_info *sinfo)
- {
-- struct wiphy *wiphy = ifp->drvr->wiphy;
-+ struct brcmf_pub *drvr = ifp->drvr;
- struct brcmf_scb_val_le scbval;
- struct brcmf_pktcnt_le pktcnt;
- s32 err;
-@@ -2532,7 +2550,7 @@ brcmf_cfg80211_get_station_ibss(struct b
- /* Get the current tx rate */
- err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_RATE, &rate);
- if (err < 0) {
-- bphy_err(wiphy, "BRCMF_C_GET_RATE error (%d)\n", err);
-+ bphy_err(drvr, "BRCMF_C_GET_RATE error (%d)\n", err);
- return err;
- }
- sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE);
-@@ -2542,7 +2560,7 @@ brcmf_cfg80211_get_station_ibss(struct b
- err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI, &scbval,
- sizeof(scbval));
- if (err) {
-- bphy_err(wiphy, "BRCMF_C_GET_RSSI error (%d)\n", err);
-+ bphy_err(drvr, "BRCMF_C_GET_RSSI error (%d)\n", err);
- return err;
- }
- rssi = le32_to_cpu(scbval.val);
-@@ -2552,7 +2570,7 @@ brcmf_cfg80211_get_station_ibss(struct b
- err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_GET_PKTCNTS, &pktcnt,
- sizeof(pktcnt));
- if (err) {
-- bphy_err(wiphy, "BRCMF_C_GET_GET_PKTCNTS error (%d)\n", err);
-+ bphy_err(drvr, "BRCMF_C_GET_GET_PKTCNTS error (%d)\n", err);
- return err;
- }
- sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_PACKETS) |
-@@ -2571,7 +2589,9 @@ static s32
- brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
- const u8 *mac, struct station_info *sinfo)
- {
-+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
- struct brcmf_if *ifp = netdev_priv(ndev);
-+ struct brcmf_pub *drvr = cfg->pub;
- struct brcmf_scb_val_le scb_val;
- s32 err = 0;
- struct brcmf_sta_info_le sta_info_le;
-@@ -2600,7 +2620,7 @@ brcmf_cfg80211_get_station(struct wiphy
- &sta_info_le,
- sizeof(sta_info_le));
- if (err < 0) {
-- bphy_err(wiphy, "GET STA INFO failed, %d\n", err);
-+ bphy_err(drvr, "GET STA INFO failed, %d\n", err);
- goto done;
- }
- }
-@@ -2669,7 +2689,7 @@ brcmf_cfg80211_get_station(struct wiphy
- err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI,
- &scb_val, sizeof(scb_val));
- if (err) {
-- bphy_err(wiphy, "Could not get rssi (%d)\n",
-+ bphy_err(drvr, "Could not get rssi (%d)\n",
- err);
- goto done;
- } else {
-@@ -2691,6 +2711,7 @@ brcmf_cfg80211_dump_station(struct wiphy
- {
- struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
- struct brcmf_if *ifp = netdev_priv(ndev);
-+ struct brcmf_pub *drvr = cfg->pub;
- s32 err;
-
- brcmf_dbg(TRACE, "Enter, idx %d\n", idx);
-@@ -2701,7 +2722,7 @@ brcmf_cfg80211_dump_station(struct wiphy
- &cfg->assoclist,
- sizeof(cfg->assoclist));
- if (err) {
-- bphy_err(wiphy, "BRCMF_C_GET_ASSOCLIST unsupported, err=%d\n",
-+ bphy_err(drvr, "BRCMF_C_GET_ASSOCLIST unsupported, err=%d\n",
- err);
- cfg->assoclist.count = 0;
- return -EOPNOTSUPP;
-@@ -2722,6 +2743,7 @@ brcmf_cfg80211_set_power_mgmt(struct wip
- s32 err = 0;
- struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
- struct brcmf_if *ifp = netdev_priv(ndev);
-+ struct brcmf_pub *drvr = cfg->pub;
-
- brcmf_dbg(TRACE, "Enter\n");
-
-@@ -2750,9 +2772,9 @@ brcmf_cfg80211_set_power_mgmt(struct wip
- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM, pm);
- if (err) {
- if (err == -ENODEV)
-- bphy_err(wiphy, "net_device is not ready yet\n");
-+ bphy_err(drvr, "net_device is not ready yet\n");
- else
-- bphy_err(wiphy, "error (%d)\n", err);
-+ bphy_err(drvr, "error (%d)\n", err);
- }
- done:
- brcmf_dbg(TRACE, "Exit\n");
-@@ -2763,6 +2785,7 @@ static s32 brcmf_inform_single_bss(struc
- struct brcmf_bss_info_le *bi)
- {
- struct wiphy *wiphy = cfg_to_wiphy(cfg);
-+ struct brcmf_pub *drvr = cfg->pub;
- struct cfg80211_bss *bss;
- enum nl80211_band band;
- struct brcmu_chan ch;
-@@ -2775,7 +2798,7 @@ static s32 brcmf_inform_single_bss(struc
- struct cfg80211_inform_bss bss_data = {};
-
- if (le32_to_cpu(bi->length) > WL_BSS_INFO_MAX) {
-- bphy_err(wiphy, "Bss info is larger than buffer. Discarding\n");
-+ bphy_err(drvr, "Bss info is larger than buffer. Discarding\n");
- return 0;
- }
-
-@@ -2834,7 +2857,7 @@ next_bss_le(struct brcmf_scan_results *l
-
- static s32 brcmf_inform_bss(struct brcmf_cfg80211_info *cfg)
- {
-- struct wiphy *wiphy = cfg_to_wiphy(cfg);
-+ struct brcmf_pub *drvr = cfg->pub;
- struct brcmf_scan_results *bss_list;
- struct brcmf_bss_info_le *bi = NULL; /* must be initialized */
- s32 err = 0;
-@@ -2843,7 +2866,7 @@ static s32 brcmf_inform_bss(struct brcmf
- bss_list = (struct brcmf_scan_results *)cfg->escan_info.escan_buf;
- if (bss_list->count != 0 &&
- bss_list->version != BRCMF_BSS_INFO_VERSION) {
-- bphy_err(wiphy, "Version %d != WL_BSS_INFO_VERSION\n",
-+ bphy_err(drvr, "Version %d != WL_BSS_INFO_VERSION\n",
- bss_list->version);
- return -EOPNOTSUPP;
- }
-@@ -2861,6 +2884,7 @@ static s32 brcmf_inform_ibss(struct brcm
- struct net_device *ndev, const u8 *bssid)
- {
- struct wiphy *wiphy = cfg_to_wiphy(cfg);
-+ struct brcmf_pub *drvr = cfg->pub;
- struct ieee80211_channel *notify_channel;
- struct brcmf_bss_info_le *bi = NULL;
- struct ieee80211_supported_band *band;
-@@ -2888,7 +2912,7 @@ static s32 brcmf_inform_ibss(struct brcm
- err = brcmf_fil_cmd_data_get(netdev_priv(ndev), BRCMF_C_GET_BSS_INFO,
- buf, WL_BSS_INFO_MAX);
- if (err) {
-- bphy_err(wiphy, "WLC_GET_BSS_INFO failed: %d\n", err);
-+ bphy_err(drvr, "WLC_GET_BSS_INFO failed: %d\n", err);
- goto CleanUp;
- }
-
-@@ -2942,7 +2966,7 @@ CleanUp:
- static s32 brcmf_update_bss_info(struct brcmf_cfg80211_info *cfg,
- struct brcmf_if *ifp)
- {
-- struct wiphy *wiphy = cfg_to_wiphy(cfg);
-+ struct brcmf_pub *drvr = cfg->pub;
- struct brcmf_bss_info_le *bi;
- const struct brcmf_tlv *tim;
- u16 beacon_interval;
-@@ -2959,7 +2983,7 @@ static s32 brcmf_update_bss_info(struct
- err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO,
- cfg->extra_buf, WL_EXTRA_BUF_MAX);
- if (err) {
-- bphy_err(wiphy, "Could not get bss info %d\n", err);
-+ bphy_err(drvr, "Could not get bss info %d\n", err);
- goto update_bss_info_out;
- }
-
-@@ -2984,7 +3008,7 @@ static s32 brcmf_update_bss_info(struct
- u32 var;
- err = brcmf_fil_iovar_int_get(ifp, "dtim_assoc", &var);
- if (err) {
-- bphy_err(wiphy, "wl dtim_assoc failed (%d)\n", err);
-+ bphy_err(drvr, "wl dtim_assoc failed (%d)\n", err);
- goto update_bss_info_out;
- }
- dtim_period = (u8)var;
-@@ -3022,10 +3046,10 @@ static void brcmf_escan_timeout(struct t
- {
- struct brcmf_cfg80211_info *cfg =
- from_timer(cfg, t, escan_timeout);
-- struct wiphy *wiphy = cfg_to_wiphy(cfg);
-+ struct brcmf_pub *drvr = cfg->pub;
-
- if (cfg->int_escan_map || cfg->scan_request) {
-- bphy_err(wiphy, "timer expired\n");
-+ bphy_err(drvr, "timer expired\n");
- schedule_work(&cfg->escan_timeout_work);
- }
- }
-@@ -3073,8 +3097,8 @@ static s32
- brcmf_cfg80211_escan_handler(struct brcmf_if *ifp,
- const struct brcmf_event_msg *e, void *data)
- {
-- struct brcmf_cfg80211_info *cfg = ifp->drvr->config;
-- struct wiphy *wiphy = cfg_to_wiphy(cfg);
-+ struct brcmf_pub *drvr = ifp->drvr;
-+ struct brcmf_cfg80211_info *cfg = drvr->config;
- s32 status;
- struct brcmf_escan_result_le *escan_result_le;
- u32 escan_buflen;
-@@ -3091,7 +3115,7 @@ brcmf_cfg80211_escan_handler(struct brcm
- goto exit;
-
- if (!test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) {
-- bphy_err(wiphy, "scan not ready, bsscfgidx=%d\n",
-+ bphy_err(drvr, "scan not ready, bsscfgidx=%d\n",
- ifp->bsscfgidx);
- return -EPERM;
- }
-@@ -3099,24 +3123,24 @@ brcmf_cfg80211_escan_handler(struct brcm
- if (status == BRCMF_E_STATUS_PARTIAL) {
- brcmf_dbg(SCAN, "ESCAN Partial result\n");
- if (e->datalen < sizeof(*escan_result_le)) {
-- bphy_err(wiphy, "invalid event data length\n");
-+ bphy_err(drvr, "invalid event data length\n");
- goto exit;
- }
- escan_result_le = (struct brcmf_escan_result_le *) data;
- if (!escan_result_le) {
-- bphy_err(wiphy, "Invalid escan result (NULL pointer)\n");
-+ bphy_err(drvr, "Invalid escan result (NULL pointer)\n");
- goto exit;
- }
- escan_buflen = le32_to_cpu(escan_result_le->buflen);
- if (escan_buflen > BRCMF_ESCAN_BUF_SIZE ||
- escan_buflen > e->datalen ||
- escan_buflen < sizeof(*escan_result_le)) {
-- bphy_err(wiphy, "Invalid escan buffer length: %d\n",
-+ bphy_err(drvr, "Invalid escan buffer length: %d\n",
- escan_buflen);
- goto exit;
- }
- if (le16_to_cpu(escan_result_le->bss_count) != 1) {
-- bphy_err(wiphy, "Invalid bss_count %d: ignoring\n",
-+ bphy_err(drvr, "Invalid bss_count %d: ignoring\n",
- escan_result_le->bss_count);
- goto exit;
- }
-@@ -3132,7 +3156,7 @@ brcmf_cfg80211_escan_handler(struct brcm
-
- bi_length = le32_to_cpu(bss_info_le->length);
- if (bi_length != escan_buflen - WL_ESCAN_RESULTS_FIXED_SIZE) {
-- bphy_err(wiphy, "Ignoring invalid bss_info length: %d\n",
-+ bphy_err(drvr, "Ignoring invalid bss_info length: %d\n",
- bi_length);
- goto exit;
- }
-@@ -3141,7 +3165,7 @@ brcmf_cfg80211_escan_handler(struct brcm
- BIT(NL80211_IFTYPE_ADHOC))) {
- if (le16_to_cpu(bss_info_le->capability) &
- WLAN_CAPABILITY_IBSS) {
-- bphy_err(wiphy, "Ignoring IBSS result\n");
-+ bphy_err(drvr, "Ignoring IBSS result\n");
- goto exit;
- }
- }
-@@ -3149,7 +3173,7 @@ brcmf_cfg80211_escan_handler(struct brcm
- list = (struct brcmf_scan_results *)
- cfg->escan_info.escan_buf;
- if (bi_length > BRCMF_ESCAN_BUF_SIZE - list->buflen) {
-- bphy_err(wiphy, "Buffer is too small: ignoring\n");
-+ bphy_err(drvr, "Buffer is too small: ignoring\n");
- goto exit;
- }
-
-@@ -3308,7 +3332,8 @@ static s32
- brcmf_notify_sched_scan_results(struct brcmf_if *ifp,
- const struct brcmf_event_msg *e, void *data)
- {
-- struct brcmf_cfg80211_info *cfg = ifp->drvr->config;
-+ struct brcmf_pub *drvr = ifp->drvr;
-+ struct brcmf_cfg80211_info *cfg = drvr->config;
- struct brcmf_pno_net_info_le *netinfo, *netinfo_start;
- struct cfg80211_scan_request *request = NULL;
- struct wiphy *wiphy = cfg_to_wiphy(cfg);
-@@ -3341,14 +3366,14 @@ brcmf_notify_sched_scan_results(struct b
- WARN_ON(status != BRCMF_PNO_SCAN_COMPLETE);
- brcmf_dbg(SCAN, "PFN NET FOUND event. count: %d\n", result_count);
- if (!result_count) {
-- bphy_err(wiphy, "FALSE PNO Event. (pfn_count == 0)\n");
-+ bphy_err(drvr, "FALSE PNO Event. (pfn_count == 0)\n");
- goto out_err;
- }
-
- netinfo_start = brcmf_get_netinfo_array(pfn_result);
- datalen = e->datalen - ((void *)netinfo_start - (void *)pfn_result);
- if (datalen < result_count * sizeof(*netinfo)) {
-- bphy_err(wiphy, "insufficient event data\n");
-+ bphy_err(drvr, "insufficient event data\n");
- goto out_err;
- }
-
-@@ -3395,14 +3420,15 @@ brcmf_cfg80211_sched_scan_start(struct w
- struct net_device *ndev,
- struct cfg80211_sched_scan_request *req)
- {
-- struct brcmf_if *ifp = netdev_priv(ndev);
- struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
-+ struct brcmf_if *ifp = netdev_priv(ndev);
-+ struct brcmf_pub *drvr = cfg->pub;
-
- brcmf_dbg(SCAN, "Enter: n_match_sets=%d n_ssids=%d\n",
- req->n_match_sets, req->n_ssids);
-
- if (test_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status)) {
-- bphy_err(wiphy, "Scanning suppressed: status=%lu\n",
-+ bphy_err(drvr, "Scanning suppressed: status=%lu\n",
- cfg->scan_status);
- return -EAGAIN;
- }
-@@ -3481,8 +3507,8 @@ static s32
- brcmf_wowl_nd_results(struct brcmf_if *ifp, const struct brcmf_event_msg *e,
- void *data)
- {
-- struct brcmf_cfg80211_info *cfg = ifp->drvr->config;
-- struct wiphy *wiphy = cfg_to_wiphy(cfg);
-+ struct brcmf_pub *drvr = ifp->drvr;
-+ struct brcmf_cfg80211_info *cfg = drvr->config;
- struct brcmf_pno_scanresults_le *pfn_result;
- struct brcmf_pno_net_info_le *netinfo;
-
-@@ -3501,7 +3527,7 @@ brcmf_wowl_nd_results(struct brcmf_if *i
- }
-
- if (le32_to_cpu(pfn_result->count) < 1) {
-- bphy_err(wiphy, "Invalid result count, expected 1 (%d)\n",
-+ bphy_err(drvr, "Invalid result count, expected 1 (%d)\n",
- le32_to_cpu(pfn_result->count));
- return -EINVAL;
- }
-@@ -3531,6 +3557,7 @@ brcmf_wowl_nd_results(struct brcmf_if *i
- static void brcmf_report_wowl_wakeind(struct wiphy *wiphy, struct brcmf_if *ifp)
- {
- struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
-+ struct brcmf_pub *drvr = cfg->pub;
- struct brcmf_wowl_wakeind_le wake_ind_le;
- struct cfg80211_wowlan_wakeup wakeup_data;
- struct cfg80211_wowlan_wakeup *wakeup;
-@@ -3541,7 +3568,7 @@ static void brcmf_report_wowl_wakeind(st
- err = brcmf_fil_iovar_data_get(ifp, "wowl_wakeind", &wake_ind_le,
- sizeof(wake_ind_le));
- if (err) {
-- bphy_err(wiphy, "Get wowl_wakeind failed, err = %d\n", err);
-+ bphy_err(drvr, "Get wowl_wakeind failed, err = %d\n", err);
- return;
- }
-
-@@ -3582,7 +3609,7 @@ static void brcmf_report_wowl_wakeind(st
- cfg->wowl.nd_data_completed,
- BRCMF_ND_INFO_TIMEOUT);
- if (!timeout)
-- bphy_err(wiphy, "No result for wowl net detect\n");
-+ bphy_err(drvr, "No result for wowl net detect\n");
- else
- wakeup_data.net_detect = cfg->wowl.nd_info;
- }
-@@ -3771,6 +3798,7 @@ brcmf_cfg80211_set_pmksa(struct wiphy *w
- struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
- struct brcmf_if *ifp = netdev_priv(ndev);
- struct brcmf_pmksa *pmk = &cfg->pmk_list.pmk[0];
-+ struct brcmf_pub *drvr = cfg->pub;
- s32 err;
- u32 npmk, i;
-
-@@ -3790,7 +3818,7 @@ brcmf_cfg80211_set_pmksa(struct wiphy *w
- cfg->pmk_list.npmk = cpu_to_le32(npmk);
- }
- } else {
-- bphy_err(wiphy, "Too many PMKSA entries cached %d\n", npmk);
-+ bphy_err(drvr, "Too many PMKSA entries cached %d\n", npmk);
- return -EINVAL;
- }
-
-@@ -3813,6 +3841,7 @@ brcmf_cfg80211_del_pmksa(struct wiphy *w
- struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
- struct brcmf_if *ifp = netdev_priv(ndev);
- struct brcmf_pmksa *pmk = &cfg->pmk_list.pmk[0];
-+ struct brcmf_pub *drvr = cfg->pub;
- s32 err;
- u32 npmk, i;
-
-@@ -3836,7 +3865,7 @@ brcmf_cfg80211_del_pmksa(struct wiphy *w
- memset(&pmk[i], 0, sizeof(*pmk));
- cfg->pmk_list.npmk = cpu_to_le32(npmk - 1);
- } else {
-- bphy_err(wiphy, "Cache entry not found\n");
-+ bphy_err(drvr, "Cache entry not found\n");
- return -EINVAL;
- }
-
-@@ -3868,20 +3897,20 @@ brcmf_cfg80211_flush_pmksa(struct wiphy
-
- static s32 brcmf_configure_opensecurity(struct brcmf_if *ifp)
- {
-- struct wiphy *wiphy = ifp->drvr->wiphy;
-+ struct brcmf_pub *drvr = ifp->drvr;
- s32 err;
- s32 wpa_val;
-
- /* set auth */
- err = brcmf_fil_bsscfg_int_set(ifp, "auth", 0);
- if (err < 0) {
-- bphy_err(wiphy, "auth error %d\n", err);
-+ bphy_err(drvr, "auth error %d\n", err);
- return err;
- }
- /* set wsec */
- err = brcmf_fil_bsscfg_int_set(ifp, "wsec", 0);
- if (err < 0) {
-- bphy_err(wiphy, "wsec error %d\n", err);
-+ bphy_err(drvr, "wsec error %d\n", err);
- return err;
- }
- /* set upper-layer auth */
-@@ -3891,7 +3920,7 @@ static s32 brcmf_configure_opensecurity(
- wpa_val = WPA_AUTH_DISABLED;
- err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", wpa_val);
- if (err < 0) {
-- bphy_err(wiphy, "wpa_auth error %d\n", err);
-+ bphy_err(drvr, "wpa_auth error %d\n", err);
- return err;
- }
-
-@@ -3911,7 +3940,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
- const struct brcmf_vs_tlv *wpa_ie,
- bool is_rsn_ie)
- {
-- struct wiphy *wiphy = ifp->drvr->wiphy;
-+ struct brcmf_pub *drvr = ifp->drvr;
- u32 auth = 0; /* d11 open authentication */
- u16 count;
- s32 err = 0;
-@@ -3942,13 +3971,13 @@ brcmf_configure_wpaie(struct brcmf_if *i
- /* check for multicast cipher suite */
- if (offset + WPA_IE_MIN_OUI_LEN > len) {
- err = -EINVAL;
-- bphy_err(wiphy, "no multicast cipher suite\n");
-+ bphy_err(drvr, "no multicast cipher suite\n");
- goto exit;
- }
-
- if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) {
- err = -EINVAL;
-- bphy_err(wiphy, "ivalid OUI\n");
-+ bphy_err(drvr, "ivalid OUI\n");
- goto exit;
- }
- offset += TLV_OUI_LEN;
-@@ -3970,7 +3999,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
- break;
- default:
- err = -EINVAL;
-- bphy_err(wiphy, "Invalid multi cast cipher info\n");
-+ bphy_err(drvr, "Invalid multi cast cipher info\n");
- goto exit;
- }
-
-@@ -3981,13 +4010,13 @@ brcmf_configure_wpaie(struct brcmf_if *i
- /* Check for unicast suite(s) */
- if (offset + (WPA_IE_MIN_OUI_LEN * count) > len) {
- err = -EINVAL;
-- bphy_err(wiphy, "no unicast cipher suite\n");
-+ bphy_err(drvr, "no unicast cipher suite\n");
- goto exit;
- }
- for (i = 0; i < count; i++) {
- if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) {
- err = -EINVAL;
-- bphy_err(wiphy, "ivalid OUI\n");
-+ bphy_err(drvr, "ivalid OUI\n");
- goto exit;
- }
- offset += TLV_OUI_LEN;
-@@ -4005,7 +4034,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
- pval |= AES_ENABLED;
- break;
- default:
-- bphy_err(wiphy, "Invalid unicast security info\n");
-+ bphy_err(drvr, "Invalid unicast security info\n");
- }
- offset++;
- }
-@@ -4015,13 +4044,13 @@ brcmf_configure_wpaie(struct brcmf_if *i
- /* Check for auth key management suite(s) */
- if (offset + (WPA_IE_MIN_OUI_LEN * count) > len) {
- err = -EINVAL;
-- bphy_err(wiphy, "no auth key mgmt suite\n");
-+ bphy_err(drvr, "no auth key mgmt suite\n");
- goto exit;
- }
- for (i = 0; i < count; i++) {
- if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) {
- err = -EINVAL;
-- bphy_err(wiphy, "ivalid OUI\n");
-+ bphy_err(drvr, "ivalid OUI\n");
- goto exit;
- }
- offset += TLV_OUI_LEN;
-@@ -4049,7 +4078,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
- wpa_auth |= WPA2_AUTH_1X_SHA256;
- break;
- default:
-- bphy_err(wiphy, "Invalid key mgmt info\n");
-+ bphy_err(drvr, "Invalid key mgmt info\n");
- }
- offset++;
- }
-@@ -4091,7 +4120,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
- err = brcmf_fil_bsscfg_int_set(ifp, "wme_bss_disable",
- wme_bss_disable);
- if (err < 0) {
-- bphy_err(wiphy, "wme_bss_disable error %d\n", err);
-+ bphy_err(drvr, "wme_bss_disable error %d\n", err);
- goto exit;
- }
-
-@@ -4105,7 +4134,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
- &data[offset],
- WPA_IE_MIN_OUI_LEN);
- if (err < 0) {
-- bphy_err(wiphy, "bip error %d\n", err);
-+ bphy_err(drvr, "bip error %d\n", err);
- goto exit;
- }
- }
-@@ -4116,13 +4145,13 @@ brcmf_configure_wpaie(struct brcmf_if *i
- /* set auth */
- err = brcmf_fil_bsscfg_int_set(ifp, "auth", auth);
- if (err < 0) {
-- bphy_err(wiphy, "auth error %d\n", err);
-+ bphy_err(drvr, "auth error %d\n", err);
- goto exit;
- }
- /* set wsec */
- err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
- if (err < 0) {
-- bphy_err(wiphy, "wsec error %d\n", err);
-+ bphy_err(drvr, "wsec error %d\n", err);
- goto exit;
- }
- /* Configure MFP, this needs to go after wsec otherwise the wsec command
-@@ -4131,14 +4160,14 @@ brcmf_configure_wpaie(struct brcmf_if *i
- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MFP)) {
- err = brcmf_fil_bsscfg_int_set(ifp, "mfp", mfp);
- if (err < 0) {
-- bphy_err(wiphy, "mfp error %d\n", err);
-+ bphy_err(drvr, "mfp error %d\n", err);
- goto exit;
- }
- }
- /* set upper-layer auth */
- err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", wpa_auth);
- if (err < 0) {
-- bphy_err(wiphy, "wpa_auth error %d\n", err);
-+ bphy_err(drvr, "wpa_auth error %d\n", err);
- goto exit;
- }
-
-@@ -4224,8 +4253,8 @@ brcmf_vndr_ie(u8 *iebuf, s32 pktflag, u8
- s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag,
- const u8 *vndr_ie_buf, u32 vndr_ie_len)
- {
-+ struct brcmf_pub *drvr;
- struct brcmf_if *ifp;
-- struct wiphy *wiphy;
- struct vif_saved_ie *saved_ie;
- s32 err = 0;
- u8 *iovar_ie_buf;
-@@ -4246,7 +4275,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
- if (!vif)
- return -ENODEV;
- ifp = vif->ifp;
-- wiphy = ifp->drvr->wiphy;
-+ drvr = ifp->drvr;
- saved_ie = &vif->saved_ie;
-
- brcmf_dbg(TRACE, "bsscfgidx %d, pktflag : 0x%02X\n", ifp->bsscfgidx,
-@@ -4278,13 +4307,13 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
- break;
- default:
- err = -EPERM;
-- bphy_err(wiphy, "not suitable type\n");
-+ bphy_err(drvr, "not suitable type\n");
- goto exit;
- }
-
- if (vndr_ie_len > mgmt_ie_buf_len) {
- err = -ENOMEM;
-- bphy_err(wiphy, "extra IE size too big\n");
-+ bphy_err(drvr, "extra IE size too big\n");
- goto exit;
- }
-
-@@ -4345,7 +4374,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
- /* verify remained buf size before copy data */
- if (remained_buf_len < (vndrie_info->vndrie.len +
- VNDR_IE_VSIE_OFFSET)) {
-- bphy_err(wiphy, "no space in mgmt_ie_buf: len left %d",
-+ bphy_err(drvr, "no space in mgmt_ie_buf: len left %d",
- remained_buf_len);
- break;
- }
-@@ -4377,7 +4406,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
- err = brcmf_fil_bsscfg_data_set(ifp, "vndr_ie", iovar_ie_buf,
- total_ie_buf_len);
- if (err)
-- bphy_err(wiphy, "vndr ie set error : %d\n", err);
-+ bphy_err(drvr, "vndr ie set error : %d\n", err);
- }
-
- exit:
-@@ -4405,14 +4434,14 @@ static s32
- brcmf_config_ap_mgmt_ie(struct brcmf_cfg80211_vif *vif,
- struct cfg80211_beacon_data *beacon)
- {
-- struct wiphy *wiphy = vif->ifp->drvr->wiphy;
-+ struct brcmf_pub *drvr = vif->ifp->drvr;
- s32 err;
-
- /* Set Beacon IEs to FW */
- err = brcmf_vif_set_mgmt_ie(vif, BRCMF_VNDR_IE_BEACON_FLAG,
- beacon->tail, beacon->tail_len);
- if (err) {
-- bphy_err(wiphy, "Set Beacon IE Failed\n");
-+ bphy_err(drvr, "Set Beacon IE Failed\n");
- return err;
- }
- brcmf_dbg(TRACE, "Applied Vndr IEs for Beacon\n");
-@@ -4422,7 +4451,7 @@ brcmf_config_ap_mgmt_ie(struct brcmf_cfg
- beacon->proberesp_ies,
- beacon->proberesp_ies_len);
- if (err)
-- bphy_err(wiphy, "Set Probe Resp IE Failed\n");
-+ bphy_err(drvr, "Set Probe Resp IE Failed\n");
- else
- brcmf_dbg(TRACE, "Applied Vndr IEs for Probe Resp\n");
-
-@@ -4436,6 +4465,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
- s32 ie_offset;
- struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
- struct brcmf_if *ifp = netdev_priv(ndev);
-+ struct brcmf_pub *drvr = cfg->pub;
- const struct brcmf_tlv *ssid_ie;
- const struct brcmf_tlv *country_ie;
- struct brcmf_ssid_le ssid_le;
-@@ -4531,7 +4561,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY,
- is_11d);
- if (err < 0) {
-- bphy_err(wiphy, "Regulatory Set Error, %d\n",
-+ bphy_err(drvr, "Regulatory Set Error, %d\n",
- err);
- goto exit;
- }
-@@ -4540,7 +4570,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD,
- settings->beacon_interval);
- if (err < 0) {
-- bphy_err(wiphy, "Beacon Interval Set Error, %d\n",
-+ bphy_err(drvr, "Beacon Interval Set Error, %d\n",
- err);
- goto exit;
- }
-@@ -4549,7 +4579,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_DTIMPRD,
- settings->dtim_period);
- if (err < 0) {
-- bphy_err(wiphy, "DTIM Interval Set Error, %d\n",
-+ bphy_err(drvr, "DTIM Interval Set Error, %d\n",
- err);
- goto exit;
- }
-@@ -4560,7 +4590,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
- !brcmf_feat_is_enabled(ifp, BRCMF_FEAT_RSDB))) {
- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1);
- if (err < 0) {
-- bphy_err(wiphy, "BRCMF_C_DOWN error %d\n",
-+ bphy_err(drvr, "BRCMF_C_DOWN error %d\n",
- err);
- goto exit;
- }
-@@ -4569,7 +4599,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
-
- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, 1);
- if (err < 0) {
-- bphy_err(wiphy, "SET INFRA error %d\n", err);
-+ bphy_err(drvr, "SET INFRA error %d\n", err);
- goto exit;
- }
- } else if (WARN_ON(supports_11d && (is_11d != ifp->vif->is_11d))) {
-@@ -4585,7 +4615,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
-
- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 1);
- if (err < 0) {
-- bphy_err(wiphy, "setting AP mode failed %d\n",
-+ bphy_err(drvr, "setting AP mode failed %d\n",
- err);
- goto exit;
- }
-@@ -4595,14 +4625,14 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
- */
- err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec);
- if (err < 0) {
-- bphy_err(wiphy, "Set Channel failed: chspec=%d, %d\n",
-+ bphy_err(drvr, "Set Channel failed: chspec=%d, %d\n",
- chanspec, err);
- goto exit;
- }
- }
- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1);
- if (err < 0) {
-- bphy_err(wiphy, "BRCMF_C_UP error (%d)\n", err);
-+ bphy_err(drvr, "BRCMF_C_UP error (%d)\n", err);
- goto exit;
- }
- /* On DOWN the firmware removes the WEP keys, reconfigure
-@@ -4617,14 +4647,14 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
- err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
- &join_params, sizeof(join_params));
- if (err < 0) {
-- bphy_err(wiphy, "SET SSID error (%d)\n", err);
-+ bphy_err(drvr, "SET SSID error (%d)\n", err);
- goto exit;
- }
-
- if (settings->hidden_ssid) {
- err = brcmf_fil_iovar_int_set(ifp, "closednet", 1);
- if (err) {
-- bphy_err(wiphy, "closednet error (%d)\n", err);
-+ bphy_err(drvr, "closednet error (%d)\n", err);
- goto exit;
- }
- }
-@@ -4633,14 +4663,14 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
- } else if (dev_role == NL80211_IFTYPE_P2P_GO) {
- err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec);
- if (err < 0) {
-- bphy_err(wiphy, "Set Channel failed: chspec=%d, %d\n",
-+ bphy_err(drvr, "Set Channel failed: chspec=%d, %d\n",
- chanspec, err);
- goto exit;
- }
- err = brcmf_fil_bsscfg_data_set(ifp, "ssid", &ssid_le,
- sizeof(ssid_le));
- if (err < 0) {
-- bphy_err(wiphy, "setting ssid failed %d\n", err);
-+ bphy_err(drvr, "setting ssid failed %d\n", err);
- goto exit;
- }
- bss_enable.bsscfgidx = cpu_to_le32(ifp->bsscfgidx);
-@@ -4648,7 +4678,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
- err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable,
- sizeof(bss_enable));
- if (err < 0) {
-- bphy_err(wiphy, "bss_enable config failed %d\n", err);
-+ bphy_err(drvr, "bss_enable config failed %d\n", err);
- goto exit;
- }
-
-@@ -4671,7 +4701,9 @@ exit:
-
- static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev)
- {
-+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
- struct brcmf_if *ifp = netdev_priv(ndev);
-+ struct brcmf_pub *drvr = cfg->pub;
- s32 err;
- struct brcmf_fil_bss_enable_le bss_enable;
- struct brcmf_join_params join_params;
-@@ -4696,13 +4728,13 @@ static int brcmf_cfg80211_stop_ap(struct
- err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
- &join_params, sizeof(join_params));
- if (err < 0)
-- bphy_err(wiphy, "SET SSID error (%d)\n", err);
-+ bphy_err(drvr, "SET SSID error (%d)\n", err);
- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1);
- if (err < 0)
-- bphy_err(wiphy, "BRCMF_C_DOWN error %d\n", err);
-+ bphy_err(drvr, "BRCMF_C_DOWN error %d\n", err);
- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 0);
- if (err < 0)
-- bphy_err(wiphy, "setting AP mode failed %d\n", err);
-+ bphy_err(drvr, "setting AP mode failed %d\n", err);
- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS))
- brcmf_fil_iovar_int_set(ifp, "mbss", 0);
- brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY,
-@@ -4710,7 +4742,7 @@ static int brcmf_cfg80211_stop_ap(struct
- /* Bring device back up so it can be used again */
- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1);
- if (err < 0)
-- bphy_err(wiphy, "BRCMF_C_UP error %d\n", err);
-+ bphy_err(drvr, "BRCMF_C_UP error %d\n", err);
-
- brcmf_vif_clear_mgmt_ies(ifp->vif);
- } else {
-@@ -4719,7 +4751,7 @@ static int brcmf_cfg80211_stop_ap(struct
- err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable,
- sizeof(bss_enable));
- if (err < 0)
-- bphy_err(wiphy, "bss_enable config failed %d\n", err);
-+ bphy_err(drvr, "bss_enable config failed %d\n", err);
- }
- brcmf_set_mpc(ifp, 1);
- brcmf_configure_arp_nd_offload(ifp, true);
-@@ -4748,6 +4780,7 @@ brcmf_cfg80211_del_station(struct wiphy
- struct station_del_parameters *params)
- {
- struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
-+ struct brcmf_pub *drvr = cfg->pub;
- struct brcmf_scb_val_le scbval;
- struct brcmf_if *ifp = netdev_priv(ndev);
- s32 err;
-@@ -4767,7 +4800,7 @@ brcmf_cfg80211_del_station(struct wiphy
- err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCB_DEAUTHENTICATE_FOR_REASON,
- &scbval, sizeof(scbval));
- if (err)
-- bphy_err(wiphy, "SCB_DEAUTHENTICATE_FOR_REASON failed %d\n",
-+ bphy_err(drvr, "SCB_DEAUTHENTICATE_FOR_REASON failed %d\n",
- err);
-
- brcmf_dbg(TRACE, "Exit\n");
-@@ -4778,6 +4811,8 @@ static int
- brcmf_cfg80211_change_station(struct wiphy *wiphy, struct net_device *ndev,
- const u8 *mac, struct station_parameters *params)
- {
-+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
-+ struct brcmf_pub *drvr = cfg->pub;
- struct brcmf_if *ifp = netdev_priv(ndev);
- s32 err;
-
-@@ -4798,7 +4833,7 @@ brcmf_cfg80211_change_station(struct wip
- err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SCB_DEAUTHORIZE,
- (void *)mac, ETH_ALEN);
- if (err < 0)
-- bphy_err(wiphy, "Setting SCB (de-)authorize failed, %d\n", err);
-+ bphy_err(drvr, "Setting SCB (de-)authorize failed, %d\n", err);
-
- return err;
- }
-@@ -4828,6 +4863,7 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wip
- {
- struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
- struct ieee80211_channel *chan = params->chan;
-+ struct brcmf_pub *drvr = cfg->pub;
- const u8 *buf = params->buf;
- size_t len = params->len;
- const struct ieee80211_mgmt *mgmt;
-@@ -4848,7 +4884,7 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wip
- mgmt = (const struct ieee80211_mgmt *)buf;
-
- if (!ieee80211_is_mgmt(mgmt->frame_control)) {
-- bphy_err(wiphy, "Driver only allows MGMT packet type\n");
-+ bphy_err(drvr, "Driver only allows MGMT packet type\n");
- return -EPERM;
- }
-
-@@ -4879,13 +4915,13 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wip
- GFP_KERNEL);
- } else if (ieee80211_is_action(mgmt->frame_control)) {
- if (len > BRCMF_FIL_ACTION_FRAME_SIZE + DOT11_MGMT_HDR_LEN) {
-- bphy_err(wiphy, "invalid action frame length\n");
-+ bphy_err(drvr, "invalid action frame length\n");
- err = -EINVAL;
- goto exit;
- }
- af_params = kzalloc(sizeof(*af_params), GFP_KERNEL);
- if (af_params == NULL) {
-- bphy_err(wiphy, "unable to allocate frame\n");
-+ bphy_err(drvr, "unable to allocate frame\n");
- err = -ENOMEM;
- goto exit;
- }
-@@ -4936,6 +4972,7 @@ brcmf_cfg80211_cancel_remain_on_channel(
- u64 cookie)
- {
- struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
-+ struct brcmf_pub *drvr = cfg->pub;
- struct brcmf_cfg80211_vif *vif;
- int err = 0;
-
-@@ -4943,7 +4980,7 @@ brcmf_cfg80211_cancel_remain_on_channel(
-
- vif = cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif;
- if (vif == NULL) {
-- bphy_err(wiphy, "No p2p device available for probe response\n");
-+ bphy_err(drvr, "No p2p device available for probe response\n");
- err = -ENODEV;
- goto exit;
- }
-@@ -4958,6 +4995,7 @@ static int brcmf_cfg80211_get_channel(st
- {
- struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
- struct net_device *ndev = wdev->netdev;
-+ struct brcmf_pub *drvr = cfg->pub;
- struct brcmf_if *ifp;
- struct brcmu_chan ch;
- enum nl80211_band band = 0;
-@@ -4971,7 +5009,7 @@ static int brcmf_cfg80211_get_channel(st
-
- err = brcmf_fil_iovar_int_get(ifp, "chanspec", &chanspec);
- if (err) {
-- bphy_err(wiphy, "chanspec failed (%d)\n", err);
-+ bphy_err(drvr, "chanspec failed (%d)\n", err);
- return err;
- }
-
-@@ -5093,6 +5131,8 @@ static int brcmf_cfg80211_tdls_oper(stru
- struct net_device *ndev, const u8 *peer,
- enum nl80211_tdls_operation oper)
- {
-+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
-+ struct brcmf_pub *drvr = cfg->pub;
- struct brcmf_if *ifp;
- struct brcmf_tdls_iovar_le info;
- int ret = 0;
-@@ -5110,7 +5150,7 @@ static int brcmf_cfg80211_tdls_oper(stru
- ret = brcmf_fil_iovar_data_set(ifp, "tdls_endpoint",
- &info, sizeof(info));
- if (ret < 0)
-- bphy_err(wiphy, "tdls_endpoint iovar failed: ret=%d\n", ret);
-+ bphy_err(drvr, "tdls_endpoint iovar failed: ret=%d\n", ret);
-
- return ret;
- }
-@@ -5121,6 +5161,8 @@ brcmf_cfg80211_update_conn_params(struct
- struct cfg80211_connect_params *sme,
- u32 changed)
- {
-+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
-+ struct brcmf_pub *drvr = cfg->pub;
- struct brcmf_if *ifp;
- int err;
-
-@@ -5131,7 +5173,7 @@ brcmf_cfg80211_update_conn_params(struct
- err = brcmf_vif_set_mgmt_ie(ifp->vif, BRCMF_VNDR_IE_ASSOCREQ_FLAG,
- sme->ie, sme->ie_len);
- if (err)
-- bphy_err(wiphy, "Set Assoc REQ IE Failed\n");
-+ bphy_err(drvr, "Set Assoc REQ IE Failed\n");
- else
- brcmf_dbg(TRACE, "Applied Vndr IEs for Assoc request\n");
-
-@@ -5143,6 +5185,8 @@ static int
- brcmf_cfg80211_set_rekey_data(struct wiphy *wiphy, struct net_device *ndev,
- struct cfg80211_gtk_rekey_data *gtk)
- {
-+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
-+ struct brcmf_pub *drvr = cfg->pub;
- struct brcmf_if *ifp = netdev_priv(ndev);
- struct brcmf_gtk_keyinfo_le gtk_le;
- int ret;
-@@ -5157,7 +5201,7 @@ brcmf_cfg80211_set_rekey_data(struct wip
- ret = brcmf_fil_iovar_data_set(ifp, "gtk_key_info", >k_le,
- sizeof(gtk_le));
- if (ret < 0)
-- bphy_err(wiphy, "gtk_key_info iovar failed: ret=%d\n", ret);
-+ bphy_err(drvr, "gtk_key_info iovar failed: ret=%d\n", ret);
-
- return ret;
- }
-@@ -5389,7 +5433,7 @@ static void brcmf_clear_assoc_ies(struct
- static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg,
- struct brcmf_if *ifp)
- {
-- struct wiphy *wiphy = cfg_to_wiphy(cfg);
-+ struct brcmf_pub *drvr = cfg->pub;
- struct brcmf_cfg80211_assoc_ielen_le *assoc_info;
- struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg);
- u32 req_len;
-@@ -5401,7 +5445,7 @@ static s32 brcmf_get_assoc_ies(struct br
- err = brcmf_fil_iovar_data_get(ifp, "assoc_info",
- cfg->extra_buf, WL_ASSOC_INFO_MAX);
- if (err) {
-- bphy_err(wiphy, "could not get assoc info (%d)\n", err);
-+ bphy_err(drvr, "could not get assoc info (%d)\n", err);
- return err;
- }
- assoc_info =
-@@ -5413,7 +5457,7 @@ static s32 brcmf_get_assoc_ies(struct br
- cfg->extra_buf,
- WL_ASSOC_INFO_MAX);
- if (err) {
-- bphy_err(wiphy, "could not get assoc req (%d)\n", err);
-+ bphy_err(drvr, "could not get assoc req (%d)\n", err);
- return err;
- }
- conn_info->req_ie_len = req_len;
-@@ -5429,7 +5473,7 @@ static s32 brcmf_get_assoc_ies(struct br
- cfg->extra_buf,
- WL_ASSOC_INFO_MAX);
- if (err) {
-- bphy_err(wiphy, "could not get assoc resp (%d)\n", err);
-+ bphy_err(drvr, "could not get assoc resp (%d)\n", err);
- return err;
- }
- conn_info->resp_ie_len = resp_len;
-@@ -5556,7 +5600,7 @@ brcmf_notify_connect_status_ap(struct br
- struct net_device *ndev,
- const struct brcmf_event_msg *e, void *data)
- {
-- struct wiphy *wiphy = cfg_to_wiphy(cfg);
-+ struct brcmf_pub *drvr = cfg->pub;
- static int generation;
- u32 event = e->event_code;
- u32 reason = e->reason;
-@@ -5574,7 +5618,7 @@ brcmf_notify_connect_status_ap(struct br
- if (((event == BRCMF_E_ASSOC_IND) || (event == BRCMF_E_REASSOC_IND)) &&
- (reason == BRCMF_E_STATUS_SUCCESS)) {
- if (!data) {
-- bphy_err(wiphy, "No IEs present in ASSOC/REASSOC_IND\n");
-+ bphy_err(drvr, "No IEs present in ASSOC/REASSOC_IND\n");
- return -EINVAL;
- }
-
-@@ -5866,7 +5910,7 @@ static void init_vif_event(struct brcmf_
-
- static s32 brcmf_dongle_roam(struct brcmf_if *ifp)
- {
-- struct wiphy *wiphy = ifp->drvr->wiphy;
-+ struct brcmf_pub *drvr = ifp->drvr;
- s32 err;
- u32 bcn_timeout;
- __le32 roamtrigger[2];
-@@ -5879,7 +5923,7 @@ static s32 brcmf_dongle_roam(struct brcm
- bcn_timeout = BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_ON;
- err = brcmf_fil_iovar_int_set(ifp, "bcn_timeout", bcn_timeout);
- if (err) {
-- bphy_err(wiphy, "bcn_timeout error (%d)\n", err);
-+ bphy_err(drvr, "bcn_timeout error (%d)\n", err);
- goto roam_setup_done;
- }
-
-@@ -5891,7 +5935,7 @@ static s32 brcmf_dongle_roam(struct brcm
- err = brcmf_fil_iovar_int_set(ifp, "roam_off",
- ifp->drvr->settings->roamoff);
- if (err) {
-- bphy_err(wiphy, "roam_off error (%d)\n", err);
-+ bphy_err(drvr, "roam_off error (%d)\n", err);
- goto roam_setup_done;
- }
-
-@@ -5900,7 +5944,7 @@ static s32 brcmf_dongle_roam(struct brcm
- err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_ROAM_TRIGGER,
- (void *)roamtrigger, sizeof(roamtrigger));
- if (err) {
-- bphy_err(wiphy, "WLC_SET_ROAM_TRIGGER error (%d)\n", err);
-+ bphy_err(drvr, "WLC_SET_ROAM_TRIGGER error (%d)\n", err);
- goto roam_setup_done;
- }
-
-@@ -5909,7 +5953,7 @@ static s32 brcmf_dongle_roam(struct brcm
- err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_ROAM_DELTA,
- (void *)roam_delta, sizeof(roam_delta));
- if (err) {
-- bphy_err(wiphy, "WLC_SET_ROAM_DELTA error (%d)\n", err);
-+ bphy_err(drvr, "WLC_SET_ROAM_DELTA error (%d)\n", err);
- goto roam_setup_done;
- }
-
-@@ -5920,26 +5964,26 @@ roam_setup_done:
- static s32
- brcmf_dongle_scantime(struct brcmf_if *ifp)
- {
-- struct wiphy *wiphy = ifp->drvr->wiphy;
-+ struct brcmf_pub *drvr = ifp->drvr;
- s32 err = 0;
-
- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_CHANNEL_TIME,
- BRCMF_SCAN_CHANNEL_TIME);
- if (err) {
-- bphy_err(wiphy, "Scan assoc time error (%d)\n", err);
-+ bphy_err(drvr, "Scan assoc time error (%d)\n", err);
- goto dongle_scantime_out;
- }
- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_UNASSOC_TIME,
- BRCMF_SCAN_UNASSOC_TIME);
- if (err) {
-- bphy_err(wiphy, "Scan unassoc time error (%d)\n", err);
-+ bphy_err(drvr, "Scan unassoc time error (%d)\n", err);
- goto dongle_scantime_out;
- }
-
- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_PASSIVE_TIME,
- BRCMF_SCAN_PASSIVE_TIME);
- if (err) {
-- bphy_err(wiphy, "Scan passive time error (%d)\n", err);
-+ bphy_err(drvr, "Scan passive time error (%d)\n", err);
- goto dongle_scantime_out;
- }
-
-@@ -5972,7 +6016,8 @@ static int brcmf_construct_chaninfo(stru
- u32 bw_cap[])
- {
- struct wiphy *wiphy = cfg_to_wiphy(cfg);
-- struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
-+ struct brcmf_pub *drvr = cfg->pub;
-+ struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
- struct ieee80211_supported_band *band;
- struct ieee80211_channel *channel;
- struct brcmf_chanspec_list *list;
-@@ -5993,7 +6038,7 @@ static int brcmf_construct_chaninfo(stru
- err = brcmf_fil_iovar_data_get(ifp, "chanspecs", pbuf,
- BRCMF_DCMD_MEDLEN);
- if (err) {
-- bphy_err(wiphy, "get chanspecs error (%d)\n", err);
-+ bphy_err(drvr, "get chanspecs error (%d)\n", err);
- goto fail_pbuf;
- }
-
-@@ -6016,7 +6061,7 @@ static int brcmf_construct_chaninfo(stru
- } else if (ch.band == BRCMU_CHAN_BAND_5G) {
- band = wiphy->bands[NL80211_BAND_5GHZ];
- } else {
-- bphy_err(wiphy, "Invalid channel Spec. 0x%x.\n",
-+ bphy_err(drvr, "Invalid channel Spec. 0x%x.\n",
- ch.chspec);
- continue;
- }
-@@ -6040,7 +6085,7 @@ static int brcmf_construct_chaninfo(stru
- /* It seems firmware supports some channel we never
- * considered. Something new in IEEE standard?
- */
-- bphy_err(wiphy, "Ignoring unexpected firmware channel %d\n",
-+ bphy_err(drvr, "Ignoring unexpected firmware channel %d\n",
- ch.control_ch_num);
- continue;
- }
-@@ -6097,8 +6142,8 @@ fail_pbuf:
-
- static int brcmf_enable_bw40_2g(struct brcmf_cfg80211_info *cfg)
- {
-- struct wiphy *wiphy = cfg_to_wiphy(cfg);
-- struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
-+ struct brcmf_pub *drvr = cfg->pub;
-+ struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
- struct ieee80211_supported_band *band;
- struct brcmf_fil_bwcap_le band_bwcap;
- struct brcmf_chanspec_list *list;
-@@ -6144,7 +6189,7 @@ static int brcmf_enable_bw40_2g(struct b
- err = brcmf_fil_iovar_data_get(ifp, "chanspecs", pbuf,
- BRCMF_DCMD_MEDLEN);
- if (err) {
-- bphy_err(wiphy, "get chanspecs error (%d)\n", err);
-+ bphy_err(drvr, "get chanspecs error (%d)\n", err);
- kfree(pbuf);
- return err;
- }
-@@ -6175,7 +6220,7 @@ static int brcmf_enable_bw40_2g(struct b
-
- static void brcmf_get_bwcap(struct brcmf_if *ifp, u32 bw_cap[])
- {
-- struct wiphy *wiphy = ifp->drvr->wiphy;
-+ struct brcmf_pub *drvr = ifp->drvr;
- u32 band, mimo_bwcap;
- int err;
-
-@@ -6211,7 +6256,7 @@ static void brcmf_get_bwcap(struct brcmf
- bw_cap[NL80211_BAND_5GHZ] |= WLC_BW_20MHZ_BIT;
- break;
- default:
-- bphy_err(wiphy, "invalid mimo_bw_cap value\n");
-+ bphy_err(drvr, "invalid mimo_bw_cap value\n");
- }
- }
-
-@@ -6286,7 +6331,8 @@ static void brcmf_update_vht_cap(struct
-
- static int brcmf_setup_wiphybands(struct brcmf_cfg80211_info *cfg)
- {
-- struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
-+ struct brcmf_pub *drvr = cfg->pub;
-+ struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
- struct wiphy *wiphy = cfg_to_wiphy(cfg);
- u32 nmode = 0;
- u32 vhtmode = 0;
-@@ -6303,7 +6349,7 @@ static int brcmf_setup_wiphybands(struct
- (void)brcmf_fil_iovar_int_get(ifp, "vhtmode", &vhtmode);
- err = brcmf_fil_iovar_int_get(ifp, "nmode", &nmode);
- if (err) {
-- bphy_err(wiphy, "nmode error (%d)\n", err);
-+ bphy_err(drvr, "nmode error (%d)\n", err);
- } else {
- brcmf_get_bwcap(ifp, bw_cap);
- }
-@@ -6313,7 +6359,7 @@ static int brcmf_setup_wiphybands(struct
-
- err = brcmf_fil_iovar_int_get(ifp, "rxchain", &rxchain);
- if (err) {
-- bphy_err(wiphy, "rxchain error (%d)\n", err);
-+ bphy_err(drvr, "rxchain error (%d)\n", err);
- nchain = 1;
- } else {
- for (nchain = 0; rxchain; nchain++)
-@@ -6323,7 +6369,7 @@ static int brcmf_setup_wiphybands(struct
-
- err = brcmf_construct_chaninfo(cfg, bw_cap);
- if (err) {
-- bphy_err(wiphy, "brcmf_construct_chaninfo failed (%d)\n", err);
-+ bphy_err(drvr, "brcmf_construct_chaninfo failed (%d)\n", err);
- return err;
- }
-
-@@ -6530,12 +6576,13 @@ static void brcmf_wiphy_wowl_params(stru
- {
- #ifdef CONFIG_PM
- struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
-+ struct brcmf_pub *drvr = cfg->pub;
- struct wiphy_wowlan_support *wowl;
-
- wowl = kmemdup(&brcmf_wowlan_support, sizeof(brcmf_wowlan_support),
- GFP_KERNEL);
- if (!wowl) {
-- bphy_err(wiphy, "only support basic wowlan features\n");
-+ bphy_err(drvr, "only support basic wowlan features\n");
- wiphy->wowlan = &brcmf_wowlan_support;
- return;
- }
-@@ -6632,7 +6679,7 @@ static int brcmf_setup_wiphy(struct wiph
- err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BANDLIST, &bandlist,
- sizeof(bandlist));
- if (err) {
-- bphy_err(wiphy, "could not obtain band info: err=%d\n", err);
-+ bphy_err(drvr, "could not obtain band info: err=%d\n", err);
- return err;
- }
- /* first entry in bandlist is number of bands */
-@@ -6681,7 +6728,7 @@ static int brcmf_setup_wiphy(struct wiph
-
- static s32 brcmf_config_dongle(struct brcmf_cfg80211_info *cfg)
- {
-- struct wiphy *wiphy = cfg_to_wiphy(cfg);
-+ struct brcmf_pub *drvr = cfg->pub;
- struct net_device *ndev;
- struct wireless_dev *wdev;
- struct brcmf_if *ifp;
-@@ -6719,7 +6766,7 @@ static s32 brcmf_config_dongle(struct br
-
- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_FAKEFRAG, 1);
- if (err) {
-- bphy_err(wiphy, "failed to set frameburst mode\n");
-+ bphy_err(drvr, "failed to set frameburst mode\n");
- goto default_conf_out;
- }
-
-@@ -6900,6 +6947,7 @@ static void brcmf_cfg80211_reg_notifier(
- {
- struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
- struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
-+ struct brcmf_pub *drvr = cfg->pub;
- struct brcmf_fil_country_le ccreq;
- s32 err;
- int i;
-@@ -6911,7 +6959,7 @@ static void brcmf_cfg80211_reg_notifier(
- /* ignore non-ISO3166 country codes */
- for (i = 0; i < 2; i++)
- if (req->alpha2[i] < 'A' || req->alpha2[i] > 'Z') {
-- bphy_err(wiphy, "not an ISO3166 code (0x%02x 0x%02x)\n",
-+ bphy_err(drvr, "not an ISO3166 code (0x%02x 0x%02x)\n",
- req->alpha2[0], req->alpha2[1]);
- return;
- }
-@@ -6921,7 +6969,7 @@ static void brcmf_cfg80211_reg_notifier(
-
- err = brcmf_fil_iovar_data_get(ifp, "country", &ccreq, sizeof(ccreq));
- if (err) {
-- bphy_err(wiphy, "Country code iovar returned err = %d\n", err);
-+ bphy_err(drvr, "Country code iovar returned err = %d\n", err);
- return;
- }
-
-@@ -6931,7 +6979,7 @@ static void brcmf_cfg80211_reg_notifier(
-
- err = brcmf_fil_iovar_data_set(ifp, "country", &ccreq, sizeof(ccreq));
- if (err) {
-- bphy_err(wiphy, "Firmware rejected country setting\n");
-+ bphy_err(drvr, "Firmware rejected country setting\n");
- return;
- }
- brcmf_setup_wiphybands(cfg);
-@@ -6977,13 +7025,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802
- u16 *cap = NULL;
-
- if (!ndev) {
-- bphy_err(wiphy, "ndev is invalid\n");
-+ bphy_err(drvr, "ndev is invalid\n");
- return NULL;
- }
-
- cfg = kzalloc(sizeof(*cfg), GFP_KERNEL);
- if (!cfg) {
-- bphy_err(wiphy, "Could not allocate wiphy device\n");
-+ bphy_err(drvr, "Could not allocate wiphy device\n");
- return NULL;
- }
-
-@@ -7004,7 +7052,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
-
- err = wl_init_priv(cfg);
- if (err) {
-- bphy_err(wiphy, "Failed to init iwm_priv (%d)\n", err);
-+ bphy_err(drvr, "Failed to init iwm_priv (%d)\n", err);
- brcmf_free_vif(vif);
- goto wiphy_out;
- }
-@@ -7013,7 +7061,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
- /* determine d11 io type before wiphy setup */
- err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_VERSION, &io_type);
- if (err) {
-- bphy_err(wiphy, "Failed to get D11 version (%d)\n", err);
-+ bphy_err(drvr, "Failed to get D11 version (%d)\n", err);
- goto priv_out;
- }
- cfg->d11inf.io_type = (u8)io_type;
-@@ -7047,13 +7095,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802
- #endif
- err = wiphy_register(wiphy);
- if (err < 0) {
-- bphy_err(wiphy, "Could not register wiphy device (%d)\n", err);
-+ bphy_err(drvr, "Could not register wiphy device (%d)\n", err);
- goto priv_out;
- }
-
- err = brcmf_setup_wiphybands(cfg);
- if (err) {
-- bphy_err(wiphy, "Setting wiphy bands failed (%d)\n", err);
-+ bphy_err(drvr, "Setting wiphy bands failed (%d)\n", err);
- goto wiphy_unreg_out;
- }
-
-@@ -7071,24 +7119,24 @@ struct brcmf_cfg80211_info *brcmf_cfg802
-
- err = brcmf_fweh_activate_events(ifp);
- if (err) {
-- bphy_err(wiphy, "FWEH activation failed (%d)\n", err);
-+ bphy_err(drvr, "FWEH activation failed (%d)\n", err);
- goto wiphy_unreg_out;
- }
-
- err = brcmf_p2p_attach(cfg, p2pdev_forced);
- if (err) {
-- bphy_err(wiphy, "P2P initialisation failed (%d)\n", err);
-+ bphy_err(drvr, "P2P initialisation failed (%d)\n", err);
- goto wiphy_unreg_out;
- }
- err = brcmf_btcoex_attach(cfg);
- if (err) {
-- bphy_err(wiphy, "BT-coex initialisation failed (%d)\n", err);
-+ bphy_err(drvr, "BT-coex initialisation failed (%d)\n", err);
- brcmf_p2p_detach(&cfg->p2p);
- goto wiphy_unreg_out;
- }
- err = brcmf_pno_attach(cfg);
- if (err) {
-- bphy_err(wiphy, "PNO initialisation failed (%d)\n", err);
-+ bphy_err(drvr, "PNO initialisation failed (%d)\n", err);
- brcmf_btcoex_detach(cfg);
- brcmf_p2p_detach(&cfg->p2p);
- goto wiphy_unreg_out;
-@@ -7108,7 +7156,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
- /* (re-) activate FWEH event handling */
- err = brcmf_fweh_activate_events(ifp);
- if (err) {
-- bphy_err(wiphy, "FWEH activation failed (%d)\n", err);
-+ bphy_err(drvr, "FWEH activation failed (%d)\n", err);
- goto detach;
- }
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
-@@ -62,12 +62,12 @@ void __brcmf_err(struct brcmf_bus *bus,
- } while (0)
- #endif
-
--#define bphy_err(wiphy, fmt, ...) \
-+#define bphy_err(drvr, fmt, ...) \
- do { \
- if (IS_ENABLED(CPTCFG_BRCMDBG) || \
- IS_ENABLED(CPTCFG_BRCM_TRACING) || \
- net_ratelimit()) \
-- wiphy_err(wiphy, "%s: " fmt, __func__, \
-+ wiphy_err((drvr)->wiphy, "%s: " fmt, __func__, \
- ##__VA_ARGS__); \
- } while (0)
-
+++ /dev/null
-From e4d1b2716b8859199c28f2ac5f984bd05a146a6b Mon Sep 17 00:00:00 2001
-From: YueHaibing <yuehaibing@huawei.com>
-Date: Mon, 18 Feb 2019 08:08:46 +0000
-Subject: [PATCH] brcmfmac: remove set but not used variable 'old_state'
-
-Fixes gcc '-Wunused-but-set-variable' warning:
-
-drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c: In function 'brcmf_usb_state_change':
-drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c:578:6: warning:
- variable 'old_state' set but not used [-Wunused-but-set-variable]
-
-It's never used and can be removed.
-
-Signed-off-by: YueHaibing <yuehaibing@huawei.com>
-Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 2 --
- 1 file changed, 2 deletions(-)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
-@@ -575,7 +575,6 @@ static void
- brcmf_usb_state_change(struct brcmf_usbdev_info *devinfo, int state)
- {
- struct brcmf_bus *bcmf_bus = devinfo->bus_pub.bus;
-- int old_state;
-
- brcmf_dbg(USB, "Enter, current state=%d, new state=%d\n",
- devinfo->bus_pub.state, state);
-@@ -583,7 +582,6 @@ brcmf_usb_state_change(struct brcmf_usbd
- if (devinfo->bus_pub.state == state)
- return;
-
-- old_state = devinfo->bus_pub.state;
- devinfo->bus_pub.state = state;
-
- /* update state of upper layer */
+++ /dev/null
-From dcb1471bc6d0541d636c7ecd9239573304842884 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Tue, 19 Feb 2019 23:42:19 +0100
-Subject: [PATCH] brcmfmac: use bphy_err() in all wiphy-related code
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This recently added macro provides more meaningful error messages thanks
-to identifying a specific wiphy. It's especially important on systems
-with few cards supported by the same (brcmfmac) driver.
-
-Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
-Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- .../broadcom/brcm80211/brcmfmac/bcdc.c | 22 ++---
- .../broadcom/brcm80211/brcmfmac/common.c | 39 ++++----
- .../broadcom/brcm80211/brcmfmac/core.c | 74 ++++++++--------
- .../broadcom/brcm80211/brcmfmac/feature.c | 8 +-
- .../broadcom/brcm80211/brcmfmac/fweh.c | 25 +++---
- .../broadcom/brcm80211/brcmfmac/fwil.c | 10 +--
- .../broadcom/brcm80211/brcmfmac/fwsignal.c | 38 ++++----
- .../broadcom/brcm80211/brcmfmac/msgbuf.c | 65 ++++++++------
- .../broadcom/brcm80211/brcmfmac/p2p.c | 88 +++++++++++--------
- .../broadcom/brcm80211/brcmfmac/pno.c | 22 +++--
- .../broadcom/brcm80211/brcmfmac/proto.c | 6 +-
- 11 files changed, 224 insertions(+), 173 deletions(-)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
-@@ -178,8 +178,8 @@ brcmf_proto_bcdc_query_dcmd(struct brcmf
- *fwerr = 0;
- ret = brcmf_proto_bcdc_msg(drvr, ifidx, cmd, buf, len, false);
- if (ret < 0) {
-- brcmf_err("brcmf_proto_bcdc_msg failed w/status %d\n",
-- ret);
-+ bphy_err(drvr, "brcmf_proto_bcdc_msg failed w/status %d\n",
-+ ret);
- goto done;
- }
-
-@@ -195,9 +195,9 @@ retry:
- if ((id < bcdc->reqid) && (++retries < RETRIES))
- goto retry;
- if (id != bcdc->reqid) {
-- brcmf_err("%s: unexpected request id %d (expected %d)\n",
-- brcmf_ifname(brcmf_get_ifp(drvr, ifidx)), id,
-- bcdc->reqid);
-+ bphy_err(drvr, "%s: unexpected request id %d (expected %d)\n",
-+ brcmf_ifname(brcmf_get_ifp(drvr, ifidx)), id,
-+ bcdc->reqid);
- ret = -EINVAL;
- goto done;
- }
-@@ -245,9 +245,9 @@ brcmf_proto_bcdc_set_dcmd(struct brcmf_p
- id = (flags & BCDC_DCMD_ID_MASK) >> BCDC_DCMD_ID_SHIFT;
-
- if (id != bcdc->reqid) {
-- brcmf_err("%s: unexpected request id %d (expected %d)\n",
-- brcmf_ifname(brcmf_get_ifp(drvr, ifidx)), id,
-- bcdc->reqid);
-+ bphy_err(drvr, "%s: unexpected request id %d (expected %d)\n",
-+ brcmf_ifname(brcmf_get_ifp(drvr, ifidx)), id,
-+ bcdc->reqid);
- ret = -EINVAL;
- goto done;
- }
-@@ -312,8 +312,8 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
- }
- if (((h->flags & BCDC_FLAG_VER_MASK) >> BCDC_FLAG_VER_SHIFT) !=
- BCDC_PROTO_VER) {
-- brcmf_err("%s: non-BCDC packet received, flags 0x%x\n",
-- brcmf_ifname(tmp_if), h->flags);
-+ bphy_err(drvr, "%s: non-BCDC packet received, flags 0x%x\n",
-+ brcmf_ifname(tmp_if), h->flags);
- return -EBADE;
- }
-
-@@ -460,7 +460,7 @@ int brcmf_proto_bcdc_attach(struct brcmf
-
- /* ensure that the msg buf directly follows the cdc msg struct */
- if ((unsigned long)(&bcdc->msg + 1) != (unsigned long)bcdc->buf) {
-- brcmf_err("struct brcmf_proto_bcdc is not correctly defined\n");
-+ bphy_err(drvr, "struct brcmf_proto_bcdc is not correctly defined\n");
- goto fail;
- }
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
-@@ -90,6 +90,7 @@ struct brcmf_mp_global_t brcmf_mp_global
-
- void brcmf_c_set_joinpref_default(struct brcmf_if *ifp)
- {
-+ struct brcmf_pub *drvr = ifp->drvr;
- struct brcmf_join_pref_params join_pref_params[2];
- int err;
-
-@@ -106,7 +107,7 @@ void brcmf_c_set_joinpref_default(struct
- err = brcmf_fil_iovar_data_set(ifp, "join_pref", join_pref_params,
- sizeof(join_pref_params));
- if (err)
-- brcmf_err("Set join_pref error (%d)\n", err);
-+ bphy_err(drvr, "Set join_pref error (%d)\n", err);
- }
-
- static int brcmf_c_download(struct brcmf_if *ifp, u16 flag,
-@@ -129,7 +130,8 @@ static int brcmf_c_download(struct brcmf
-
- static int brcmf_c_process_clm_blob(struct brcmf_if *ifp)
- {
-- struct brcmf_bus *bus = ifp->drvr->bus_if;
-+ struct brcmf_pub *drvr = ifp->drvr;
-+ struct brcmf_bus *bus = drvr->bus_if;
- struct brcmf_dload_data_le *chunk_buf;
- const struct firmware *clm = NULL;
- u8 clm_name[BRCMF_FW_NAME_LEN];
-@@ -145,7 +147,7 @@ static int brcmf_c_process_clm_blob(stru
- memset(clm_name, 0, sizeof(clm_name));
- err = brcmf_bus_get_fwname(bus, ".clm_blob", clm_name);
- if (err) {
-- brcmf_err("get CLM blob file name failed (%d)\n", err);
-+ bphy_err(drvr, "get CLM blob file name failed (%d)\n", err);
- return err;
- }
-
-@@ -182,12 +184,12 @@ static int brcmf_c_process_clm_blob(stru
- } while ((datalen > 0) && (err == 0));
-
- if (err) {
-- brcmf_err("clmload (%zu byte file) failed (%d); ",
-- clm->size, err);
-+ bphy_err(drvr, "clmload (%zu byte file) failed (%d)\n",
-+ clm->size, err);
- /* Retrieve clmload_status and print */
- err = brcmf_fil_iovar_int_get(ifp, "clmload_status", &status);
- if (err)
-- brcmf_err("get clmload_status failed (%d)\n", err);
-+ bphy_err(drvr, "get clmload_status failed (%d)\n", err);
- else
- brcmf_dbg(INFO, "clmload_status=%d\n", status);
- err = -EIO;
-@@ -201,6 +203,7 @@ done:
-
- int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
- {
-+ struct brcmf_pub *drvr = ifp->drvr;
- s8 eventmask[BRCMF_EVENTING_MASK_LEN];
- u8 buf[BRCMF_DCMD_SMLEN];
- struct brcmf_bus *bus;
-@@ -214,7 +217,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_i
- err = brcmf_fil_iovar_data_get(ifp, "cur_etheraddr", ifp->mac_addr,
- sizeof(ifp->mac_addr));
- if (err < 0) {
-- brcmf_err("Retrieving cur_etheraddr failed, %d\n", err);
-+ bphy_err(drvr, "Retrieving cur_etheraddr failed, %d\n", err);
- goto done;
- }
- memcpy(ifp->drvr->wiphy->perm_addr, ifp->drvr->mac, ETH_ALEN);
-@@ -226,7 +229,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_i
- err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_REVINFO,
- &revinfo, sizeof(revinfo));
- if (err < 0) {
-- brcmf_err("retrieving revision info failed, %d\n", err);
-+ bphy_err(drvr, "retrieving revision info failed, %d\n", err);
- strlcpy(ri->chipname, "UNKNOWN", sizeof(ri->chipname));
- } else {
- ri->vendorid = le32_to_cpu(revinfo.vendorid);
-@@ -260,7 +263,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_i
- /* Do any CLM downloading */
- err = brcmf_c_process_clm_blob(ifp);
- if (err < 0) {
-- brcmf_err("download CLM blob file failed, %d\n", err);
-+ bphy_err(drvr, "download CLM blob file failed, %d\n", err);
- goto done;
- }
-
-@@ -269,8 +272,8 @@ int brcmf_c_preinit_dcmds(struct brcmf_i
- strcpy(buf, "ver");
- err = brcmf_fil_iovar_data_get(ifp, "ver", buf, sizeof(buf));
- if (err < 0) {
-- brcmf_err("Retrieving version information failed, %d\n",
-- err);
-+ bphy_err(drvr, "Retrieving version information failed, %d\n",
-+ err);
- goto done;
- }
- ptr = (char *)buf;
-@@ -304,7 +307,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_i
- /* set mpc */
- err = brcmf_fil_iovar_int_set(ifp, "mpc", 1);
- if (err) {
-- brcmf_err("failed setting mpc\n");
-+ bphy_err(drvr, "failed setting mpc\n");
- goto done;
- }
-
-@@ -314,14 +317,14 @@ int brcmf_c_preinit_dcmds(struct brcmf_i
- err = brcmf_fil_iovar_data_get(ifp, "event_msgs", eventmask,
- BRCMF_EVENTING_MASK_LEN);
- if (err) {
-- brcmf_err("Get event_msgs error (%d)\n", err);
-+ bphy_err(drvr, "Get event_msgs error (%d)\n", err);
- goto done;
- }
- setbit(eventmask, BRCMF_E_IF);
- err = brcmf_fil_iovar_data_set(ifp, "event_msgs", eventmask,
- BRCMF_EVENTING_MASK_LEN);
- if (err) {
-- brcmf_err("Set event_msgs error (%d)\n", err);
-+ bphy_err(drvr, "Set event_msgs error (%d)\n", err);
- goto done;
- }
-
-@@ -329,8 +332,8 @@ int brcmf_c_preinit_dcmds(struct brcmf_i
- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_CHANNEL_TIME,
- BRCMF_DEFAULT_SCAN_CHANNEL_TIME);
- if (err) {
-- brcmf_err("BRCMF_C_SET_SCAN_CHANNEL_TIME error (%d)\n",
-- err);
-+ bphy_err(drvr, "BRCMF_C_SET_SCAN_CHANNEL_TIME error (%d)\n",
-+ err);
- goto done;
- }
-
-@@ -338,8 +341,8 @@ int brcmf_c_preinit_dcmds(struct brcmf_i
- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_UNASSOC_TIME,
- BRCMF_DEFAULT_SCAN_UNASSOC_TIME);
- if (err) {
-- brcmf_err("BRCMF_C_SET_SCAN_UNASSOC_TIME error (%d)\n",
-- err);
-+ bphy_err(drvr, "BRCMF_C_SET_SCAN_UNASSOC_TIME error (%d)\n",
-+ err);
- goto done;
- }
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-@@ -90,7 +90,7 @@ struct brcmf_if *brcmf_get_ifp(struct br
- s32 bsscfgidx;
-
- if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
-- brcmf_err("ifidx %d out of range\n", ifidx);
-+ bphy_err(drvr, "ifidx %d out of range\n", ifidx);
- return NULL;
- }
-
-@@ -141,7 +141,9 @@ void brcmf_configure_arp_nd_offload(stru
-
- static void _brcmf_set_multicast_list(struct work_struct *work)
- {
-- struct brcmf_if *ifp;
-+ struct brcmf_if *ifp = container_of(work, struct brcmf_if,
-+ multicast_work);
-+ struct brcmf_pub *drvr = ifp->drvr;
- struct net_device *ndev;
- struct netdev_hw_addr *ha;
- u32 cmd_value, cnt;
-@@ -150,8 +152,6 @@ static void _brcmf_set_multicast_list(st
- u32 buflen;
- s32 err;
-
-- ifp = container_of(work, struct brcmf_if, multicast_work);
--
- brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx);
-
- ndev = ifp->ndev;
-@@ -181,7 +181,7 @@ static void _brcmf_set_multicast_list(st
-
- err = brcmf_fil_iovar_data_set(ifp, "mcast_list", buf, buflen);
- if (err < 0) {
-- brcmf_err("Setting mcast_list failed, %d\n", err);
-+ bphy_err(drvr, "Setting mcast_list failed, %d\n", err);
- cmd_value = cnt ? true : cmd_value;
- }
-
-@@ -194,25 +194,25 @@ static void _brcmf_set_multicast_list(st
- */
- err = brcmf_fil_iovar_int_set(ifp, "allmulti", cmd_value);
- if (err < 0)
-- brcmf_err("Setting allmulti failed, %d\n", err);
-+ bphy_err(drvr, "Setting allmulti failed, %d\n", err);
-
- /*Finally, pick up the PROMISC flag */
- cmd_value = (ndev->flags & IFF_PROMISC) ? true : false;
- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PROMISC, cmd_value);
- if (err < 0)
-- brcmf_err("Setting BRCMF_C_SET_PROMISC failed, %d\n",
-- err);
-+ bphy_err(drvr, "Setting BRCMF_C_SET_PROMISC failed, %d\n",
-+ err);
- brcmf_configure_arp_nd_offload(ifp, !cmd_value);
- }
-
- #if IS_ENABLED(CONFIG_IPV6)
- static void _brcmf_update_ndtable(struct work_struct *work)
- {
-- struct brcmf_if *ifp;
-+ struct brcmf_if *ifp = container_of(work, struct brcmf_if,
-+ ndoffload_work);
-+ struct brcmf_pub *drvr = ifp->drvr;
- int i, ret;
-
-- ifp = container_of(work, struct brcmf_if, ndoffload_work);
--
- /* clear the table in firmware */
- ret = brcmf_fil_iovar_data_set(ifp, "nd_hostip_clear", NULL, 0);
- if (ret) {
-@@ -225,7 +225,7 @@ static void _brcmf_update_ndtable(struct
- &ifp->ipv6_addr_tbl[i],
- sizeof(struct in6_addr));
- if (ret)
-- brcmf_err("add nd ip err %d\n", ret);
-+ bphy_err(drvr, "add nd ip err %d\n", ret);
- }
- }
- #else
-@@ -238,6 +238,7 @@ static int brcmf_netdev_set_mac_address(
- {
- struct brcmf_if *ifp = netdev_priv(ndev);
- struct sockaddr *sa = (struct sockaddr *)addr;
-+ struct brcmf_pub *drvr = ifp->drvr;
- int err;
-
- brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx);
-@@ -245,7 +246,7 @@ static int brcmf_netdev_set_mac_address(
- err = brcmf_fil_iovar_data_set(ifp, "cur_etheraddr", sa->sa_data,
- ETH_ALEN);
- if (err < 0) {
-- brcmf_err("Setting cur_etheraddr failed, %d\n", err);
-+ bphy_err(drvr, "Setting cur_etheraddr failed, %d\n", err);
- } else {
- brcmf_dbg(TRACE, "updated to %pM\n", sa->sa_data);
- memcpy(ifp->mac_addr, sa->sa_data, ETH_ALEN);
-@@ -305,7 +306,7 @@ static netdev_tx_t brcmf_netdev_start_xm
-
- /* Can the device send data? */
- if (drvr->bus_if->state != BRCMF_BUS_UP) {
-- brcmf_err("xmit rejected state=%d\n", drvr->bus_if->state);
-+ bphy_err(drvr, "xmit rejected state=%d\n", drvr->bus_if->state);
- netif_stop_queue(ndev);
- dev_kfree_skb(skb);
- ret = -ENODEV;
-@@ -339,8 +340,8 @@ static netdev_tx_t brcmf_netdev_start_xm
- ret = pskb_expand_head(skb, ALIGN(head_delta, NET_SKB_PAD), 0,
- GFP_ATOMIC);
- if (ret < 0) {
-- brcmf_err("%s: failed to expand headroom\n",
-- brcmf_ifname(ifp));
-+ bphy_err(drvr, "%s: failed to expand headroom\n",
-+ brcmf_ifname(ifp));
- atomic_inc(&drvr->bus_if->stats.pktcow_failed);
- goto done;
- }
-@@ -607,7 +608,7 @@ static int brcmf_netdev_open(struct net_
-
- /* If bus is not ready, can't continue */
- if (bus_if->state != BRCMF_BUS_UP) {
-- brcmf_err("failed bus is not ready\n");
-+ bphy_err(drvr, "failed bus is not ready\n");
- return -EAGAIN;
- }
-
-@@ -621,7 +622,7 @@ static int brcmf_netdev_open(struct net_
- ndev->features &= ~NETIF_F_IP_CSUM;
-
- if (brcmf_cfg80211_up(ndev)) {
-- brcmf_err("failed to bring up cfg80211\n");
-+ bphy_err(drvr, "failed to bring up cfg80211\n");
- return -EIO;
- }
-
-@@ -683,7 +684,7 @@ int brcmf_net_attach(struct brcmf_if *if
- else
- err = register_netdev(ndev);
- if (err != 0) {
-- brcmf_err("couldn't register the net device\n");
-+ bphy_err(drvr, "couldn't register the net device\n");
- goto fail;
- }
-
-@@ -760,6 +761,7 @@ static const struct net_device_ops brcmf
-
- static int brcmf_net_p2p_attach(struct brcmf_if *ifp)
- {
-+ struct brcmf_pub *drvr = ifp->drvr;
- struct net_device *ndev;
-
- brcmf_dbg(TRACE, "Enter, bsscfgidx=%d mac=%pM\n", ifp->bsscfgidx,
-@@ -772,7 +774,7 @@ static int brcmf_net_p2p_attach(struct b
- memcpy(ndev->dev_addr, ifp->mac_addr, ETH_ALEN);
-
- if (register_netdev(ndev) != 0) {
-- brcmf_err("couldn't register the p2p net device\n");
-+ bphy_err(drvr, "couldn't register the p2p net device\n");
- goto fail;
- }
-
-@@ -801,8 +803,8 @@ struct brcmf_if *brcmf_add_if(struct brc
- */
- if (ifp) {
- if (ifidx) {
-- brcmf_err("ERROR: netdev:%s already exists\n",
-- ifp->ndev->name);
-+ bphy_err(drvr, "ERROR: netdev:%s already exists\n",
-+ ifp->ndev->name);
- netif_stop_queue(ifp->ndev);
- brcmf_net_detach(ifp->ndev, false);
- drvr->iflist[bsscfgidx] = NULL;
-@@ -864,7 +866,7 @@ static void brcmf_del_if(struct brcmf_pu
- ifp = drvr->iflist[bsscfgidx];
- drvr->iflist[bsscfgidx] = NULL;
- if (!ifp) {
-- brcmf_err("Null interface, bsscfgidx=%d\n", bsscfgidx);
-+ bphy_err(drvr, "Null interface, bsscfgidx=%d\n", bsscfgidx);
- return;
- }
- brcmf_dbg(TRACE, "Enter, bsscfgidx=%d, ifidx=%d\n", bsscfgidx,
-@@ -914,16 +916,17 @@ static int brcmf_psm_watchdog_notify(str
- const struct brcmf_event_msg *evtmsg,
- void *data)
- {
-+ struct brcmf_pub *drvr = ifp->drvr;
- int err;
-
- brcmf_dbg(TRACE, "enter: bsscfgidx=%d\n", ifp->bsscfgidx);
-
-- brcmf_err("PSM's watchdog has fired!\n");
-+ bphy_err(drvr, "PSM's watchdog has fired!\n");
-
- err = brcmf_debug_create_memdump(ifp->drvr->bus_if, data,
- evtmsg->datalen);
- if (err)
-- brcmf_err("Failed to get memory dump, %d\n", err);
-+ bphy_err(drvr, "Failed to get memory dump, %d\n", err);
-
- return err;
- }
-@@ -967,7 +970,7 @@ static int brcmf_inetaddr_changed(struct
- ret = brcmf_fil_iovar_data_get(ifp, "arp_hostip", addr_table,
- sizeof(addr_table));
- if (ret) {
-- brcmf_err("fail to get arp ip table err:%d\n", ret);
-+ bphy_err(drvr, "fail to get arp ip table err:%d\n", ret);
- return NOTIFY_OK;
- }
-
-@@ -984,7 +987,7 @@ static int brcmf_inetaddr_changed(struct
- ret = brcmf_fil_iovar_data_set(ifp, "arp_hostip",
- &ifa->ifa_address, sizeof(ifa->ifa_address));
- if (ret)
-- brcmf_err("add arp ip err %d\n", ret);
-+ bphy_err(drvr, "add arp ip err %d\n", ret);
- }
- break;
- case NETDEV_DOWN:
-@@ -996,8 +999,8 @@ static int brcmf_inetaddr_changed(struct
- ret = brcmf_fil_iovar_data_set(ifp, "arp_hostip_clear",
- NULL, 0);
- if (ret) {
-- brcmf_err("fail to clear arp ip table err:%d\n",
-- ret);
-+ bphy_err(drvr, "fail to clear arp ip table err:%d\n",
-+ ret);
- return NOTIFY_OK;
- }
- for (i = 0; i < ARPOL_MAX_ENTRIES; i++) {
-@@ -1007,8 +1010,8 @@ static int brcmf_inetaddr_changed(struct
- &addr_table[i],
- sizeof(addr_table[i]));
- if (ret)
-- brcmf_err("add arp ip err %d\n",
-- ret);
-+ bphy_err(drvr, "add arp ip err %d\n",
-+ ret);
- }
- }
- break;
-@@ -1182,7 +1185,7 @@ static int brcmf_bus_started(struct brcm
- return 0;
-
- fail:
-- brcmf_err("failed: %d\n", ret);
-+ bphy_err(drvr, "failed: %d\n", ret);
- if (drvr->config) {
- brcmf_cfg80211_detach(drvr->config);
- drvr->config = NULL;
-@@ -1234,7 +1237,7 @@ int brcmf_attach(struct device *dev, str
- /* Attach and link in the protocol */
- ret = brcmf_proto_attach(drvr);
- if (ret != 0) {
-- brcmf_err("brcmf_prot_attach failed\n");
-+ bphy_err(drvr, "brcmf_prot_attach failed\n");
- goto fail;
- }
-
-@@ -1247,7 +1250,7 @@ int brcmf_attach(struct device *dev, str
-
- ret = brcmf_bus_started(drvr, ops);
- if (ret != 0) {
-- brcmf_err("dongle is not responding: err=%d\n", ret);
-+ bphy_err(drvr, "dongle is not responding: err=%d\n", ret);
- goto fail;
- }
-
-@@ -1347,6 +1350,7 @@ static int brcmf_get_pend_8021x_cnt(stru
-
- int brcmf_netdev_wait_pend8021x(struct brcmf_if *ifp)
- {
-+ struct brcmf_pub *drvr = ifp->drvr;
- int err;
-
- err = wait_event_timeout(ifp->pend_8021x_wait,
-@@ -1354,7 +1358,7 @@ int brcmf_netdev_wait_pend8021x(struct b
- MAX_WAIT_FOR_8021X_TX);
-
- if (!err)
-- brcmf_err("Timed out waiting for no pending 802.1x packets\n");
-+ bphy_err(drvr, "Timed out waiting for no pending 802.1x packets\n");
-
- return !err;
- }
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
-@@ -185,13 +185,14 @@ static void brcmf_feat_iovar_data_set(st
- #define MAX_CAPS_BUFFER_SIZE 768
- static void brcmf_feat_firmware_capabilities(struct brcmf_if *ifp)
- {
-+ struct brcmf_pub *drvr = ifp->drvr;
- char caps[MAX_CAPS_BUFFER_SIZE];
- enum brcmf_feat_id id;
- int i, err;
-
- err = brcmf_fil_iovar_data_get(ifp, "cap", caps, sizeof(caps));
- if (err) {
-- brcmf_err("could not get firmware cap (%d)\n", err);
-+ bphy_err(drvr, "could not get firmware cap (%d)\n", err);
- return;
- }
-
-@@ -216,14 +217,15 @@ static void brcmf_feat_firmware_capabili
- static int brcmf_feat_fwcap_debugfs_read(struct seq_file *seq, void *data)
- {
- struct brcmf_bus *bus_if = dev_get_drvdata(seq->private);
-- struct brcmf_if *ifp = brcmf_get_ifp(bus_if->drvr, 0);
-+ struct brcmf_pub *drvr = bus_if->drvr;
-+ struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
- char caps[MAX_CAPS_BUFFER_SIZE + 1] = { };
- char *tmp;
- int err;
-
- err = brcmf_fil_iovar_data_get(ifp, "cap", caps, sizeof(caps));
- if (err) {
-- brcmf_err("could not get firmware cap (%d)\n", err);
-+ bphy_err(drvr, "could not get firmware cap (%d)\n", err);
- return err;
- }
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
-@@ -102,7 +102,8 @@ static void brcmf_fweh_queue_event(struc
- schedule_work(&fweh->event_work);
- }
-
--static int brcmf_fweh_call_event_handler(struct brcmf_if *ifp,
-+static int brcmf_fweh_call_event_handler(struct brcmf_pub *drvr,
-+ struct brcmf_if *ifp,
- enum brcmf_fweh_event_code code,
- struct brcmf_event_msg *emsg,
- void *data)
-@@ -117,9 +118,9 @@ static int brcmf_fweh_call_event_handler
- if (fweh->evt_handler[code])
- err = fweh->evt_handler[code](ifp, emsg, data);
- else
-- brcmf_err("unhandled event %d ignored\n", code);
-+ bphy_err(drvr, "unhandled event %d ignored\n", code);
- } else {
-- brcmf_err("no interface object\n");
-+ bphy_err(drvr, "no interface object\n");
- }
- return err;
- }
-@@ -158,7 +159,7 @@ static void brcmf_fweh_handle_if_event(s
- return;
- }
- if (ifevent->ifidx >= BRCMF_MAX_IFS) {
-- brcmf_err("invalid interface index: %u\n", ifevent->ifidx);
-+ bphy_err(drvr, "invalid interface index: %u\n", ifevent->ifidx);
- return;
- }
-
-@@ -181,7 +182,8 @@ static void brcmf_fweh_handle_if_event(s
- if (ifp && ifevent->action == BRCMF_E_IF_CHANGE)
- brcmf_proto_reset_if(drvr, ifp);
-
-- err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data);
-+ err = brcmf_fweh_call_event_handler(drvr, ifp, emsg->event_code, emsg,
-+ data);
-
- if (ifp && ifevent->action == BRCMF_E_IF_DEL) {
- bool armed = brcmf_cfg80211_vif_event_armed(drvr->config);
-@@ -268,11 +270,11 @@ static void brcmf_fweh_event_worker(stru
- ifp = drvr->iflist[0];
- else
- ifp = drvr->iflist[emsg.bsscfgidx];
-- err = brcmf_fweh_call_event_handler(ifp, event->code, &emsg,
-- event->data);
-+ err = brcmf_fweh_call_event_handler(drvr, ifp, event->code,
-+ &emsg, event->data);
- if (err) {
-- brcmf_err("event handler failed (%d)\n",
-- event->code);
-+ bphy_err(drvr, "event handler failed (%d)\n",
-+ event->code);
- err = 0;
- }
- event_free:
-@@ -339,7 +341,7 @@ int brcmf_fweh_register(struct brcmf_pub
- brcmf_fweh_handler_t handler)
- {
- if (drvr->fweh.evt_handler[code]) {
-- brcmf_err("event code %d already registered\n", code);
-+ bphy_err(drvr, "event code %d already registered\n", code);
- return -ENOSPC;
- }
- drvr->fweh.evt_handler[code] = handler;
-@@ -369,6 +371,7 @@ void brcmf_fweh_unregister(struct brcmf_
- */
- int brcmf_fweh_activate_events(struct brcmf_if *ifp)
- {
-+ struct brcmf_pub *drvr = ifp->drvr;
- int i, err;
- s8 eventmask[BRCMF_EVENTING_MASK_LEN];
-
-@@ -388,7 +391,7 @@ int brcmf_fweh_activate_events(struct br
- err = brcmf_fil_iovar_data_set(ifp, "event_msgs",
- eventmask, BRCMF_EVENTING_MASK_LEN);
- if (err)
-- brcmf_err("Set event_msgs error (%d)\n", err);
-+ bphy_err(drvr, "Set event_msgs error (%d)\n", err);
-
- return err;
- }
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c
-@@ -110,7 +110,7 @@ brcmf_fil_cmd_data(struct brcmf_if *ifp,
- s32 err, fwerr;
-
- if (drvr->bus_if->state != BRCMF_BUS_UP) {
-- brcmf_err("bus is down. we have nothing to do.\n");
-+ bphy_err(drvr, "bus is down. we have nothing to do.\n");
- return -EIO;
- }
-
-@@ -242,7 +242,7 @@ brcmf_fil_iovar_data_set(struct brcmf_if
- buflen, true);
- } else {
- err = -EPERM;
-- brcmf_err("Creating iovar failed\n");
-+ bphy_err(drvr, "Creating iovar failed\n");
- }
-
- mutex_unlock(&drvr->proto_block);
-@@ -268,7 +268,7 @@ brcmf_fil_iovar_data_get(struct brcmf_if
- memcpy(data, drvr->proto_buf, len);
- } else {
- err = -EPERM;
-- brcmf_err("Creating iovar failed\n");
-+ bphy_err(drvr, "Creating iovar failed\n");
- }
-
- brcmf_dbg(FIL, "ifidx=%d, name=%s, len=%d\n", ifp->ifidx, name, len);
-@@ -366,7 +366,7 @@ brcmf_fil_bsscfg_data_set(struct brcmf_i
- buflen, true);
- } else {
- err = -EPERM;
-- brcmf_err("Creating bsscfg failed\n");
-+ bphy_err(drvr, "Creating bsscfg failed\n");
- }
-
- mutex_unlock(&drvr->proto_block);
-@@ -392,7 +392,7 @@ brcmf_fil_bsscfg_data_get(struct brcmf_i
- memcpy(data, drvr->proto_buf, len);
- } else {
- err = -EPERM;
-- brcmf_err("Creating bsscfg failed\n");
-+ bphy_err(drvr, "Creating bsscfg failed\n");
- }
- brcmf_dbg(FIL, "ifidx=%d, bsscfgidx=%d, name=%s, len=%d\n", ifp->ifidx,
- ifp->bsscfgidx, name, len);
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
-@@ -1255,6 +1255,7 @@ static int brcmf_fws_enq(struct brcmf_fw
- enum brcmf_fws_skb_state state, int fifo,
- struct sk_buff *p)
- {
-+ struct brcmf_pub *drvr = fws->drvr;
- int prec = 2 * fifo;
- u32 *qfull_stat = &fws->stats.delayq_full_error;
- struct brcmf_fws_mac_descriptor *entry;
-@@ -1267,7 +1268,7 @@ static int brcmf_fws_enq(struct brcmf_fw
-
- entry = brcmf_skbcb(p)->mac;
- if (entry == NULL) {
-- brcmf_err("no mac descriptor found for skb %p\n", p);
-+ bphy_err(drvr, "no mac descriptor found for skb %p\n", p);
- return -ENOENT;
- }
-
-@@ -1457,6 +1458,7 @@ static int
- brcmf_fws_txs_process(struct brcmf_fws_info *fws, u8 flags, u32 hslot,
- u32 genbit, u16 seq, u8 compcnt)
- {
-+ struct brcmf_pub *drvr = fws->drvr;
- u32 fifo;
- u8 cnt = 0;
- int ret;
-@@ -1481,14 +1483,14 @@ brcmf_fws_txs_process(struct brcmf_fws_i
- else if (flags == BRCMF_FWS_TXSTATUS_HOST_TOSSED)
- fws->stats.txs_host_tossed += compcnt;
- else
-- brcmf_err("unexpected txstatus\n");
-+ bphy_err(drvr, "unexpected txstatus\n");
-
- while (cnt < compcnt) {
- ret = brcmf_fws_hanger_poppkt(&fws->hanger, hslot, &skb,
- remove_from_hanger);
- if (ret != 0) {
-- brcmf_err("no packet in hanger slot: hslot=%d\n",
-- hslot);
-+ bphy_err(drvr, "no packet in hanger slot: hslot=%d\n",
-+ hslot);
- goto cont;
- }
-
-@@ -1612,12 +1614,13 @@ static int brcmf_fws_notify_credit_map(s
- const struct brcmf_event_msg *e,
- void *data)
- {
-- struct brcmf_fws_info *fws = drvr_to_fws(ifp->drvr);
-+ struct brcmf_pub *drvr = ifp->drvr;
-+ struct brcmf_fws_info *fws = drvr_to_fws(drvr);
- int i;
- u8 *credits = data;
-
- if (e->datalen < BRCMF_FWS_FIFO_COUNT) {
-- brcmf_err("event payload too small (%d)\n", e->datalen);
-+ bphy_err(drvr, "event payload too small (%d)\n", e->datalen);
- return -EINVAL;
- }
-
-@@ -1681,6 +1684,7 @@ static void brcmf_rxreorder_get_skb_list
-
- void brcmf_fws_rxreorder(struct brcmf_if *ifp, struct sk_buff *pkt)
- {
-+ struct brcmf_pub *drvr = ifp->drvr;
- u8 *reorder_data;
- u8 flow_id, max_idx, cur_idx, exp_idx, end_idx;
- struct brcmf_ampdu_rx_reorder *rfi;
-@@ -1695,7 +1699,7 @@ void brcmf_fws_rxreorder(struct brcmf_if
-
- /* validate flags and flow id */
- if (flags == 0xFF) {
-- brcmf_err("invalid flags...so ignore this packet\n");
-+ bphy_err(drvr, "invalid flags...so ignore this packet\n");
- brcmf_netif_rx(ifp, pkt);
- return;
- }
-@@ -1732,7 +1736,7 @@ void brcmf_fws_rxreorder(struct brcmf_if
- flow_id, max_idx);
- rfi = kzalloc(buf_size, GFP_ATOMIC);
- if (rfi == NULL) {
-- brcmf_err("failed to alloc buffer\n");
-+ bphy_err(drvr, "failed to alloc buffer\n");
- brcmf_netif_rx(ifp, pkt);
- return;
- }
-@@ -1996,6 +2000,7 @@ static u8 brcmf_fws_precommit_skb(struct
- static void brcmf_fws_rollback_toq(struct brcmf_fws_info *fws,
- struct sk_buff *skb, int fifo)
- {
-+ struct brcmf_pub *drvr = fws->drvr;
- struct brcmf_fws_mac_descriptor *entry;
- struct sk_buff *pktout;
- int qidx, hslot;
-@@ -2009,11 +2014,11 @@ static void brcmf_fws_rollback_toq(struc
-
- pktout = brcmu_pktq_penq_head(&entry->psq, qidx, skb);
- if (pktout == NULL) {
-- brcmf_err("%s queue %d full\n", entry->name, qidx);
-+ bphy_err(drvr, "%s queue %d full\n", entry->name, qidx);
- rc = -ENOSPC;
- }
- } else {
-- brcmf_err("%s entry removed\n", entry->name);
-+ bphy_err(drvr, "%s entry removed\n", entry->name);
- rc = -ENOENT;
- }
-
-@@ -2118,7 +2123,8 @@ static int brcmf_fws_assign_htod(struct
-
- int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb)
- {
-- struct brcmf_fws_info *fws = drvr_to_fws(ifp->drvr);
-+ struct brcmf_pub *drvr = ifp->drvr;
-+ struct brcmf_fws_info *fws = drvr_to_fws(drvr);
- struct brcmf_skbuff_cb *skcb = brcmf_skbcb(skb);
- struct ethhdr *eh = (struct ethhdr *)(skb->data);
- int fifo = BRCMF_FWS_FIFO_BCMC;
-@@ -2146,7 +2152,7 @@ int brcmf_fws_process_skb(struct brcmf_i
- brcmf_fws_enq(fws, BRCMF_FWS_SKBSTATE_DELAYED, fifo, skb);
- brcmf_fws_schedule_deq(fws);
- } else {
-- brcmf_err("drop skb: no hanger slot\n");
-+ bphy_err(drvr, "drop skb: no hanger slot\n");
- brcmf_txfinalize(ifp, skb, false);
- rc = -ENOMEM;
- }
-@@ -2365,7 +2371,7 @@ struct brcmf_fws_info *brcmf_fws_attach(
-
- fws->fws_wq = create_singlethread_workqueue("brcmf_fws_wq");
- if (fws->fws_wq == NULL) {
-- brcmf_err("workqueue creation failed\n");
-+ bphy_err(drvr, "workqueue creation failed\n");
- rc = -EBADF;
- goto fail;
- }
-@@ -2381,13 +2387,13 @@ struct brcmf_fws_info *brcmf_fws_attach(
- rc = brcmf_fweh_register(drvr, BRCMF_E_FIFO_CREDIT_MAP,
- brcmf_fws_notify_credit_map);
- if (rc < 0) {
-- brcmf_err("register credit map handler failed\n");
-+ bphy_err(drvr, "register credit map handler failed\n");
- goto fail;
- }
- rc = brcmf_fweh_register(drvr, BRCMF_E_BCMC_CREDIT_SUPPORT,
- brcmf_fws_notify_bcmc_credit_support);
- if (rc < 0) {
-- brcmf_err("register bcmc credit handler failed\n");
-+ bphy_err(drvr, "register bcmc credit handler failed\n");
- brcmf_fweh_unregister(drvr, BRCMF_E_FIFO_CREDIT_MAP);
- goto fail;
- }
-@@ -2399,7 +2405,7 @@ struct brcmf_fws_info *brcmf_fws_attach(
- fws->fw_signals = true;
- ifp = brcmf_get_ifp(drvr, 0);
- if (brcmf_fil_iovar_int_set(ifp, "tlv", tlv)) {
-- brcmf_err("failed to set bdcv2 tlv signaling\n");
-+ bphy_err(drvr, "failed to set bdcv2 tlv signaling\n");
- fws->fcmode = BRCMF_FWS_FCMODE_NONE;
- fws->fw_signals = false;
- }
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
-@@ -439,7 +439,7 @@ static int brcmf_msgbuf_tx_ioctl(struct
- brcmf_commonring_lock(commonring);
- ret_ptr = brcmf_commonring_reserve_for_write(commonring);
- if (!ret_ptr) {
-- brcmf_err("Failed to reserve space in commonring\n");
-+ bphy_err(drvr, "Failed to reserve space in commonring\n");
- brcmf_commonring_unlock(commonring);
- return -ENOMEM;
- }
-@@ -503,7 +503,7 @@ static int brcmf_msgbuf_query_dcmd(struc
-
- timeout = brcmf_msgbuf_ioctl_resp_wait(msgbuf);
- if (!timeout) {
-- brcmf_err("Timeout on response for query command\n");
-+ bphy_err(drvr, "Timeout on response for query command\n");
- return -EIO;
- }
-
-@@ -580,6 +580,7 @@ static u32
- brcmf_msgbuf_flowring_create_worker(struct brcmf_msgbuf *msgbuf,
- struct brcmf_msgbuf_work_item *work)
- {
-+ struct brcmf_pub *drvr = msgbuf->drvr;
- struct msgbuf_tx_flowring_create_req *create;
- struct brcmf_commonring *commonring;
- void *ret_ptr;
-@@ -595,7 +596,7 @@ brcmf_msgbuf_flowring_create_worker(stru
- &msgbuf->flowring_dma_handle[flowid],
- GFP_KERNEL);
- if (!dma_buf) {
-- brcmf_err("dma_alloc_coherent failed\n");
-+ bphy_err(drvr, "dma_alloc_coherent failed\n");
- brcmf_flowring_delete(msgbuf->flow, flowid);
- return BRCMF_FLOWRING_INVALID_ID;
- }
-@@ -608,7 +609,7 @@ brcmf_msgbuf_flowring_create_worker(stru
- brcmf_commonring_lock(commonring);
- ret_ptr = brcmf_commonring_reserve_for_write(commonring);
- if (!ret_ptr) {
-- brcmf_err("Failed to reserve space in commonring\n");
-+ bphy_err(drvr, "Failed to reserve space in commonring\n");
- brcmf_commonring_unlock(commonring);
- brcmf_msgbuf_remove_flowring(msgbuf, flowid);
- return BRCMF_FLOWRING_INVALID_ID;
-@@ -635,7 +636,7 @@ brcmf_msgbuf_flowring_create_worker(stru
- err = brcmf_commonring_write_complete(commonring);
- brcmf_commonring_unlock(commonring);
- if (err) {
-- brcmf_err("Failed to write commonring\n");
-+ bphy_err(drvr, "Failed to write commonring\n");
- brcmf_msgbuf_remove_flowring(msgbuf, flowid);
- return BRCMF_FLOWRING_INVALID_ID;
- }
-@@ -694,6 +695,7 @@ static u32 brcmf_msgbuf_flowring_create(
- static void brcmf_msgbuf_txflow(struct brcmf_msgbuf *msgbuf, u16 flowid)
- {
- struct brcmf_flowring *flow = msgbuf->flow;
-+ struct brcmf_pub *drvr = msgbuf->drvr;
- struct brcmf_commonring *commonring;
- void *ret_ptr;
- u32 count;
-@@ -713,8 +715,8 @@ static void brcmf_msgbuf_txflow(struct b
- while (brcmf_flowring_qlen(flow, flowid)) {
- skb = brcmf_flowring_dequeue(flow, flowid);
- if (skb == NULL) {
-- brcmf_err("No SKB, but qlen %d\n",
-- brcmf_flowring_qlen(flow, flowid));
-+ bphy_err(drvr, "No SKB, but qlen %d\n",
-+ brcmf_flowring_qlen(flow, flowid));
- break;
- }
- skb_orphan(skb);
-@@ -722,7 +724,7 @@ static void brcmf_msgbuf_txflow(struct b
- msgbuf->tx_pktids, skb, ETH_HLEN,
- &physaddr, &pktid)) {
- brcmf_flowring_reinsert(flow, flowid, skb);
-- brcmf_err("No PKTID available !!\n");
-+ bphy_err(drvr, "No PKTID available !!\n");
- break;
- }
- ret_ptr = brcmf_commonring_reserve_for_write(commonring);
-@@ -893,6 +895,7 @@ brcmf_msgbuf_process_txstatus(struct brc
-
- static u32 brcmf_msgbuf_rxbuf_data_post(struct brcmf_msgbuf *msgbuf, u32 count)
- {
-+ struct brcmf_pub *drvr = msgbuf->drvr;
- struct brcmf_commonring *commonring;
- void *ret_ptr;
- struct sk_buff *skb;
-@@ -920,7 +923,7 @@ static u32 brcmf_msgbuf_rxbuf_data_post(
- skb = brcmu_pkt_buf_get_skb(BRCMF_MSGBUF_MAX_PKT_SIZE);
-
- if (skb == NULL) {
-- brcmf_err("Failed to alloc SKB\n");
-+ bphy_err(drvr, "Failed to alloc SKB\n");
- brcmf_commonring_write_cancel(commonring, alloced - i);
- break;
- }
-@@ -930,7 +933,7 @@ static u32 brcmf_msgbuf_rxbuf_data_post(
- msgbuf->rx_pktids, skb, 0,
- &physaddr, &pktid)) {
- dev_kfree_skb_any(skb);
-- brcmf_err("No PKTID available !!\n");
-+ bphy_err(drvr, "No PKTID available !!\n");
- brcmf_commonring_write_cancel(commonring, alloced - i);
- break;
- }
-@@ -1000,6 +1003,7 @@ static u32
- brcmf_msgbuf_rxbuf_ctrl_post(struct brcmf_msgbuf *msgbuf, bool event_buf,
- u32 count)
- {
-+ struct brcmf_pub *drvr = msgbuf->drvr;
- struct brcmf_commonring *commonring;
- void *ret_ptr;
- struct sk_buff *skb;
-@@ -1017,7 +1021,7 @@ brcmf_msgbuf_rxbuf_ctrl_post(struct brcm
- count,
- &alloced);
- if (!ret_ptr) {
-- brcmf_err("Failed to reserve space in commonring\n");
-+ bphy_err(drvr, "Failed to reserve space in commonring\n");
- brcmf_commonring_unlock(commonring);
- return 0;
- }
-@@ -1029,7 +1033,7 @@ brcmf_msgbuf_rxbuf_ctrl_post(struct brcm
- skb = brcmu_pkt_buf_get_skb(BRCMF_MSGBUF_MAX_PKT_SIZE);
-
- if (skb == NULL) {
-- brcmf_err("Failed to alloc SKB\n");
-+ bphy_err(drvr, "Failed to alloc SKB\n");
- brcmf_commonring_write_cancel(commonring, alloced - i);
- break;
- }
-@@ -1039,7 +1043,7 @@ brcmf_msgbuf_rxbuf_ctrl_post(struct brcm
- msgbuf->rx_pktids, skb, 0,
- &physaddr, &pktid)) {
- dev_kfree_skb_any(skb);
-- brcmf_err("No PKTID available !!\n");
-+ bphy_err(drvr, "No PKTID available !!\n");
- brcmf_commonring_write_cancel(commonring, alloced - i);
- break;
- }
-@@ -1091,6 +1095,7 @@ static void brcmf_msgbuf_rxbuf_event_pos
-
- static void brcmf_msgbuf_process_event(struct brcmf_msgbuf *msgbuf, void *buf)
- {
-+ struct brcmf_pub *drvr = msgbuf->drvr;
- struct msgbuf_rx_event *event;
- u32 idx;
- u16 buflen;
-@@ -1117,8 +1122,8 @@ static void brcmf_msgbuf_process_event(s
-
- ifp = brcmf_get_ifp(msgbuf->drvr, event->msg.ifidx);
- if (!ifp || !ifp->ndev) {
-- brcmf_err("Received pkt for invalid ifidx %d\n",
-- event->msg.ifidx);
-+ bphy_err(drvr, "Received pkt for invalid ifidx %d\n",
-+ event->msg.ifidx);
- goto exit;
- }
-
-@@ -1134,6 +1139,7 @@ exit:
- static void
- brcmf_msgbuf_process_rx_complete(struct brcmf_msgbuf *msgbuf, void *buf)
- {
-+ struct brcmf_pub *drvr = msgbuf->drvr;
- struct msgbuf_rx_complete *rx_complete;
- struct sk_buff *skb;
- u16 data_offset;
-@@ -1167,7 +1173,7 @@ brcmf_msgbuf_process_rx_complete(struct
- ifp = msgbuf->drvr->mon_if;
-
- if (!ifp) {
-- brcmf_err("Received unexpected monitor pkt\n");
-+ bphy_err(drvr, "Received unexpected monitor pkt\n");
- brcmu_pkt_buf_free_skb(skb);
- return;
- }
-@@ -1178,8 +1184,8 @@ brcmf_msgbuf_process_rx_complete(struct
-
- ifp = brcmf_get_ifp(msgbuf->drvr, rx_complete->msg.ifidx);
- if (!ifp || !ifp->ndev) {
-- brcmf_err("Received pkt for invalid ifidx %d\n",
-- rx_complete->msg.ifidx);
-+ bphy_err(drvr, "Received pkt for invalid ifidx %d\n",
-+ rx_complete->msg.ifidx);
- brcmu_pkt_buf_free_skb(skb);
- return;
- }
-@@ -1192,13 +1198,15 @@ static void brcmf_msgbuf_process_ring_st
- void *buf)
- {
- struct msgbuf_ring_status *ring_status = buf;
-+ struct brcmf_pub *drvr = msgbuf->drvr;
- int err;
-
- err = le16_to_cpu(ring_status->compl_hdr.status);
- if (err) {
- int ring = le16_to_cpu(ring_status->compl_hdr.flow_ring_id);
-
-- brcmf_err("Firmware reported ring %d error: %d\n", ring, err);
-+ bphy_err(drvr, "Firmware reported ring %d error: %d\n", ring,
-+ err);
- }
- }
-
-@@ -1206,6 +1214,7 @@ static void
- brcmf_msgbuf_process_flow_ring_create_response(struct brcmf_msgbuf *msgbuf,
- void *buf)
- {
-+ struct brcmf_pub *drvr = msgbuf->drvr;
- struct msgbuf_flowring_create_resp *flowring_create_resp;
- u16 status;
- u16 flowid;
-@@ -1217,7 +1226,7 @@ brcmf_msgbuf_process_flow_ring_create_re
- status = le16_to_cpu(flowring_create_resp->compl_hdr.status);
-
- if (status) {
-- brcmf_err("Flowring creation failed, code %d\n", status);
-+ bphy_err(drvr, "Flowring creation failed, code %d\n", status);
- brcmf_msgbuf_remove_flowring(msgbuf, flowid);
- return;
- }
-@@ -1234,6 +1243,7 @@ static void
- brcmf_msgbuf_process_flow_ring_delete_response(struct brcmf_msgbuf *msgbuf,
- void *buf)
- {
-+ struct brcmf_pub *drvr = msgbuf->drvr;
- struct msgbuf_flowring_delete_resp *flowring_delete_resp;
- u16 status;
- u16 flowid;
-@@ -1245,7 +1255,7 @@ brcmf_msgbuf_process_flow_ring_delete_re
- status = le16_to_cpu(flowring_delete_resp->compl_hdr.status);
-
- if (status) {
-- brcmf_err("Flowring deletion failed, code %d\n", status);
-+ bphy_err(drvr, "Flowring deletion failed, code %d\n", status);
- brcmf_flowring_delete(msgbuf->flow, flowid);
- return;
- }
-@@ -1258,6 +1268,7 @@ brcmf_msgbuf_process_flow_ring_delete_re
-
- static void brcmf_msgbuf_process_msgtype(struct brcmf_msgbuf *msgbuf, void *buf)
- {
-+ struct brcmf_pub *drvr = msgbuf->drvr;
- struct msgbuf_common_hdr *msg;
-
- msg = (struct msgbuf_common_hdr *)buf;
-@@ -1294,7 +1305,7 @@ static void brcmf_msgbuf_process_msgtype
- brcmf_msgbuf_process_rx_complete(msgbuf, buf);
- break;
- default:
-- brcmf_err("Unsupported msgtype %d\n", msg->msgtype);
-+ bphy_err(drvr, "Unsupported msgtype %d\n", msg->msgtype);
- break;
- }
- }
-@@ -1377,7 +1388,7 @@ void brcmf_msgbuf_delete_flowring(struct
- brcmf_commonring_lock(commonring);
- ret_ptr = brcmf_commonring_reserve_for_write(commonring);
- if (!ret_ptr) {
-- brcmf_err("FW unaware, flowring will be removed !!\n");
-+ bphy_err(drvr, "FW unaware, flowring will be removed !!\n");
- brcmf_commonring_unlock(commonring);
- brcmf_msgbuf_remove_flowring(msgbuf, flowid);
- return;
-@@ -1401,7 +1412,7 @@ void brcmf_msgbuf_delete_flowring(struct
- err = brcmf_commonring_write_complete(commonring);
- brcmf_commonring_unlock(commonring);
- if (err) {
-- brcmf_err("Failed to submit RING_DELETE, flowring will be removed\n");
-+ bphy_err(drvr, "Failed to submit RING_DELETE, flowring will be removed\n");
- brcmf_msgbuf_remove_flowring(msgbuf, flowid);
- }
- }
-@@ -1476,8 +1487,8 @@ int brcmf_proto_msgbuf_attach(struct brc
- if_msgbuf = drvr->bus_if->msgbuf;
-
- if (if_msgbuf->max_flowrings >= BRCMF_FLOWRING_HASHSIZE) {
-- brcmf_err("driver not configured for this many flowrings %d\n",
-- if_msgbuf->max_flowrings);
-+ bphy_err(drvr, "driver not configured for this many flowrings %d\n",
-+ if_msgbuf->max_flowrings);
- if_msgbuf->max_flowrings = BRCMF_FLOWRING_HASHSIZE - 1;
- }
-
-@@ -1487,7 +1498,7 @@ int brcmf_proto_msgbuf_attach(struct brc
-
- msgbuf->txflow_wq = create_singlethread_workqueue("msgbuf_txflow");
- if (msgbuf->txflow_wq == NULL) {
-- brcmf_err("workqueue creation failed\n");
-+ bphy_err(drvr, "workqueue creation failed\n");
- goto fail;
- }
- INIT_WORK(&msgbuf->txflow_work, brcmf_msgbuf_txflow_worker);
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
-@@ -434,6 +434,7 @@ static void brcmf_p2p_print_actframe(boo
- */
- static int brcmf_p2p_set_firmware(struct brcmf_if *ifp, u8 *p2p_mac)
- {
-+ struct brcmf_pub *drvr = ifp->drvr;
- s32 ret = 0;
-
- brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1);
-@@ -450,7 +451,7 @@ static int brcmf_p2p_set_firmware(struct
- ret = brcmf_fil_iovar_data_set(ifp, "p2p_da_override", p2p_mac,
- ETH_ALEN);
- if (ret)
-- brcmf_err("failed to update device address ret %d\n", ret);
-+ bphy_err(drvr, "failed to update device address ret %d\n", ret);
-
- return ret;
- }
-@@ -570,13 +571,14 @@ static s32 brcmf_p2p_deinit_discovery(st
- */
- static int brcmf_p2p_enable_discovery(struct brcmf_p2p_info *p2p)
- {
-+ struct brcmf_pub *drvr = p2p->cfg->pub;
- struct brcmf_cfg80211_vif *vif;
- s32 ret = 0;
-
- brcmf_dbg(TRACE, "enter\n");
- vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif;
- if (!vif) {
-- brcmf_err("P2P config device not available\n");
-+ bphy_err(drvr, "P2P config device not available\n");
- ret = -EPERM;
- goto exit;
- }
-@@ -590,13 +592,13 @@ static int brcmf_p2p_enable_discovery(st
- vif = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif;
- ret = brcmf_fil_iovar_int_set(vif->ifp, "p2p_disc", 1);
- if (ret < 0) {
-- brcmf_err("set p2p_disc error\n");
-+ bphy_err(drvr, "set p2p_disc error\n");
- goto exit;
- }
- vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif;
- ret = brcmf_p2p_set_discover_state(vif->ifp, WL_P2P_DISC_ST_SCAN, 0, 0);
- if (ret < 0) {
-- brcmf_err("unable to set WL_P2P_DISC_ST_SCAN\n");
-+ bphy_err(drvr, "unable to set WL_P2P_DISC_ST_SCAN\n");
- goto exit;
- }
-
-@@ -608,7 +610,7 @@ static int brcmf_p2p_enable_discovery(st
- */
- ret = brcmf_fil_bsscfg_int_set(vif->ifp, "wsec", AES_ENABLED);
- if (ret < 0) {
-- brcmf_err("wsec error %d\n", ret);
-+ bphy_err(drvr, "wsec error %d\n", ret);
- goto exit;
- }
-
-@@ -630,6 +632,7 @@ static s32 brcmf_p2p_escan(struct brcmf_
- u16 chanspecs[], s32 search_state,
- enum p2p_bss_type bss_type)
- {
-+ struct brcmf_pub *drvr = p2p->cfg->pub;
- s32 ret = 0;
- s32 memsize = offsetof(struct brcmf_p2p_scan_le,
- eparams.params_le.channel_list);
-@@ -648,7 +651,7 @@ static s32 brcmf_p2p_escan(struct brcmf_
-
- vif = p2p->bss_idx[bss_type].vif;
- if (vif == NULL) {
-- brcmf_err("no vif for bss type %d\n", bss_type);
-+ bphy_err(drvr, "no vif for bss type %d\n", bss_type);
- ret = -EINVAL;
- goto exit;
- }
-@@ -676,7 +679,7 @@ static s32 brcmf_p2p_escan(struct brcmf_
- BRCMF_P2P_WILDCARD_SSID_LEN);
- break;
- default:
-- brcmf_err(" invalid search state %d\n", search_state);
-+ bphy_err(drvr, " invalid search state %d\n", search_state);
- ret = -EINVAL;
- goto exit;
- }
-@@ -760,6 +763,7 @@ static s32 brcmf_p2p_run_escan(struct br
- struct cfg80211_scan_request *request)
- {
- struct brcmf_p2p_info *p2p = &cfg->p2p;
-+ struct brcmf_pub *drvr = cfg->pub;
- s32 err = 0;
- s32 search_state = WL_P2P_DISC_ST_SCAN;
- struct brcmf_cfg80211_vif *vif;
-@@ -822,7 +826,7 @@ static s32 brcmf_p2p_run_escan(struct br
- }
- exit:
- if (err)
-- brcmf_err("error (%d)\n", err);
-+ bphy_err(drvr, "error (%d)\n", err);
- return err;
- }
-
-@@ -917,19 +921,20 @@ int brcmf_p2p_scan_prep(struct wiphy *wi
- static s32
- brcmf_p2p_discover_listen(struct brcmf_p2p_info *p2p, u16 channel, u32 duration)
- {
-+ struct brcmf_pub *drvr = p2p->cfg->pub;
- struct brcmf_cfg80211_vif *vif;
- struct brcmu_chan ch;
- s32 err = 0;
-
- vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif;
- if (!vif) {
-- brcmf_err("Discovery is not set, so we have nothing to do\n");
-+ bphy_err(drvr, "Discovery is not set, so we have nothing to do\n");
- err = -EPERM;
- goto exit;
- }
-
- if (test_bit(BRCMF_P2P_STATUS_DISCOVER_LISTEN, &p2p->status)) {
-- brcmf_err("Previous LISTEN is not completed yet\n");
-+ bphy_err(drvr, "Previous LISTEN is not completed yet\n");
- /* WAR: prevent cookie mismatch in wpa_supplicant return OK */
- goto exit;
- }
-@@ -1046,6 +1051,7 @@ void brcmf_p2p_cancel_remain_on_channel(
- */
- static s32 brcmf_p2p_act_frm_search(struct brcmf_p2p_info *p2p, u16 channel)
- {
-+ struct brcmf_pub *drvr = p2p->cfg->pub;
- s32 err;
- u32 channel_cnt;
- u16 *default_chan_list;
-@@ -1061,7 +1067,7 @@ static s32 brcmf_p2p_act_frm_search(stru
- default_chan_list = kcalloc(channel_cnt, sizeof(*default_chan_list),
- GFP_KERNEL);
- if (default_chan_list == NULL) {
-- brcmf_err("channel list allocation failed\n");
-+ bphy_err(drvr, "channel list allocation failed\n");
- err = -ENOMEM;
- goto exit;
- }
-@@ -1103,6 +1109,7 @@ static void brcmf_p2p_afx_handler(struct
- struct brcmf_p2p_info *p2p = container_of(afx_hdl,
- struct brcmf_p2p_info,
- afx_hdl);
-+ struct brcmf_pub *drvr = p2p->cfg->pub;
- s32 err;
-
- if (!afx_hdl->is_active)
-@@ -1116,7 +1123,7 @@ static void brcmf_p2p_afx_handler(struct
- err = brcmf_p2p_act_frm_search(p2p, afx_hdl->peer_listen_chan);
-
- if (err) {
-- brcmf_err("ERROR occurred! value is (%d)\n", err);
-+ bphy_err(drvr, "ERROR occurred! value is (%d)\n", err);
- if (test_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL,
- &p2p->status))
- complete(&afx_hdl->act_frm_scan);
-@@ -1338,7 +1345,8 @@ int brcmf_p2p_notify_action_frame_rx(str
- const struct brcmf_event_msg *e,
- void *data)
- {
-- struct brcmf_cfg80211_info *cfg = ifp->drvr->config;
-+ struct brcmf_pub *drvr = ifp->drvr;
-+ struct brcmf_cfg80211_info *cfg = drvr->config;
- struct brcmf_p2p_info *p2p = &cfg->p2p;
- struct afx_hdl *afx_hdl = &p2p->afx_hdl;
- struct wireless_dev *wdev;
-@@ -1409,7 +1417,7 @@ int brcmf_p2p_notify_action_frame_rx(str
- mgmt_frame = kzalloc(offsetof(struct ieee80211_mgmt, u) +
- mgmt_frame_len, GFP_KERNEL);
- if (!mgmt_frame) {
-- brcmf_err("No memory available for action frame\n");
-+ bphy_err(drvr, "No memory available for action frame\n");
- return -ENOMEM;
- }
- memcpy(mgmt_frame->da, ifp->mac_addr, ETH_ALEN);
-@@ -1492,6 +1500,7 @@ int brcmf_p2p_notify_action_tx_complete(
- static s32 brcmf_p2p_tx_action_frame(struct brcmf_p2p_info *p2p,
- struct brcmf_fil_af_params_le *af_params)
- {
-+ struct brcmf_pub *drvr = p2p->cfg->pub;
- struct brcmf_cfg80211_vif *vif;
- s32 err = 0;
- s32 timeout = 0;
-@@ -1506,7 +1515,7 @@ static s32 brcmf_p2p_tx_action_frame(str
- err = brcmf_fil_bsscfg_data_set(vif->ifp, "actframe", af_params,
- sizeof(*af_params));
- if (err) {
-- brcmf_err(" sending action frame has failed\n");
-+ bphy_err(drvr, " sending action frame has failed\n");
- goto exit;
- }
-
-@@ -1556,6 +1565,7 @@ static s32 brcmf_p2p_pub_af_tx(struct br
- struct brcmf_config_af_params *config_af_params)
- {
- struct brcmf_p2p_info *p2p = &cfg->p2p;
-+ struct brcmf_pub *drvr = cfg->pub;
- struct brcmf_fil_action_frame_le *action_frame;
- struct brcmf_p2p_pub_act_frame *act_frm;
- s32 err = 0;
-@@ -1634,8 +1644,8 @@ static s32 brcmf_p2p_pub_af_tx(struct br
- config_af_params->extra_listen = false;
- break;
- default:
-- brcmf_err("Unknown p2p pub act frame subtype: %d\n",
-- act_frm->subtype);
-+ bphy_err(drvr, "Unknown p2p pub act frame subtype: %d\n",
-+ act_frm->subtype);
- err = -EINVAL;
- }
- return err;
-@@ -1657,6 +1667,7 @@ bool brcmf_p2p_send_action_frame(struct
- struct brcmf_fil_action_frame_le *action_frame;
- struct brcmf_config_af_params config_af_params;
- struct afx_hdl *afx_hdl = &p2p->afx_hdl;
-+ struct brcmf_pub *drvr = cfg->pub;
- u16 action_frame_len;
- bool ack = false;
- u8 category;
-@@ -1692,7 +1703,7 @@ bool brcmf_p2p_send_action_frame(struct
- if (brcmf_p2p_pub_af_tx(cfg, af_params, &config_af_params)) {
- /* Just send unknown subtype frame with */
- /* default parameters. */
-- brcmf_err("P2P Public action frame, unknown subtype.\n");
-+ bphy_err(drvr, "P2P Public action frame, unknown subtype.\n");
- }
- } else if (brcmf_p2p_is_gas_action(action_frame->data,
- action_frame_len)) {
-@@ -1714,7 +1725,7 @@ bool brcmf_p2p_send_action_frame(struct
- af_params->dwell_time =
- cpu_to_le32(P2P_AF_MIN_DWELL_TIME);
- } else {
-- brcmf_err("Unknown action type: %d\n", action);
-+ bphy_err(drvr, "Unknown action type: %d\n", action);
- goto exit;
- }
- } else if (brcmf_p2p_is_p2p_action(action_frame->data,
-@@ -1722,8 +1733,8 @@ bool brcmf_p2p_send_action_frame(struct
- /* do not configure anything. it will be */
- /* sent with a default configuration */
- } else {
-- brcmf_err("Unknown Frame: category 0x%x, action 0x%x\n",
-- category, action);
-+ bphy_err(drvr, "Unknown Frame: category 0x%x, action 0x%x\n",
-+ category, action);
- return false;
- }
-
-@@ -1761,7 +1772,7 @@ bool brcmf_p2p_send_action_frame(struct
-
- if (brcmf_p2p_af_searching_channel(p2p) ==
- P2P_INVALID_CHANNEL) {
-- brcmf_err("Couldn't find peer's channel.\n");
-+ bphy_err(drvr, "Couldn't find peer's channel.\n");
- goto exit;
- }
-
-@@ -1783,7 +1794,8 @@ bool brcmf_p2p_send_action_frame(struct
- tx_retry++;
- }
- if (ack == false) {
-- brcmf_err("Failed to send Action Frame(retry %d)\n", tx_retry);
-+ bphy_err(drvr, "Failed to send Action Frame(retry %d)\n",
-+ tx_retry);
- clear_bit(BRCMF_P2P_STATUS_GO_NEG_PHASE, &p2p->status);
- }
-
-@@ -1965,6 +1977,7 @@ int brcmf_p2p_ifchange(struct brcmf_cfg8
- enum brcmf_fil_p2p_if_types if_type)
- {
- struct brcmf_p2p_info *p2p = &cfg->p2p;
-+ struct brcmf_pub *drvr = cfg->pub;
- struct brcmf_cfg80211_vif *vif;
- struct brcmf_fil_p2p_if_le if_request;
- s32 err;
-@@ -1974,13 +1987,13 @@ int brcmf_p2p_ifchange(struct brcmf_cfg8
-
- vif = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif;
- if (!vif) {
-- brcmf_err("vif for P2PAPI_BSSCFG_PRIMARY does not exist\n");
-+ bphy_err(drvr, "vif for P2PAPI_BSSCFG_PRIMARY does not exist\n");
- return -EPERM;
- }
- brcmf_notify_escan_complete(cfg, vif->ifp, true, true);
- vif = p2p->bss_idx[P2PAPI_BSSCFG_CONNECTION].vif;
- if (!vif) {
-- brcmf_err("vif for P2PAPI_BSSCFG_CONNECTION does not exist\n");
-+ bphy_err(drvr, "vif for P2PAPI_BSSCFG_CONNECTION does not exist\n");
- return -EPERM;
- }
- brcmf_set_mpc(vif->ifp, 0);
-@@ -1998,7 +2011,7 @@ int brcmf_p2p_ifchange(struct brcmf_cfg8
- err = brcmf_fil_iovar_data_set(vif->ifp, "p2p_ifupd", &if_request,
- sizeof(if_request));
- if (err) {
-- brcmf_err("p2p_ifupd FAILED, err=%d\n", err);
-+ bphy_err(drvr, "p2p_ifupd FAILED, err=%d\n", err);
- brcmf_cfg80211_arm_vif_event(cfg, NULL);
- return err;
- }
-@@ -2006,7 +2019,7 @@ int brcmf_p2p_ifchange(struct brcmf_cfg8
- BRCMF_VIF_EVENT_TIMEOUT);
- brcmf_cfg80211_arm_vif_event(cfg, NULL);
- if (!err) {
-- brcmf_err("No BRCMF_E_IF_CHANGE event received\n");
-+ bphy_err(drvr, "No BRCMF_E_IF_CHANGE event received\n");
- return -EIO;
- }
-
-@@ -2069,6 +2082,7 @@ static struct wireless_dev *brcmf_p2p_cr
- struct wiphy *wiphy,
- u8 *addr)
- {
-+ struct brcmf_pub *drvr = p2p->cfg->pub;
- struct brcmf_cfg80211_vif *p2p_vif;
- struct brcmf_if *p2p_ifp;
- struct brcmf_if *pri_ifp;
-@@ -2080,7 +2094,7 @@ static struct wireless_dev *brcmf_p2p_cr
-
- p2p_vif = brcmf_alloc_vif(p2p->cfg, NL80211_IFTYPE_P2P_DEVICE);
- if (IS_ERR(p2p_vif)) {
-- brcmf_err("could not create discovery vif\n");
-+ bphy_err(drvr, "could not create discovery vif\n");
- return (struct wireless_dev *)p2p_vif;
- }
-
-@@ -2088,7 +2102,7 @@ static struct wireless_dev *brcmf_p2p_cr
-
- /* firmware requires unique mac address for p2pdev interface */
- if (addr && ether_addr_equal(addr, pri_ifp->mac_addr)) {
-- brcmf_err("discovery vif must be different from primary interface\n");
-+ bphy_err(drvr, "discovery vif must be different from primary interface\n");
- return ERR_PTR(-EINVAL);
- }
-
-@@ -2101,7 +2115,7 @@ static struct wireless_dev *brcmf_p2p_cr
- /* Initialize P2P Discovery in the firmware */
- err = brcmf_fil_iovar_int_set(pri_ifp, "p2p_disc", 1);
- if (err < 0) {
-- brcmf_err("set p2p_disc error\n");
-+ bphy_err(drvr, "set p2p_disc error\n");
- brcmf_fweh_p2pdev_setup(pri_ifp, false);
- brcmf_cfg80211_arm_vif_event(p2p->cfg, NULL);
- goto fail;
-@@ -2113,7 +2127,7 @@ static struct wireless_dev *brcmf_p2p_cr
- brcmf_cfg80211_arm_vif_event(p2p->cfg, NULL);
- brcmf_fweh_p2pdev_setup(pri_ifp, false);
- if (!err) {
-- brcmf_err("timeout occurred\n");
-+ bphy_err(drvr, "timeout occurred\n");
- err = -EIO;
- goto fail;
- }
-@@ -2127,7 +2141,7 @@ static struct wireless_dev *brcmf_p2p_cr
- /* verify bsscfg index for P2P discovery */
- err = brcmf_fil_iovar_int_get(pri_ifp, "p2p_dev", &bsscfgidx);
- if (err < 0) {
-- brcmf_err("retrieving discover bsscfg index failed\n");
-+ bphy_err(drvr, "retrieving discover bsscfg index failed\n");
- goto fail;
- }
-
-@@ -2161,6 +2175,7 @@ struct wireless_dev *brcmf_p2p_add_vif(s
- {
- struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
- struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg));
-+ struct brcmf_pub *drvr = cfg->pub;
- struct brcmf_cfg80211_vif *vif;
- enum brcmf_fil_p2p_if_types iftype;
- int err;
-@@ -2201,7 +2216,7 @@ struct wireless_dev *brcmf_p2p_add_vif(s
- BRCMF_VIF_EVENT_TIMEOUT);
- brcmf_cfg80211_arm_vif_event(cfg, NULL);
- if (!err) {
-- brcmf_err("timeout occurred\n");
-+ bphy_err(drvr, "timeout occurred\n");
- err = -EIO;
- goto fail;
- }
-@@ -2209,7 +2224,7 @@ struct wireless_dev *brcmf_p2p_add_vif(s
- /* interface created in firmware */
- ifp = vif->ifp;
- if (!ifp) {
-- brcmf_err("no if pointer provided\n");
-+ bphy_err(drvr, "no if pointer provided\n");
- err = -ENOENT;
- goto fail;
- }
-@@ -2220,7 +2235,7 @@ struct wireless_dev *brcmf_p2p_add_vif(s
- #endif /* >= 3.17.0 */
- err = brcmf_net_attach(ifp, true);
- if (err) {
-- brcmf_err("Registering netdevice failed\n");
-+ bphy_err(drvr, "Registering netdevice failed\n");
- free_netdev(ifp->ndev);
- goto fail;
- }
-@@ -2375,6 +2390,7 @@ void brcmf_p2p_stop_device(struct wiphy
- */
- s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg, bool p2pdev_forced)
- {
-+ struct brcmf_pub *drvr = cfg->pub;
- struct brcmf_p2p_info *p2p;
- struct brcmf_if *pri_ifp;
- s32 err = 0;
-@@ -2389,7 +2405,7 @@ s32 brcmf_p2p_attach(struct brcmf_cfg802
- if (p2pdev_forced) {
- err_ptr = brcmf_p2p_create_p2pdev(p2p, NULL, NULL);
- if (IS_ERR(err_ptr)) {
-- brcmf_err("P2P device creation failed.\n");
-+ bphy_err(drvr, "P2P device creation failed.\n");
- err = PTR_ERR(err_ptr);
- }
- } else {
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c
-@@ -109,6 +109,7 @@ static int brcmf_pno_channel_config(stru
- static int brcmf_pno_config(struct brcmf_if *ifp, u32 scan_freq,
- u32 mscan, u32 bestn)
- {
-+ struct brcmf_pub *drvr = ifp->drvr;
- struct brcmf_pno_param_le pfn_param;
- u16 flags;
- u32 pfnmem;
-@@ -132,13 +133,13 @@ static int brcmf_pno_config(struct brcmf
- /* set bestn in firmware */
- err = brcmf_fil_iovar_int_set(ifp, "pfnmem", pfnmem);
- if (err < 0) {
-- brcmf_err("failed to set pfnmem\n");
-+ bphy_err(drvr, "failed to set pfnmem\n");
- goto exit;
- }
- /* get max mscan which the firmware supports */
- err = brcmf_fil_iovar_int_get(ifp, "pfnmem", &pfnmem);
- if (err < 0) {
-- brcmf_err("failed to get pfnmem\n");
-+ bphy_err(drvr, "failed to get pfnmem\n");
- goto exit;
- }
- mscan = min_t(u32, mscan, pfnmem);
-@@ -152,7 +153,7 @@ static int brcmf_pno_config(struct brcmf
- 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);
-+ bphy_err(drvr, "pfn_set failed, err=%d\n", err);
-
- exit:
- return err;
-@@ -160,6 +161,7 @@ exit:
-
- static int brcmf_pno_set_random(struct brcmf_if *ifp, struct brcmf_pno_info *pi)
- {
-+ struct brcmf_pub *drvr = ifp->drvr;
- struct brcmf_pno_macaddr_le pfn_mac;
- u8 *mac_addr = NULL;
- u8 *mac_mask = NULL;
-@@ -194,7 +196,7 @@ static int brcmf_pno_set_random(struct b
- 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);
-+ bphy_err(drvr, "pfn_macaddr failed, err=%d\n", err);
-
- return err;
- }
-@@ -202,6 +204,7 @@ static int brcmf_pno_set_random(struct b
- static int brcmf_pno_add_ssid(struct brcmf_if *ifp, struct cfg80211_ssid *ssid,
- bool active)
- {
-+ struct brcmf_pub *drvr = ifp->drvr;
- struct brcmf_pno_net_param_le pfn;
- int err;
-
-@@ -218,12 +221,13 @@ static int brcmf_pno_add_ssid(struct brc
- 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);
-+ bphy_err(drvr, "adding failed: err=%d\n", err);
- return err;
- }
-
- static int brcmf_pno_add_bssid(struct brcmf_if *ifp, const u8 *bssid)
- {
-+ struct brcmf_pub *drvr = ifp->drvr;
- struct brcmf_pno_bssid_le bssid_cfg;
- int err;
-
-@@ -234,7 +238,7 @@ static int brcmf_pno_add_bssid(struct br
- 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);
-+ bphy_err(drvr, "adding failed: err=%d\n", err);
- return err;
- }
-
-@@ -258,6 +262,7 @@ static bool brcmf_is_ssid_active(struct
-
- static int brcmf_pno_clean(struct brcmf_if *ifp)
- {
-+ struct brcmf_pub *drvr = ifp->drvr;
- int ret;
-
- /* Disable pfn */
-@@ -267,7 +272,7 @@ static int brcmf_pno_clean(struct brcmf_
- ret = brcmf_fil_iovar_data_set(ifp, "pfnclear", NULL, 0);
- }
- if (ret < 0)
-- brcmf_err("failed code %d\n", ret);
-+ bphy_err(drvr, "failed code %d\n", ret);
-
- return ret;
- }
-@@ -392,6 +397,7 @@ static int brcmf_pno_config_networks(str
-
- static int brcmf_pno_config_sched_scans(struct brcmf_if *ifp)
- {
-+ struct brcmf_pub *drvr = ifp->drvr;
- struct brcmf_pno_info *pi;
- struct brcmf_gscan_config *gscan_cfg;
- struct brcmf_gscan_bucket_config *buckets;
-@@ -416,7 +422,7 @@ static int brcmf_pno_config_sched_scans(
- /* clean up everything */
- err = brcmf_pno_clean(ifp);
- if (err < 0) {
-- brcmf_err("failed error=%d\n", err);
-+ bphy_err(drvr, "failed error=%d\n", err);
- goto free_gscan;
- }
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.c
-@@ -47,8 +47,8 @@ int brcmf_proto_attach(struct brcmf_pub
- if (brcmf_proto_msgbuf_attach(drvr))
- goto fail;
- } else {
-- brcmf_err("Unsupported proto type %d\n",
-- drvr->bus_if->proto_type);
-+ bphy_err(drvr, "Unsupported proto type %d\n",
-+ drvr->bus_if->proto_type);
- goto fail;
- }
- if (!proto->tx_queue_data || (proto->hdrpull == NULL) ||
-@@ -56,7 +56,7 @@ int brcmf_proto_attach(struct brcmf_pub
- (proto->configure_addr_mode == NULL) ||
- (proto->delete_peer == NULL) || (proto->add_tdls_peer == NULL) ||
- (proto->debugfs_create == NULL)) {
-- brcmf_err("Not all proto handlers have been installed\n");
-+ bphy_err(drvr, "Not all proto handlers have been installed\n");
- goto fail;
- }
- return 0;
+++ /dev/null
-From e0a8ef4d7b4315bc4c1641fb3f3a7dfdfa6627b8 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Wed, 20 Feb 2019 11:30:47 +0100
-Subject: [PATCH] brcmfmac: add basic validation of shared RAM address
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-While experimenting with firmware loading I ended up in a state of
-firmware reporting shared RAM address 0x04000001. It was causing:
-[ 94.448015] Unable to handle kernel paging request at virtual address cd680001
-due to reading out of the mapped memory.
-
-This patch adds some basic validation to avoid kernel crashes due to the
-unexpected firmware behavior.
-
-Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
-Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 6 ++++++
- 1 file changed, 6 insertions(+)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
-@@ -1560,6 +1560,12 @@ static int brcmf_pcie_download_fw_nvram(
- brcmf_err(bus, "FW failed to initialize\n");
- return -ENODEV;
- }
-+ if (sharedram_addr < devinfo->ci->rambase ||
-+ sharedram_addr >= devinfo->ci->rambase + devinfo->ci->ramsize) {
-+ brcmf_err(bus, "Invalid shared RAM address 0x%08x\n",
-+ sharedram_addr);
-+ return -ENODEV;
-+ }
- brcmf_dbg(PCIE, "Shared RAM addr: 0x%08x\n", sharedram_addr);
-
- return (brcmf_pcie_init_share_ram_info(devinfo, sharedram_addr));
+++ /dev/null
-From 0c7051610c577b60b01b3b5aec14d6765e177b0d Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Thu, 21 Feb 2019 11:33:24 +0100
-Subject: [PATCH] brcmfmac: fix size of the struct msgbuf_ring_status
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This updates host struct to match the in-firmawre definition. It's a
-cosmetic change as it only applies to the reserved struct space.
-
-Fixes: c988b78244df ("brcmfmac: print firmware reported ring status errors")
-Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
-@@ -139,7 +139,7 @@ struct msgbuf_ring_status {
- struct msgbuf_common_hdr msg;
- struct msgbuf_completion_hdr compl_hdr;
- __le16 write_idx;
-- __le32 rsvd0[5];
-+ __le16 rsvd0[5];
- };
-
- struct msgbuf_rx_event {
+++ /dev/null
-From c91377495192cda096e52dc09c266b0d05f16d86 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Thu, 21 Feb 2019 11:33:25 +0100
-Subject: [PATCH] brcmfmac: print firmware reported general status errors
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Firmware may report general errors using a special message type. Add
-basic support for it by simply decoding & printing an error number.
-
-A sample situation in which firmware reports a buf error:
-CONSOLE: 027084.733 no host response IOCTL buffer available..so fail the request
-will now produce a "Firmware reported general error: 9" on the host.
-
-Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
-Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- .../broadcom/brcm80211/brcmfmac/msgbuf.c | 24 +++++++++++++++++++
- 1 file changed, 24 insertions(+)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
-@@ -134,6 +134,14 @@ struct msgbuf_completion_hdr {
- __le16 flow_ring_id;
- };
-
-+/* Data struct for the MSGBUF_TYPE_GEN_STATUS */
-+struct msgbuf_gen_status {
-+ struct msgbuf_common_hdr msg;
-+ struct msgbuf_completion_hdr compl_hdr;
-+ __le16 write_idx;
-+ __le32 rsvd0[3];
-+};
-+
- /* Data struct for the MSGBUF_TYPE_RING_STATUS */
- struct msgbuf_ring_status {
- struct msgbuf_common_hdr msg;
-@@ -1194,6 +1202,18 @@ brcmf_msgbuf_process_rx_complete(struct
- brcmf_netif_rx(ifp, skb);
- }
-
-+static void brcmf_msgbuf_process_gen_status(struct brcmf_msgbuf *msgbuf,
-+ void *buf)
-+{
-+ struct msgbuf_gen_status *gen_status = buf;
-+ struct brcmf_pub *drvr = msgbuf->drvr;
-+ int err;
-+
-+ err = le16_to_cpu(gen_status->compl_hdr.status);
-+ if (err)
-+ bphy_err(drvr, "Firmware reported general error: %d\n", err);
-+}
-+
- static void brcmf_msgbuf_process_ring_status(struct brcmf_msgbuf *msgbuf,
- void *buf)
- {
-@@ -1273,6 +1293,10 @@ static void brcmf_msgbuf_process_msgtype
-
- msg = (struct msgbuf_common_hdr *)buf;
- switch (msg->msgtype) {
-+ case MSGBUF_TYPE_GEN_STATUS:
-+ brcmf_dbg(MSGBUF, "MSGBUF_TYPE_GEN_STATUS\n");
-+ brcmf_msgbuf_process_gen_status(msgbuf, buf);
-+ break;
- case MSGBUF_TYPE_RING_STATUS:
- brcmf_dbg(MSGBUF, "MSGBUF_TYPE_RING_STATUS\n");
- brcmf_msgbuf_process_ring_status(msgbuf, buf);
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
-@@ -262,6 +262,8 @@ void brcmf_detach(struct device *dev);
+@@ -263,6 +263,8 @@ void brcmf_detach(struct device *dev);
void brcmf_dev_reset(struct device *dev);
/* Request from bus module to initiate a coredump */
void brcmf_dev_coredump(struct device *dev);
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
-@@ -91,6 +91,7 @@ struct brcmf_bus_ops {
+@@ -92,6 +92,7 @@ struct brcmf_bus_ops {
int (*get_fwname)(struct device *dev, const char *ext,
unsigned char *fw_name);
void (*debugfs_create)(struct device *dev);
};
-@@ -245,6 +246,15 @@ void brcmf_bus_debugfs_create(struct brc
+@@ -246,6 +247,15 @@ void brcmf_bus_debugfs_create(struct brc
return bus->ops->debugfs_create(bus->dev);
}
--- a/local-symbols
+++ b/local-symbols
-@@ -400,43 +400,6 @@ USB_SIERRA_NET=
+@@ -401,43 +401,6 @@ USB_SIERRA_NET=
USB_VL600=
USB_NET_CH9200=
USB_NET_AQC111=
select BRCMUTIL
--- a/Kconfig.local
+++ b/Kconfig.local
-@@ -1204,117 +1204,6 @@ config BACKPORTED_USB_NET_CH9200
+@@ -1207,117 +1207,6 @@ config BACKPORTED_USB_NET_CH9200
config BACKPORTED_USB_NET_AQC111
tristate
default USB_NET_AQC111
+++ /dev/null
-From c2e28ef7711ffcb083474ee5f154264c6ec1ec07 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Tomislav=20Po=C5=BEega?= <pozega.tomislav@gmail.com>
-Date: Thu, 27 Dec 2018 15:05:25 +0100
-Subject: [PATCH 12/28] rt2x00: reduce tx power to nominal level on RT6352
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Current implementation of RT6352 support provides too high tx power
-at least on iPA/eLNA devices. Reduce amplification of variable gain
-amplifier by 6dB to match board target power of 17dBm.
-Transmited signal strength with this patch is similar to that of
-stock firmware or pandorabox firmware. Throughput measured with iperf
-improves. Device tested: Xiaomi Miwifi Mini.
-
-Signed-off-by: Tomislav Požega <pozega.tomislav@gmail.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -5477,7 +5477,7 @@ static int rt2800_init_registers(struct
- rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000);
- rt2800_register_write(rt2x00dev, MIMO_PS_CFG, 0x00000002);
- rt2800_register_write(rt2x00dev, TX_PIN_CFG, 0x00150F0F);
-- rt2800_register_write(rt2x00dev, TX_ALC_VGA3, 0x06060606);
-+ rt2800_register_write(rt2x00dev, TX_ALC_VGA3, 0x00000000);
- rt2800_register_write(rt2x00dev, TX0_BB_GAIN_ATTEN, 0x0);
- rt2800_register_write(rt2x00dev, TX1_BB_GAIN_ATTEN, 0x0);
- rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN, 0x6C6C666C);
+++ /dev/null
-From a4296994eb8061ee3455721a296c387c639bf635 Mon Sep 17 00:00:00 2001
-From: Bernd Edlinger <bernd.edlinger@hotmail.de>
-Date: Tue, 15 Jan 2019 14:01:29 +0000
-Subject: [PATCH 13/28] rt2x00: Work around a firmware bug with shared keys
-
-Apparently the rt2x61 firmware fails temporarily to decode
-broadcast packets if the shared keys are not assigned
-in the "correct" sequence. At the same time unicast
-packets work fine, since they are encrypted with the
-pairwise key.
-
-At least with WPA2 CCMP mode the shared keys are
-set in the following sequence: keyidx=1, 2, 1, 2.
-After a while only keyidx 2 gets decrypted, and
-keyidx 1 is ignored, probably because there is never
-a keyidx 3.
-
-Symptoms are arping -b works for 10 minutes, since
-keyidx=2 is used for broadcast, and then it stops
-working for 10 minutes, because keyidx=1 is used.
-That failure mode repeats forever.
-
-Note, the firmware does not even know which keyidx
-corresponds to which hw_key_idx so the firmware is
-trying to be smarter than the driver, which is bound
-to fail.
-
-As workaround the function rt61pci_config_shared_key
-requests software decryption of the shared keys,
-by returning EOPNOTSUPP. However, pairwise keys are
-still handled by hardware which works just fine.
-
-Signed-off-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
-Acked-by: Stanislaw Gruszka <sgruszka@redhat.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/ralink/rt2x00/rt61pci.c | 93 +-------------------
- 1 file changed, 4 insertions(+), 89 deletions(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt61pci.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt61pci.c
-@@ -321,97 +321,12 @@ static int rt61pci_config_shared_key(str
- struct rt2x00lib_crypto *crypto,
- struct ieee80211_key_conf *key)
- {
-- struct hw_key_entry key_entry;
-- struct rt2x00_field32 field;
-- u32 mask;
-- u32 reg;
--
-- if (crypto->cmd == SET_KEY) {
-- /*
-- * rt2x00lib can't determine the correct free
-- * key_idx for shared keys. We have 1 register
-- * with key valid bits. The goal is simple, read
-- * the register, if that is full we have no slots
-- * left.
-- * Note that each BSS is allowed to have up to 4
-- * shared keys, so put a mask over the allowed
-- * entries.
-- */
-- mask = (0xf << crypto->bssidx);
--
-- reg = rt2x00mmio_register_read(rt2x00dev, SEC_CSR0);
-- reg &= mask;
--
-- if (reg && reg == mask)
-- return -ENOSPC;
--
-- key->hw_key_idx += reg ? ffz(reg) : 0;
--
-- /*
-- * Upload key to hardware
-- */
-- memcpy(key_entry.key, crypto->key,
-- sizeof(key_entry.key));
-- memcpy(key_entry.tx_mic, crypto->tx_mic,
-- sizeof(key_entry.tx_mic));
-- memcpy(key_entry.rx_mic, crypto->rx_mic,
-- sizeof(key_entry.rx_mic));
--
-- reg = SHARED_KEY_ENTRY(key->hw_key_idx);
-- rt2x00mmio_register_multiwrite(rt2x00dev, reg,
-- &key_entry, sizeof(key_entry));
--
-- /*
-- * The cipher types are stored over 2 registers.
-- * bssidx 0 and 1 keys are stored in SEC_CSR1 and
-- * bssidx 1 and 2 keys are stored in SEC_CSR5.
-- * Using the correct defines correctly will cause overhead,
-- * so just calculate the correct offset.
-- */
-- if (key->hw_key_idx < 8) {
-- field.bit_offset = (3 * key->hw_key_idx);
-- field.bit_mask = 0x7 << field.bit_offset;
--
-- reg = rt2x00mmio_register_read(rt2x00dev, SEC_CSR1);
-- rt2x00_set_field32(®, field, crypto->cipher);
-- rt2x00mmio_register_write(rt2x00dev, SEC_CSR1, reg);
-- } else {
-- field.bit_offset = (3 * (key->hw_key_idx - 8));
-- field.bit_mask = 0x7 << field.bit_offset;
--
-- reg = rt2x00mmio_register_read(rt2x00dev, SEC_CSR5);
-- rt2x00_set_field32(®, field, crypto->cipher);
-- rt2x00mmio_register_write(rt2x00dev, SEC_CSR5, reg);
-- }
--
-- /*
-- * The driver does not support the IV/EIV generation
-- * in hardware. However it doesn't support the IV/EIV
-- * inside the ieee80211 frame either, but requires it
-- * to be provided separately for the descriptor.
-- * rt2x00lib will cut the IV/EIV data out of all frames
-- * given to us by mac80211, but we must tell mac80211
-- * to generate the IV/EIV data.
-- */
-- key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
-- }
--
- /*
-- * SEC_CSR0 contains only single-bit fields to indicate
-- * a particular key is valid. Because using the FIELD32()
-- * defines directly will cause a lot of overhead, we use
-- * a calculation to determine the correct bit directly.
-+ * Let the software handle the shared keys,
-+ * since the hardware decryption does not work reliably,
-+ * because the firmware does not know the key's keyidx.
- */
-- mask = 1 << key->hw_key_idx;
--
-- reg = rt2x00mmio_register_read(rt2x00dev, SEC_CSR0);
-- if (crypto->cmd == SET_KEY)
-- reg |= mask;
-- else if (crypto->cmd == DISABLE_KEY)
-- reg &= ~mask;
-- rt2x00mmio_register_write(rt2x00dev, SEC_CSR0, reg);
--
-- return 0;
-+ return -EOPNOTSUPP;
- }
-
- static int rt61pci_config_pairwise_key(struct rt2x00_dev *rt2x00dev,
+++ /dev/null
-From 2587791d57588562c21e5ef7e678f02ab2f3eb82 Mon Sep 17 00:00:00 2001
-From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Date: Tue, 22 Jan 2019 16:21:34 +0100
-Subject: [PATCH 14/28] rt2x00: no need to check return value of debugfs_create
- functions
-
-When calling debugfs functions, there is no need to ever check the
-return value. The function can work or not, but the code logic should
-never do something different based on this.
-
-Cc: Stanislaw Gruszka <sgruszka@redhat.com>
-Cc: Helmut Schaa <helmut.schaa@googlemail.com>
-Cc: Kalle Valo <kvalo@codeaurora.org>
-Cc: linux-wireless@vger.kernel.org
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Acked-by: Stanislaw Gruszka <sgruszka@redhat.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- .../net/wireless/ralink/rt2x00/rt2x00debug.c | 27 -------------------
- 1 file changed, 27 deletions(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c
-@@ -656,36 +656,24 @@ void rt2x00debug_register(struct rt2x00_
- intf->driver_folder =
- debugfs_create_dir(intf->rt2x00dev->ops->name,
- rt2x00dev->hw->wiphy->debugfsdir);
-- if (IS_ERR(intf->driver_folder) || !intf->driver_folder)
-- goto exit;
-
- intf->driver_entry =
- rt2x00debug_create_file_driver("driver", intf, &intf->driver_blob);
-- if (IS_ERR(intf->driver_entry) || !intf->driver_entry)
-- goto exit;
-
- intf->chipset_entry =
- rt2x00debug_create_file_chipset("chipset",
- intf, &intf->chipset_blob);
-- if (IS_ERR(intf->chipset_entry) || !intf->chipset_entry)
-- goto exit;
-
- intf->dev_flags = debugfs_create_file("dev_flags", 0400,
- intf->driver_folder, intf,
- &rt2x00debug_fop_dev_flags);
-- if (IS_ERR(intf->dev_flags) || !intf->dev_flags)
-- goto exit;
-
- intf->cap_flags = debugfs_create_file("cap_flags", 0400,
- intf->driver_folder, intf,
- &rt2x00debug_fop_cap_flags);
-- if (IS_ERR(intf->cap_flags) || !intf->cap_flags)
-- goto exit;
-
- intf->register_folder =
- debugfs_create_dir("register", intf->driver_folder);
-- if (IS_ERR(intf->register_folder) || !intf->register_folder)
-- goto exit;
-
- #define RT2X00DEBUGFS_CREATE_REGISTER_ENTRY(__intf, __name) \
- ({ \
-@@ -695,9 +683,6 @@ void rt2x00debug_register(struct rt2x00_
- 0600, \
- (__intf)->register_folder, \
- &(__intf)->offset_##__name); \
-- if (IS_ERR((__intf)->__name##_off_entry) || \
-- !(__intf)->__name##_off_entry) \
-- goto exit; \
- \
- (__intf)->__name##_val_entry = \
- debugfs_create_file(__stringify(__name) "_value", \
-@@ -705,9 +690,6 @@ void rt2x00debug_register(struct rt2x00_
- (__intf)->register_folder, \
- (__intf), \
- &rt2x00debug_fop_##__name); \
-- if (IS_ERR((__intf)->__name##_val_entry) || \
-- !(__intf)->__name##_val_entry) \
-- goto exit; \
- } \
- })
-
-@@ -721,15 +703,10 @@ void rt2x00debug_register(struct rt2x00_
-
- intf->queue_folder =
- debugfs_create_dir("queue", intf->driver_folder);
-- if (IS_ERR(intf->queue_folder) || !intf->queue_folder)
-- goto exit;
-
- intf->queue_frame_dump_entry =
- debugfs_create_file("dump", 0400, intf->queue_folder,
- intf, &rt2x00debug_fop_queue_dump);
-- if (IS_ERR(intf->queue_frame_dump_entry)
-- || !intf->queue_frame_dump_entry)
-- goto exit;
-
- skb_queue_head_init(&intf->frame_dump_skbqueue);
- init_waitqueue_head(&intf->frame_dump_waitqueue);
-@@ -747,10 +724,6 @@ void rt2x00debug_register(struct rt2x00_
- #endif
-
- return;
--
--exit:
-- rt2x00debug_deregister(rt2x00dev);
-- rt2x00_err(rt2x00dev, "Failed to register debug handler\n");
- }
-
- void rt2x00debug_deregister(struct rt2x00_dev *rt2x00dev)
+++ /dev/null
-From 17ae2acd1a6f5148edd80d84194e5d7c80be360e Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Tomislav=20Po=C5=BEega?= <pozega.tomislav@gmail.com>
-Date: Wed, 13 Feb 2019 11:09:12 +0100
-Subject: [PATCH 15/28] rt2x00: remove unneeded check
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Remove band check from rf53xx channel config routine since all chips
-using it are single band.
-
-Signed-off-by: Tomislav Požega <pozega.tomislav@gmail.com>
-Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- .../net/wireless/ralink/rt2x00/rt2800lib.c | 103 +++++++++---------
- 1 file changed, 50 insertions(+), 53 deletions(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -2966,6 +2966,7 @@ static void rt2800_config_channel_rf53xx
- struct channel_info *info)
- {
- u8 rfcsr;
-+ int idx = rf->channel-1;
-
- rt2800_rfcsr_write(rt2x00dev, 8, rf->rf1);
- rt2800_rfcsr_write(rt2x00dev, 9, rf->rf3);
-@@ -3003,60 +3004,56 @@ static void rt2800_config_channel_rf53xx
-
- rt2800_freq_cal_mode1(rt2x00dev);
-
-- if (rf->channel <= 14) {
-- int idx = rf->channel-1;
-+ if (rt2x00_has_cap_bt_coexist(rt2x00dev)) {
-+ if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) {
-+ /* r55/r59 value array of channel 1~14 */
-+ static const char r55_bt_rev[] = {0x83, 0x83,
-+ 0x83, 0x73, 0x73, 0x63, 0x53, 0x53,
-+ 0x53, 0x43, 0x43, 0x43, 0x43, 0x43};
-+ static const char r59_bt_rev[] = {0x0e, 0x0e,
-+ 0x0e, 0x0e, 0x0e, 0x0b, 0x0a, 0x09,
-+ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07};
-+
-+ rt2800_rfcsr_write(rt2x00dev, 55,
-+ r55_bt_rev[idx]);
-+ rt2800_rfcsr_write(rt2x00dev, 59,
-+ r59_bt_rev[idx]);
-+ } else {
-+ static const char r59_bt[] = {0x8b, 0x8b, 0x8b,
-+ 0x8b, 0x8b, 0x8b, 0x8b, 0x8a, 0x89,
-+ 0x88, 0x88, 0x86, 0x85, 0x84};
-
-- if (rt2x00_has_cap_bt_coexist(rt2x00dev)) {
-- if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) {
-- /* r55/r59 value array of channel 1~14 */
-- static const char r55_bt_rev[] = {0x83, 0x83,
-- 0x83, 0x73, 0x73, 0x63, 0x53, 0x53,
-- 0x53, 0x43, 0x43, 0x43, 0x43, 0x43};
-- static const char r59_bt_rev[] = {0x0e, 0x0e,
-- 0x0e, 0x0e, 0x0e, 0x0b, 0x0a, 0x09,
-- 0x07, 0x07, 0x07, 0x07, 0x07, 0x07};
--
-- rt2800_rfcsr_write(rt2x00dev, 55,
-- r55_bt_rev[idx]);
-- rt2800_rfcsr_write(rt2x00dev, 59,
-- r59_bt_rev[idx]);
-- } else {
-- static const char r59_bt[] = {0x8b, 0x8b, 0x8b,
-- 0x8b, 0x8b, 0x8b, 0x8b, 0x8a, 0x89,
-- 0x88, 0x88, 0x86, 0x85, 0x84};
-+ rt2800_rfcsr_write(rt2x00dev, 59, r59_bt[idx]);
-+ }
-+ } else {
-+ if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) {
-+ static const char r55_nonbt_rev[] = {0x23, 0x23,
-+ 0x23, 0x23, 0x13, 0x13, 0x03, 0x03,
-+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03};
-+ static const char r59_nonbt_rev[] = {0x07, 0x07,
-+ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
-+ 0x07, 0x07, 0x06, 0x05, 0x04, 0x04};
-+
-+ rt2800_rfcsr_write(rt2x00dev, 55,
-+ r55_nonbt_rev[idx]);
-+ rt2800_rfcsr_write(rt2x00dev, 59,
-+ r59_nonbt_rev[idx]);
-+ } else if (rt2x00_rt(rt2x00dev, RT5390) ||
-+ rt2x00_rt(rt2x00dev, RT5392) ||
-+ rt2x00_rt(rt2x00dev, RT6352)) {
-+ static const char r59_non_bt[] = {0x8f, 0x8f,
-+ 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8d,
-+ 0x8a, 0x88, 0x88, 0x87, 0x87, 0x86};
-+
-+ rt2800_rfcsr_write(rt2x00dev, 59,
-+ r59_non_bt[idx]);
-+ } else if (rt2x00_rt(rt2x00dev, RT5350)) {
-+ static const char r59_non_bt[] = {0x0b, 0x0b,
-+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0a,
-+ 0x0a, 0x09, 0x08, 0x07, 0x07, 0x06};
-
-- rt2800_rfcsr_write(rt2x00dev, 59, r59_bt[idx]);
-- }
-- } else {
-- if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) {
-- static const char r55_nonbt_rev[] = {0x23, 0x23,
-- 0x23, 0x23, 0x13, 0x13, 0x03, 0x03,
-- 0x03, 0x03, 0x03, 0x03, 0x03, 0x03};
-- static const char r59_nonbt_rev[] = {0x07, 0x07,
-- 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
-- 0x07, 0x07, 0x06, 0x05, 0x04, 0x04};
--
-- rt2800_rfcsr_write(rt2x00dev, 55,
-- r55_nonbt_rev[idx]);
-- rt2800_rfcsr_write(rt2x00dev, 59,
-- r59_nonbt_rev[idx]);
-- } else if (rt2x00_rt(rt2x00dev, RT5390) ||
-- rt2x00_rt(rt2x00dev, RT5392) ||
-- rt2x00_rt(rt2x00dev, RT6352)) {
-- static const char r59_non_bt[] = {0x8f, 0x8f,
-- 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8d,
-- 0x8a, 0x88, 0x88, 0x87, 0x87, 0x86};
--
-- rt2800_rfcsr_write(rt2x00dev, 59,
-- r59_non_bt[idx]);
-- } else if (rt2x00_rt(rt2x00dev, RT5350)) {
-- static const char r59_non_bt[] = {0x0b, 0x0b,
-- 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0a,
-- 0x0a, 0x09, 0x08, 0x07, 0x07, 0x06};
--
-- rt2800_rfcsr_write(rt2x00dev, 59,
-- r59_non_bt[idx]);
-- }
-+ rt2800_rfcsr_write(rt2x00dev, 59,
-+ r59_non_bt[idx]);
- }
- }
- }
+++ /dev/null
-From 5991a2ecd070ce5ef646b4e8e0bc8d99110604ed Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Tomislav=20Po=C5=BEega?= <pozega.tomislav@gmail.com>
-Date: Wed, 13 Feb 2019 11:09:13 +0100
-Subject: [PATCH 16/28] rt2x00: remove confusing AGC register
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Register 66 was causing issues on RT6352 if set to the same value as
-in MTK driver. With 1c reg value device was working fine in both HT20
-and HT40 modes.
-
-Signed-off-by: Tomislav Požega <pozega.tomislav@gmail.com>
-Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 6 +-----
- 1 file changed, 1 insertion(+), 5 deletions(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -3983,11 +3983,7 @@ static void rt2800_config_channel(struct
- rt2800_bbp_write(rt2x00dev, 196, reg);
-
- /* AGC init */
-- if (rt2x00_rt(rt2x00dev, RT6352))
-- reg = 0x04;
-- else
-- reg = rf->channel <= 14 ? 0x1c : 0x24;
--
-+ reg = rf->channel <= 14 ? 0x1c : 0x24;
- reg += 2 * rt2x00dev->lna_gain;
- rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg);
-
+++ /dev/null
-From 9ad3b55654455258a9463384edb40077439d879f Mon Sep 17 00:00:00 2001
-From: Stanislaw Gruszka <sgruszka@redhat.com>
-Date: Wed, 13 Feb 2019 11:09:14 +0100
-Subject: [PATCH 17/28] rt2800: enable TX_PIN_CFG_LNA_PE_ bits per band
-
-Do not enable TX_PIN_CFG_LNA_PE_A* bits for 2.4GHz band and
-vice versa TX_PIN_CFG_LNA_PE_G* bits for 5GHz.
-
-Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 18 ++++++++++++------
- 1 file changed, 12 insertions(+), 6 deletions(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -3893,18 +3893,24 @@ static void rt2800_config_channel(struct
- switch (rt2x00dev->default_ant.rx_chain_num) {
- case 3:
- /* Turn on tertiary LNAs */
-- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A2_EN, 1);
-- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G2_EN, 1);
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A2_EN,
-+ rf->channel > 14);
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G2_EN,
-+ rf->channel <= 14);
- /* fall-through */
- case 2:
- /* Turn on secondary LNAs */
-- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A1_EN, 1);
-- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G1_EN, 1);
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A1_EN,
-+ rf->channel > 14);
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G1_EN,
-+ rf->channel <= 14);
- /* fall-through */
- case 1:
- /* Turn on primary LNAs */
-- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A0_EN, 1);
-- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G0_EN, 1);
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A0_EN,
-+ rf->channel > 14);
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G0_EN,
-+ rf->channel <= 14);
- break;
- }
-
+++ /dev/null
-From 7aca14885edeab536a8cbe1e7cfeadd4c3310b9b Mon Sep 17 00:00:00 2001
-From: Stanislaw Gruszka <sgruszka@redhat.com>
-Date: Wed, 13 Feb 2019 11:09:15 +0100
-Subject: [PATCH 18/28] rt2800: enable TX_PIN_CFG_RFRX_EN only for MT7620
-
-The TX_PIN_CFG_RFRX_EN bit was not set on other devices than MT7620,
-restore old behavaviour since setting this bit maight not be
-correct for older devices.
-
-Fixes: 41977e86c984 ("rt2x00: add support for MT7620")
-Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 7 ++++---
- 1 file changed, 4 insertions(+), 3 deletions(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -3858,10 +3858,12 @@ static void rt2800_config_channel(struct
- if (rt2x00_rt(rt2x00dev, RT3572))
- rt2800_rfcsr_write(rt2x00dev, 8, 0);
-
-- if (rt2x00_rt(rt2x00dev, RT6352))
-+ if (rt2x00_rt(rt2x00dev, RT6352)) {
- tx_pin = rt2800_register_read(rt2x00dev, TX_PIN_CFG);
-- else
-+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_RFRX_EN, 1);
-+ } else {
- tx_pin = 0;
-+ }
-
- switch (rt2x00dev->default_ant.tx_chain_num) {
- case 3:
-@@ -3916,7 +3918,6 @@ static void rt2800_config_channel(struct
-
- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_RFTR_EN, 1);
- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_TRSW_EN, 1);
-- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_RFRX_EN, 1); /* mt7620 */
-
- rt2800_register_write(rt2x00dev, TX_PIN_CFG, tx_pin);
-
+++ /dev/null
-From c7ff1bfeaf1ca69e3e401be211b55d1738d0c5fc Mon Sep 17 00:00:00 2001
-From: Stanislaw Gruszka <sgruszka@redhat.com>
-Date: Wed, 13 Feb 2019 11:09:16 +0100
-Subject: [PATCH 19/28] rt2800: comment and simplify AGC init for RT6352
-
-We do not need separate lines for calculating register values.
-Also add comment that value is different than in vendor driver.
-
-Suggested-by: Daniel Golle <daniel@makrotopia.org>
-Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 9 ++++++---
- 1 file changed, 6 insertions(+), 3 deletions(-)
-
---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
-@@ -3989,9 +3989,12 @@ static void rt2800_config_channel(struct
- rt2800_bbp_write(rt2x00dev, 195, 141);
- rt2800_bbp_write(rt2x00dev, 196, reg);
-
-- /* AGC init */
-- reg = rf->channel <= 14 ? 0x1c : 0x24;
-- reg += 2 * rt2x00dev->lna_gain;
-+ /* AGC init.
-+ * Despite the vendor driver using different values here for
-+ * RT6352 chip, we use 0x1c for now. This may have to be changed
-+ * once TSSI got implemented.
-+ */
-+ reg = (rf->channel <= 14 ? 0x1c : 0x24) + 2*rt2x00dev->lna_gain;
- rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg);
-
- rt2800_iq_calibrate(rt2x00dev, rf->channel);
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
-@@ -6940,6 +6940,11 @@ void cfg80211_pmsr_complete(struct wirel
+@@ -7189,6 +7189,11 @@ void cfg80211_pmsr_complete(struct wirel
#define wiphy_info(wiphy, format, args...) \
dev_info(&(wiphy)->dev, format, ##args)
--- a/local-symbols
+++ b/local-symbols
-@@ -308,6 +308,7 @@ RT2X00_LIB_FIRMWARE=
+@@ -309,6 +309,7 @@ RT2X00_LIB_FIRMWARE=
RT2X00_LIB_CRYPTO=
RT2X00_LIB_LEDS=
RT2X00_LIB_DEBUGFS=
* Copyright 2016, Qualcomm Atheros, Inc.
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
-@@ -571,7 +571,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
+@@ -573,7 +573,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
NL80211_FEATURE_MAC_ON_CREATE |
NL80211_FEATURE_USERSPACE_MPM |
NL80211_FEATURE_FULL_AP_CLIENT_STATE;
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
-@@ -3837,6 +3837,12 @@ out:
+@@ -3989,6 +3989,12 @@ out:
netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
struct net_device *dev)
{
static int ieee80211_ifa6_changed(struct notifier_block *nb,
unsigned long data, void *arg)
{
-@@ -1234,14 +1234,14 @@ int ieee80211_register_hw(struct ieee802
+@@ -1256,14 +1256,14 @@ int ieee80211_register_hw(struct ieee802
rtnl_unlock();
local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed;
result = register_inet6addr_notifier(&local->ifa6_notifier);
if (result)
-@@ -1250,13 +1250,13 @@ int ieee80211_register_hw(struct ieee802
+@@ -1272,13 +1272,13 @@ int ieee80211_register_hw(struct ieee802
return 0;
fail_ifa:
#endif
rtnl_lock();
-@@ -1285,10 +1285,10 @@ void ieee80211_unregister_hw(struct ieee
+@@ -1307,10 +1307,10 @@ void ieee80211_unregister_hw(struct ieee
tasklet_kill(&local->tx_pending_tasklet);
tasklet_kill(&local->tasklet);
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
-@@ -2256,7 +2256,7 @@ static int ieee80211_scan(struct wiphy *
+@@ -2268,7 +2268,7 @@ static int ieee80211_scan(struct wiphy *
* the frames sent while scanning on other channel will be
* lost)
*/
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
-@@ -1166,6 +1166,9 @@ static inline void drv_wake_tx_queue(str
+@@ -1195,6 +1195,9 @@ static inline void drv_wake_tx_queue(str
{
struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->txq.vif);
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
-@@ -3214,6 +3214,7 @@ static bool ieee80211_amsdu_aggregate(st
+@@ -3221,6 +3221,7 @@ static bool ieee80211_amsdu_aggregate(st
u8 max_subframes = sta->sta.max_amsdu_subframes;
int max_frags = local->hw.max_tx_fragments;
int max_amsdu_len = sta->sta.max_amsdu_len;
__be16 len;
void *data;
bool ret = false;
-@@ -3252,12 +3253,13 @@ static bool ieee80211_amsdu_aggregate(st
+@@ -3259,12 +3260,13 @@ static bool ieee80211_amsdu_aggregate(st
flow = fq_flow_classify(fq, tin, skb, fq_flow_get_default_func);
head = skb_peek_tail(&flow->queue);
if (!head || skb_is_gso(head))
nfrags = 1 + skb_shinfo(skb)->nr_frags;
nfrags += 1 + skb_shinfo(head)->nr_frags;
-@@ -3318,6 +3320,9 @@ out_recalc:
+@@ -3325,6 +3327,9 @@ out_recalc:
fq_recalc_backlog(fq, tin, flow);
}
out:
+++ /dev/null
-From: Felix Fietkau <nbd@nbd.name>
-Date: Wed, 16 Jan 2019 22:32:12 +0100
-Subject: [PATCH] mac80211: minstrel_ht: add flag to indicate
- missing/inaccurate tx A-MPDU length
-
-Some hardware (e.g. MediaTek MT7603) cannot report A-MPDU length in tx status
-information. Add support for a flag to indicate that, to allow minstrel_ht
-to use a fixed value in its internal calculation (which gives better results
-than just defaulting to 1).
-
-Signed-off-by: Felix Fietkau <nbd@nbd.name>
-Signed-off-by: Johannes Berg <johannes.berg@intel.com>
----
-
---- a/include/net/mac80211.h
-+++ b/include/net/mac80211.h
-@@ -2184,6 +2184,9 @@ struct ieee80211_txq {
- * MMPDUs on station interfaces. This of course requires the driver to use
- * TXQs to start with.
- *
-+ * @IEEE80211_HW_TX_STATUS_NO_AMPDU_LEN: Driver does not report accurate A-MPDU
-+ * length in tx status information
-+ *
- * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
- */
- enum ieee80211_hw_flags {
-@@ -2232,6 +2235,7 @@ enum ieee80211_hw_flags {
- IEEE80211_HW_BUFF_MMPDU_TXQ,
- IEEE80211_HW_SUPPORTS_VHT_EXT_NSS_BW,
- IEEE80211_HW_STA_MMPDU_TXQ,
-+ IEEE80211_HW_TX_STATUS_NO_AMPDU_LEN,
-
- /* keep last, obviously */
- NUM_IEEE80211_HW_FLAGS
---- a/net/mac80211/debugfs.c
-+++ b/net/mac80211/debugfs.c
-@@ -218,6 +218,7 @@ static const char *hw_flag_names[] = {
- FLAG(BUFF_MMPDU_TXQ),
- FLAG(SUPPORTS_VHT_EXT_NSS_BW),
- FLAG(STA_MMPDU_TXQ),
-+ FLAG(TX_STATUS_NO_AMPDU_LEN),
- #undef FLAG
- };
-
---- a/net/mac80211/rc80211_minstrel_ht.c
-+++ b/net/mac80211/rc80211_minstrel_ht.c
-@@ -294,6 +294,15 @@ minstrel_get_ratestats(struct minstrel_h
- return &mi->groups[index / MCS_GROUP_RATES].rates[index % MCS_GROUP_RATES];
- }
-
-+static unsigned int
-+minstrel_ht_avg_ampdu_len(struct minstrel_ht_sta *mi)
-+{
-+ if (!mi->avg_ampdu_len)
-+ return AVG_AMPDU_SIZE;
-+
-+ return MINSTREL_TRUNC(mi->avg_ampdu_len);
-+}
-+
- /*
- * Return current throughput based on the average A-MPDU length, taking into
- * account the expected number of retransmissions and their expected length
-@@ -309,7 +318,7 @@ minstrel_ht_get_tp_avg(struct minstrel_h
- return 0;
-
- if (group != MINSTREL_CCK_GROUP)
-- nsecs = 1000 * mi->overhead / MINSTREL_TRUNC(mi->avg_ampdu_len);
-+ nsecs = 1000 * mi->overhead / minstrel_ht_avg_ampdu_len(mi);
-
- nsecs += minstrel_mcs_groups[group].duration[rate] <<
- minstrel_mcs_groups[group].shift;
-@@ -503,8 +512,12 @@ minstrel_ht_update_stats(struct minstrel
- u16 tmp_cck_tp_rate[MAX_THR_RATES], index;
-
- if (mi->ampdu_packets > 0) {
-- mi->avg_ampdu_len = minstrel_ewma(mi->avg_ampdu_len,
-- MINSTREL_FRAC(mi->ampdu_len, mi->ampdu_packets), EWMA_LEVEL);
-+ if (!ieee80211_hw_check(mp->hw, TX_STATUS_NO_AMPDU_LEN))
-+ mi->avg_ampdu_len = minstrel_ewma(mi->avg_ampdu_len,
-+ MINSTREL_FRAC(mi->ampdu_len, mi->ampdu_packets),
-+ EWMA_LEVEL);
-+ else
-+ mi->avg_ampdu_len = 0;
- mi->ampdu_len = 0;
- mi->ampdu_packets = 0;
- }
-@@ -709,7 +722,9 @@ minstrel_ht_tx_status(void *priv, struct
- mi->ampdu_len += info->status.ampdu_len;
-
- if (!mi->sample_wait && !mi->sample_tries && mi->sample_count > 0) {
-- mi->sample_wait = 16 + 2 * MINSTREL_TRUNC(mi->avg_ampdu_len);
-+ int avg_ampdu_len = minstrel_ht_avg_ampdu_len(mi);
-+
-+ mi->sample_wait = 16 + 2 * avg_ampdu_len;
- mi->sample_tries = 1;
- mi->sample_count--;
- }
-@@ -777,7 +792,7 @@ minstrel_calc_retransmit(struct minstrel
- unsigned int cw = mp->cw_min;
- unsigned int ctime = 0;
- unsigned int t_slot = 9; /* FIXME */
-- unsigned int ampdu_len = MINSTREL_TRUNC(mi->avg_ampdu_len);
-+ unsigned int ampdu_len = minstrel_ht_avg_ampdu_len(mi);
- unsigned int overhead = 0, overhead_rtscts = 0;
-
- mrs = minstrel_get_ratestats(mi, index);
---- a/net/mac80211/rc80211_minstrel_ht_debugfs.c
-+++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c
-@@ -160,9 +160,10 @@ minstrel_ht_stats_open(struct inode *ino
- "lookaround %d\n",
- max(0, (int) mi->total_packets - (int) mi->sample_packets),
- mi->sample_packets);
-- p += sprintf(p, "Average # of aggregated frames per A-MPDU: %d.%d\n",
-- MINSTREL_TRUNC(mi->avg_ampdu_len),
-- MINSTREL_TRUNC(mi->avg_ampdu_len * 10) % 10);
-+ if (mi->avg_ampdu_len)
-+ p += sprintf(p, "Average # of aggregated frames per A-MPDU: %d.%d\n",
-+ MINSTREL_TRUNC(mi->avg_ampdu_len),
-+ MINSTREL_TRUNC(mi->avg_ampdu_len * 10) % 10);
- ms->len = p - ms->buf;
- WARN_ON(ms->len + sizeof(*ms) > 32768);
-
+++ /dev/null
-From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= <toke@toke.dk>
-Date: Tue, 18 Dec 2018 17:02:06 -0800
-Subject: [PATCH] mac80211: Add TXQ scheduling API
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This adds an API to mac80211 to handle scheduling of TXQs. The interface
-between driver and mac80211 for TXQ handling is changed by adding two new
-functions: ieee80211_next_txq(), which will return the next TXQ to schedule
-in the current round-robin rotation, and ieee80211_return_txq(), which the
-driver uses to indicate that it has finished scheduling a TXQ (which will
-then be put back in the scheduling rotation if it isn't empty).
-
-The driver must call ieee80211_txq_schedule_start() at the start of each
-scheduling session, and ieee80211_txq_schedule_end() at the end. The API
-then guarantees that the same TXQ is not returned twice in the same
-session (so a driver can loop on ieee80211_next_txq() without worrying
-about breaking the loop.
-
-Usage of the new API is optional, so drivers can be ported one at a time.
-In this patch, the actual scheduling performed by mac80211 is simple
-round-robin, but a subsequent commit adds airtime fairness awareness to the
-scheduler.
-
-Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
-[minor kernel-doc fix, propagate sparse locking checks out]
-Signed-off-by: Johannes Berg <johannes.berg@intel.com>
----
-
---- a/include/net/mac80211.h
-+++ b/include/net/mac80211.h
-@@ -108,9 +108,15 @@
- * The driver is expected to initialize its private per-queue data for stations
- * and interfaces in the .add_interface and .sta_add ops.
- *
-- * The driver can't access the queue directly. To dequeue a frame, it calls
-- * ieee80211_tx_dequeue(). Whenever mac80211 adds a new frame to a queue, it
-- * calls the .wake_tx_queue driver op.
-+ * The driver can't access the queue directly. To dequeue a frame from a
-+ * txq, it calls ieee80211_tx_dequeue(). Whenever mac80211 adds a new frame to a
-+ * queue, it calls the .wake_tx_queue driver op.
-+ *
-+ * Drivers can optionally delegate responsibility for scheduling queues to
-+ * mac80211, to take advantage of airtime fairness accounting. In this case, to
-+ * obtain the next queue to pull frames from, the driver calls
-+ * ieee80211_next_txq(). The driver is then expected to return the txq using
-+ * ieee80211_return_txq().
- *
- * For AP powersave TIM handling, the driver only needs to indicate if it has
- * buffered packets in the driver specific data structures by calling
-@@ -6107,7 +6113,8 @@ void ieee80211_unreserve_tid(struct ieee
- * ieee80211_tx_dequeue - dequeue a packet from a software tx queue
- *
- * @hw: pointer as obtained from ieee80211_alloc_hw()
-- * @txq: pointer obtained from station or virtual interface
-+ * @txq: pointer obtained from station or virtual interface, or from
-+ * ieee80211_next_txq()
- *
- * Returns the skb if successful, %NULL if no frame was available.
- *
-@@ -6123,6 +6130,54 @@ struct sk_buff *ieee80211_tx_dequeue(str
- struct ieee80211_txq *txq);
-
- /**
-+ * ieee80211_next_txq - get next tx queue to pull packets from
-+ *
-+ * @hw: pointer as obtained from ieee80211_alloc_hw()
-+ * @ac: AC number to return packets from.
-+ *
-+ * Should only be called between calls to ieee80211_txq_schedule_start()
-+ * and ieee80211_txq_schedule_end().
-+ * Returns the next txq if successful, %NULL if no queue is eligible. If a txq
-+ * is returned, it should be returned with ieee80211_return_txq() after the
-+ * driver has finished scheduling it.
-+ */
-+struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, u8 ac);
-+
-+/**
-+ * ieee80211_return_txq - return a TXQ previously acquired by ieee80211_next_txq()
-+ *
-+ * @hw: pointer as obtained from ieee80211_alloc_hw()
-+ * @txq: pointer obtained from station or virtual interface
-+ *
-+ * Should only be called between calls to ieee80211_txq_schedule_start()
-+ * and ieee80211_txq_schedule_end().
-+ */
-+void ieee80211_return_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq);
-+
-+/**
-+ * ieee80211_txq_schedule_start - acquire locks for safe scheduling of an AC
-+ *
-+ * @hw: pointer as obtained from ieee80211_alloc_hw()
-+ * @ac: AC number to acquire locks for
-+ *
-+ * Acquire locks needed to schedule TXQs from the given AC. Should be called
-+ * before ieee80211_next_txq() or ieee80211_return_txq().
-+ */
-+void ieee80211_txq_schedule_start(struct ieee80211_hw *hw, u8 ac)
-+ __acquires(txq_lock);
-+
-+/**
-+ * ieee80211_txq_schedule_end - release locks for safe scheduling of an AC
-+ *
-+ * @hw: pointer as obtained from ieee80211_alloc_hw()
-+ * @ac: AC number to acquire locks for
-+ *
-+ * Release locks previously acquired by ieee80211_txq_schedule_end().
-+ */
-+void ieee80211_txq_schedule_end(struct ieee80211_hw *hw, u8 ac)
-+ __releases(txq_lock);
-+
-+/**
- * ieee80211_txq_get_depth - get pending frame/byte count of given txq
- *
- * The values are not guaranteed to be coherent with regard to each other, i.e.
---- a/net/mac80211/agg-tx.c
-+++ b/net/mac80211/agg-tx.c
-@@ -229,7 +229,7 @@ ieee80211_agg_start_txq(struct sta_info
- clear_bit(IEEE80211_TXQ_STOP, &txqi->flags);
- local_bh_disable();
- rcu_read_lock();
-- drv_wake_tx_queue(sta->sdata->local, txqi);
-+ schedule_and_wake_txq(sta->sdata->local, txqi);
- rcu_read_unlock();
- local_bh_enable();
- }
---- a/net/mac80211/driver-ops.h
-+++ b/net/mac80211/driver-ops.h
-@@ -1236,6 +1236,15 @@ static inline void drv_abort_pmsr(struct
- trace_drv_return_void(local);
- }
-
-+static inline void schedule_and_wake_txq(struct ieee80211_local *local,
-+ struct txq_info *txqi)
-+{
-+ spin_lock_bh(&local->active_txq_lock[txqi->txq.ac]);
-+ ieee80211_return_txq(&local->hw, &txqi->txq);
-+ spin_unlock_bh(&local->active_txq_lock[txqi->txq.ac]);
-+ drv_wake_tx_queue(local, txqi);
-+}
-+
- static inline int drv_start_nan(struct ieee80211_local *local,
- struct ieee80211_sub_if_data *sdata,
- struct cfg80211_nan_conf *conf)
---- a/net/mac80211/ieee80211_i.h
-+++ b/net/mac80211/ieee80211_i.h
-@@ -831,6 +831,8 @@ enum txq_info_flags {
- * a fq_flow which is already owned by a different tin
- * @def_cvars: codel vars for @def_flow
- * @frags: used to keep fragments created after dequeue
-+ * @schedule_order: used with ieee80211_local->active_txqs
-+ * @schedule_round: counter to prevent infinite loops on TXQ scheduling
- */
- struct txq_info {
- struct fq_tin tin;
-@@ -838,6 +840,8 @@ struct txq_info {
- struct codel_vars def_cvars;
- struct codel_stats cstats;
- struct sk_buff_head frags;
-+ struct list_head schedule_order;
-+ u16 schedule_round;
- unsigned long flags;
-
- /* keep last! */
-@@ -1129,6 +1133,11 @@ struct ieee80211_local {
- struct codel_vars *cvars;
- struct codel_params cparams;
-
-+ /* protects active_txqs and txqi->schedule_order */
-+ spinlock_t active_txq_lock[IEEE80211_NUM_ACS];
-+ struct list_head active_txqs[IEEE80211_NUM_ACS];
-+ u16 schedule_round[IEEE80211_NUM_ACS];
-+
- const struct ieee80211_ops *ops;
-
- /*
---- a/net/mac80211/main.c
-+++ b/net/mac80211/main.c
-@@ -665,6 +665,11 @@ struct ieee80211_hw *ieee80211_alloc_hw_
- spin_lock_init(&local->rx_path_lock);
- spin_lock_init(&local->queue_stop_reason_lock);
-
-+ for (i = 0; i < IEEE80211_NUM_ACS; i++) {
-+ INIT_LIST_HEAD(&local->active_txqs[i]);
-+ spin_lock_init(&local->active_txq_lock[i]);
-+ }
-+
- INIT_LIST_HEAD(&local->chanctx_list);
- mutex_init(&local->chanctx_mtx);
-
---- a/net/mac80211/sta_info.c
-+++ b/net/mac80211/sta_info.c
-@@ -1249,7 +1249,7 @@ void ieee80211_sta_ps_deliver_wakeup(str
- if (!sta->sta.txq[i] || !txq_has_queue(sta->sta.txq[i]))
- continue;
-
-- drv_wake_tx_queue(local, to_txq_info(sta->sta.txq[i]));
-+ schedule_and_wake_txq(local, to_txq_info(sta->sta.txq[i]));
- }
-
- skb_queue_head_init(&pending);
---- a/net/mac80211/tx.c
-+++ b/net/mac80211/tx.c
-@@ -1449,6 +1449,7 @@ void ieee80211_txq_init(struct ieee80211
- codel_vars_init(&txqi->def_cvars);
- codel_stats_init(&txqi->cstats);
- __skb_queue_head_init(&txqi->frags);
-+ INIT_LIST_HEAD(&txqi->schedule_order);
-
- txqi->txq.vif = &sdata->vif;
-
-@@ -1489,6 +1490,9 @@ void ieee80211_txq_purge(struct ieee8021
-
- fq_tin_reset(fq, tin, fq_skb_free_func);
- ieee80211_purge_tx_queue(&local->hw, &txqi->frags);
-+ spin_lock_bh(&local->active_txq_lock[txqi->txq.ac]);
-+ list_del_init(&txqi->schedule_order);
-+ spin_unlock_bh(&local->active_txq_lock[txqi->txq.ac]);
- }
-
- void ieee80211_txq_set_params(struct ieee80211_local *local)
-@@ -1605,7 +1609,7 @@ static bool ieee80211_queue_skb(struct i
- ieee80211_txq_enqueue(local, txqi, skb);
- spin_unlock_bh(&fq->lock);
-
-- drv_wake_tx_queue(local, txqi);
-+ schedule_and_wake_txq(local, txqi);
-
- return true;
- }
-@@ -3641,6 +3645,60 @@ out:
- }
- EXPORT_SYMBOL(ieee80211_tx_dequeue);
-
-+struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, u8 ac)
-+{
-+ struct ieee80211_local *local = hw_to_local(hw);
-+ struct txq_info *txqi = NULL;
-+
-+ lockdep_assert_held(&local->active_txq_lock[ac]);
-+
-+ txqi = list_first_entry_or_null(&local->active_txqs[ac],
-+ struct txq_info,
-+ schedule_order);
-+
-+ if (!txqi || txqi->schedule_round == local->schedule_round[ac])
-+ return NULL;
-+
-+ list_del_init(&txqi->schedule_order);
-+ txqi->schedule_round = local->schedule_round[ac];
-+ return &txqi->txq;
-+}
-+EXPORT_SYMBOL(ieee80211_next_txq);
-+
-+void ieee80211_return_txq(struct ieee80211_hw *hw,
-+ struct ieee80211_txq *txq)
-+{
-+ struct ieee80211_local *local = hw_to_local(hw);
-+ struct txq_info *txqi = to_txq_info(txq);
-+
-+ lockdep_assert_held(&local->active_txq_lock[txq->ac]);
-+
-+ if (list_empty(&txqi->schedule_order) &&
-+ (!skb_queue_empty(&txqi->frags) || txqi->tin.backlog_packets))
-+ list_add_tail(&txqi->schedule_order,
-+ &local->active_txqs[txq->ac]);
-+}
-+EXPORT_SYMBOL(ieee80211_return_txq);
-+
-+void ieee80211_txq_schedule_start(struct ieee80211_hw *hw, u8 ac)
-+ __acquires(txq_lock)
-+{
-+ struct ieee80211_local *local = hw_to_local(hw);
-+
-+ spin_lock_bh(&local->active_txq_lock[ac]);
-+ local->schedule_round[ac]++;
-+}
-+EXPORT_SYMBOL(ieee80211_txq_schedule_start);
-+
-+void ieee80211_txq_schedule_end(struct ieee80211_hw *hw, u8 ac)
-+ __releases(txq_lock)
-+{
-+ struct ieee80211_local *local = hw_to_local(hw);
-+
-+ spin_unlock_bh(&local->active_txq_lock[ac]);
-+}
-+EXPORT_SYMBOL(ieee80211_txq_schedule_end);
-+
- void __ieee80211_subif_start_xmit(struct sk_buff *skb,
- struct net_device *dev,
- u32 info_flags)
+++ /dev/null
-From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= <toke@toke.dk>
-Date: Tue, 18 Dec 2018 17:02:07 -0800
-Subject: [PATCH] cfg80211: Add airtime statistics and settings
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This adds TX airtime statistics to the cfg80211 station dump (to go along
-with the RX info already present), and adds a new parameter to set the
-airtime weight of each station. The latter allows userspace to implement
-policies for different stations by varying their weights.
-
-Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
-[rmanohar@codeaurora.org: fixed checkpatch warnings]
-Signed-off-by: Rajkumar Manoharan <rmanohar@codeaurora.org>
-[move airtime weight != 0 check into policy]
-Signed-off-by: Johannes Berg <johannes.berg@intel.com>
----
-
---- a/include/net/cfg80211.h
-+++ b/include/net/cfg80211.h
-@@ -1003,6 +1003,7 @@ enum station_parameters_apply_mask {
- * @support_p2p_ps: information if station supports P2P PS mechanism
- * @he_capa: HE capabilities of station
- * @he_capa_len: the length of the HE capabilities
-+ * @airtime_weight: airtime scheduler weight for this station
- */
- struct station_parameters {
- const u8 *supported_rates;
-@@ -1032,6 +1033,7 @@ struct station_parameters {
- int support_p2p_ps;
- const struct ieee80211_he_cap_elem *he_capa;
- u8 he_capa_len;
-+ u16 airtime_weight;
- };
-
- /**
-@@ -1300,6 +1302,8 @@ struct cfg80211_tid_stats {
- * from this peer
- * @connected_to_gate: true if mesh STA has a path to mesh gate
- * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer
-+ * @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer
-+ * @airtime_weight: current airtime scheduling weight
- * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last
- * (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.
- * Note that this doesn't use the @filled bit, but is used if non-NULL.
-@@ -1350,8 +1354,9 @@ struct station_info {
-
- u32 expected_throughput;
-
-- u64 rx_beacon;
-+ u64 tx_duration;
- u64 rx_duration;
-+ u64 rx_beacon;
- u8 rx_beacon_signal_avg;
- u8 connected_to_gate;
-
-@@ -1361,6 +1366,8 @@ struct station_info {
-
- u32 rx_mpdu_count;
- u32 fcs_err_count;
-+
-+ u16 airtime_weight;
- };
-
- #if IS_ENABLED(CPTCFG_CFG80211)
-@@ -2391,6 +2398,8 @@ enum wiphy_params_flags {
- WIPHY_PARAM_TXQ_QUANTUM = 1 << 8,
- };
-
-+#define IEEE80211_DEFAULT_AIRTIME_WEIGHT 256
-+
- /**
- * struct cfg80211_pmksa - PMK Security Association
- *
---- a/include/uapi/linux/nl80211.h
-+++ b/include/uapi/linux/nl80211.h
-@@ -2299,6 +2299,9 @@ enum nl80211_commands {
- * This is also used for capability advertisement in the wiphy information,
- * with the appropriate sub-attributes.
- *
-+ * @NL80211_ATTR_AIRTIME_WEIGHT: Station's weight when scheduled by the airtime
-+ * scheduler.
-+ *
- * @NUM_NL80211_ATTR: total number of nl80211_attrs available
- * @NL80211_ATTR_MAX: highest attribute number currently defined
- * @__NL80211_ATTR_AFTER_LAST: internal use
-@@ -2748,6 +2751,8 @@ enum nl80211_attrs {
-
- NL80211_ATTR_PEER_MEASUREMENTS,
-
-+ NL80211_ATTR_AIRTIME_WEIGHT,
-+
- /* add attributes here, update the policy in nl80211.c */
-
- __NL80211_ATTR_AFTER_LAST,
-@@ -3125,6 +3130,9 @@ enum nl80211_sta_bss_param {
- * might not be fully accurate.
- * @NL80211_STA_INFO_CONNECTED_TO_GATE: set to true if STA has a path to a
- * mesh gate (u8, 0 or 1)
-+ * @NL80211_STA_INFO_TX_DURATION: aggregate PPDU duration for all frames
-+ * sent to the station (u64, usec)
-+ * @NL80211_STA_INFO_AIRTIME_WEIGHT: current airtime weight for station (u16)
- * @__NL80211_STA_INFO_AFTER_LAST: internal
- * @NL80211_STA_INFO_MAX: highest possible station info attribute
- */
-@@ -3169,6 +3177,9 @@ enum nl80211_sta_info {
- NL80211_STA_INFO_FCS_ERROR_COUNT,
- NL80211_STA_INFO_CONNECTED_TO_GATE,
-
-+ NL80211_STA_INFO_TX_DURATION,
-+ NL80211_STA_INFO_AIRTIME_WEIGHT,
-+
- /* keep last */
- __NL80211_STA_INFO_AFTER_LAST,
- NL80211_STA_INFO_MAX = __NL80211_STA_INFO_AFTER_LAST - 1
-@@ -5316,6 +5327,10 @@ enum nl80211_feature_flags {
- * if this flag is not set. Ignoring this can leak clear text packets and/or
- * freeze the connection.
- *
-+ * @NL80211_EXT_FEATURE_AIRTIME_FAIRNESS: Driver supports getting airtime
-+ * fairness for transmitted packets and has enabled airtime fairness
-+ * scheduling.
-+ *
- * @NUM_NL80211_EXT_FEATURES: number of extended features.
- * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
- */
-@@ -5356,6 +5371,8 @@ enum nl80211_ext_feature_index {
- NL80211_EXT_FEATURE_CAN_REPLACE_PTK0,
- NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER,
-
-+ NL80211_EXT_FEATURE_AIRTIME_FAIRNESS,
-+
- /* add new features before the definition below */
- NUM_NL80211_EXT_FEATURES,
- MAX_NL80211_EXT_FEATURES = NUM_NL80211_EXT_FEATURES - 1
---- a/net/wireless/nl80211.c
-+++ b/net/wireless/nl80211.c
-@@ -557,6 +557,7 @@ const struct nla_policy nl80211_policy[N
- [NL80211_ATTR_PEER_MEASUREMENTS] =
- NLA_POLICY_NESTED(NL80211_PMSR_ATTR_MAX,
- nl80211_pmsr_attr_policy),
-+ [NL80211_ATTR_AIRTIME_WEIGHT] = NLA_POLICY_MIN(NLA_U16, 1),
- };
-
- /* policy for the key attributes */
-@@ -4855,6 +4856,11 @@ static int nl80211_send_station(struct s
- PUT_SINFO(PLID, plid, u16);
- PUT_SINFO(PLINK_STATE, plink_state, u8);
- PUT_SINFO_U64(RX_DURATION, rx_duration);
-+ PUT_SINFO_U64(TX_DURATION, tx_duration);
-+
-+ if (wiphy_ext_feature_isset(&rdev->wiphy,
-+ NL80211_EXT_FEATURE_AIRTIME_FAIRNESS))
-+ PUT_SINFO(AIRTIME_WEIGHT, airtime_weight, u16);
-
- switch (rdev->wiphy.signal_type) {
- case CFG80211_SIGNAL_TYPE_MBM:
-@@ -5474,6 +5480,15 @@ static int nl80211_set_station(struct sk
- nla_get_u8(info->attrs[NL80211_ATTR_OPMODE_NOTIF]);
- }
-
-+ if (info->attrs[NL80211_ATTR_AIRTIME_WEIGHT])
-+ params.airtime_weight =
-+ nla_get_u16(info->attrs[NL80211_ATTR_AIRTIME_WEIGHT]);
-+
-+ if (params.airtime_weight &&
-+ !wiphy_ext_feature_isset(&rdev->wiphy,
-+ NL80211_EXT_FEATURE_AIRTIME_FAIRNESS))
-+ return -EOPNOTSUPP;
-+
- /* Include parameters for TDLS peer (will check later) */
- err = nl80211_set_station_tdls(info, ¶ms);
- if (err)
-@@ -5602,6 +5617,15 @@ static int nl80211_new_station(struct sk
- params.plink_action =
- nla_get_u8(info->attrs[NL80211_ATTR_STA_PLINK_ACTION]);
-
-+ if (info->attrs[NL80211_ATTR_AIRTIME_WEIGHT])
-+ params.airtime_weight =
-+ nla_get_u16(info->attrs[NL80211_ATTR_AIRTIME_WEIGHT]);
-+
-+ if (params.airtime_weight &&
-+ !wiphy_ext_feature_isset(&rdev->wiphy,
-+ NL80211_EXT_FEATURE_AIRTIME_FAIRNESS))
-+ return -EOPNOTSUPP;
-+
- err = nl80211_parse_sta_channel_info(info, ¶ms);
- if (err)
- return err;
+++ /dev/null
-From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= <toke@toke.dk>
-Date: Tue, 18 Dec 2018 17:02:08 -0800
-Subject: [PATCH] mac80211: Add airtime accounting and scheduling to TXQs
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This adds airtime accounting and scheduling to the mac80211 TXQ
-scheduler. A new callback, ieee80211_sta_register_airtime(), is added
-that drivers can call to report airtime usage for stations.
-
-When airtime information is present, mac80211 will schedule TXQs
-(through ieee80211_next_txq()) in a way that enforces airtime fairness
-between active stations. This scheduling works the same way as the ath9k
-in-driver airtime fairness scheduling. If no airtime usage is reported
-by the driver, the scheduler will default to round-robin scheduling.
-
-For drivers that don't control TXQ scheduling in software, a new API
-function, ieee80211_txq_may_transmit(), is added which the driver can use
-to check if the TXQ is eligible for transmission, or should be throttled to
-enforce fairness. Calls to this function must also be enclosed in
-ieee80211_txq_schedule_{start,end}() calls to ensure proper locking.
-
-The API ieee80211_txq_may_transmit() also ensures that TXQ list will be
-aligned aginst driver's own round-robin scheduler list. i.e it rotates
-the TXQ list till it makes the requested node becomes the first entry
-in TXQ list. Thus both the TXQ list and driver's list are in sync.
-
-Co-developed-by: Rajkumar Manoharan <rmanohar@codeaurora.org>
-Signed-off-by: Louie Lu <git@louie.lu>
-[added debugfs write op to reset airtime counter]
-Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
-Signed-off-by: Rajkumar Manoharan <rmanohar@codeaurora.org>
-Signed-off-by: Johannes Berg <johannes.berg@intel.com>
----
-
---- a/include/net/mac80211.h
-+++ b/include/net/mac80211.h
-@@ -2364,6 +2364,9 @@ enum ieee80211_hw_flags {
- * @tx_sk_pacing_shift: Pacing shift to set on TCP sockets when frames from
- * them are encountered. The default should typically not be changed,
- * unless the driver has good reasons for needing more buffers.
-+ *
-+ * @weight_multipler: Driver specific airtime weight multiplier used while
-+ * refilling deficit of each TXQ.
- */
- struct ieee80211_hw {
- struct ieee80211_conf conf;
-@@ -2400,6 +2403,7 @@ struct ieee80211_hw {
- const struct ieee80211_cipher_scheme *cipher_schemes;
- u8 max_nan_de_entries;
- u8 tx_sk_pacing_shift;
-+ u8 weight_multiplier;
- };
-
- static inline bool _ieee80211_hw_check(struct ieee80211_hw *hw,
-@@ -5412,6 +5416,34 @@ void ieee80211_sta_eosp(struct ieee80211
- void ieee80211_send_eosp_nullfunc(struct ieee80211_sta *pubsta, int tid);
-
- /**
-+ * ieee80211_sta_register_airtime - register airtime usage for a sta/tid
-+ *
-+ * Register airtime usage for a given sta on a given tid. The driver can call
-+ * this function to notify mac80211 that a station used a certain amount of
-+ * airtime. This information will be used by the TXQ scheduler to schedule
-+ * stations in a way that ensures airtime fairness.
-+ *
-+ * The reported airtime should as a minimum include all time that is spent
-+ * transmitting to the remote station, including overhead and padding, but not
-+ * including time spent waiting for a TXOP. If the time is not reported by the
-+ * hardware it can in some cases be calculated from the rate and known frame
-+ * composition. When possible, the time should include any failed transmission
-+ * attempts.
-+ *
-+ * The driver can either call this function synchronously for every packet or
-+ * aggregate, or asynchronously as airtime usage information becomes available.
-+ * TX and RX airtime can be reported together, or separately by setting one of
-+ * them to 0.
-+ *
-+ * @pubsta: the station
-+ * @tid: the TID to register airtime for
-+ * @tx_airtime: airtime used during TX (in usec)
-+ * @rx_airtime: airtime used during RX (in usec)
-+ */
-+void ieee80211_sta_register_airtime(struct ieee80211_sta *pubsta, u8 tid,
-+ u32 tx_airtime, u32 rx_airtime);
-+
-+/**
- * ieee80211_iter_keys - iterate keys programmed into the device
- * @hw: pointer obtained from ieee80211_alloc_hw()
- * @vif: virtual interface to iterate, may be %NULL for all
-@@ -6178,6 +6210,33 @@ void ieee80211_txq_schedule_end(struct i
- __releases(txq_lock);
-
- /**
-+ * ieee80211_txq_may_transmit - check whether TXQ is allowed to transmit
-+ *
-+ * This function is used to check whether given txq is allowed to transmit by
-+ * the airtime scheduler, and can be used by drivers to access the airtime
-+ * fairness accounting without going using the scheduling order enfored by
-+ * next_txq().
-+ *
-+ * Returns %true if the airtime scheduler thinks the TXQ should be allowed to
-+ * transmit, and %false if it should be throttled. This function can also have
-+ * the side effect of rotating the TXQ in the scheduler rotation, which will
-+ * eventually bring the deficit to positive and allow the station to transmit
-+ * again.
-+ *
-+ * The API ieee80211_txq_may_transmit() also ensures that TXQ list will be
-+ * aligned aginst driver's own round-robin scheduler list. i.e it rotates
-+ * the TXQ list till it makes the requested node becomes the first entry
-+ * in TXQ list. Thus both the TXQ list and driver's list are in sync. If this
-+ * function returns %true, the driver is expected to schedule packets
-+ * for transmission, and then return the TXQ through ieee80211_return_txq().
-+ *
-+ * @hw: pointer as obtained from ieee80211_alloc_hw()
-+ * @txq: pointer obtained from station or virtual interface
-+ */
-+bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw,
-+ struct ieee80211_txq *txq);
-+
-+/**
- * ieee80211_txq_get_depth - get pending frame/byte count of given txq
- *
- * The values are not guaranteed to be coherent with regard to each other, i.e.
---- a/net/mac80211/cfg.c
-+++ b/net/mac80211/cfg.c
-@@ -1450,6 +1450,9 @@ static int sta_apply_parameters(struct i
- if (ieee80211_vif_is_mesh(&sdata->vif))
- sta_apply_mesh_params(local, sta, params);
-
-+ if (params->airtime_weight)
-+ sta->airtime_weight = params->airtime_weight;
-+
- /* set the STA state after all sta info from usermode has been set */
- if (test_sta_flag(sta, WLAN_STA_TDLS_PEER) ||
- set & BIT(NL80211_STA_FLAG_ASSOCIATED)) {
---- a/net/mac80211/debugfs.c
-+++ b/net/mac80211/debugfs.c
-@@ -384,6 +384,9 @@ void debugfs_hw_add(struct ieee80211_loc
- if (local->ops->wake_tx_queue)
- DEBUGFS_ADD_MODE(aqm, 0600);
-
-+ debugfs_create_u16("airtime_flags", 0600,
-+ phyd, &local->airtime_flags);
-+
- statsd = debugfs_create_dir("statistics", phyd);
-
- /* if the dir failed, don't put all the other things into the root! */
---- a/net/mac80211/debugfs_sta.c
-+++ b/net/mac80211/debugfs_sta.c
-@@ -181,9 +181,9 @@ static ssize_t sta_aqm_read(struct file
- txqi->tin.tx_bytes,
- txqi->tin.tx_packets,
- txqi->flags,
-- txqi->flags & (1<<IEEE80211_TXQ_STOP) ? "STOP" : "RUN",
-- txqi->flags & (1<<IEEE80211_TXQ_AMPDU) ? " AMPDU" : "",
-- txqi->flags & (1<<IEEE80211_TXQ_NO_AMSDU) ? " NO-AMSDU" : "");
-+ test_bit(IEEE80211_TXQ_STOP, &txqi->flags) ? "STOP" : "RUN",
-+ test_bit(IEEE80211_TXQ_AMPDU, &txqi->flags) ? " AMPDU" : "",
-+ test_bit(IEEE80211_TXQ_NO_AMSDU, &txqi->flags) ? " NO-AMSDU" : "");
- }
-
- rcu_read_unlock();
-@@ -195,6 +195,64 @@ static ssize_t sta_aqm_read(struct file
- }
- STA_OPS(aqm);
-
-+static ssize_t sta_airtime_read(struct file *file, char __user *userbuf,
-+ size_t count, loff_t *ppos)
-+{
-+ struct sta_info *sta = file->private_data;
-+ struct ieee80211_local *local = sta->sdata->local;
-+ size_t bufsz = 200;
-+ char *buf = kzalloc(bufsz, GFP_KERNEL), *p = buf;
-+ u64 rx_airtime = 0, tx_airtime = 0;
-+ s64 deficit[IEEE80211_NUM_ACS];
-+ ssize_t rv;
-+ int ac;
-+
-+ if (!buf)
-+ return -ENOMEM;
-+
-+ for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
-+ spin_lock_bh(&local->active_txq_lock[ac]);
-+ rx_airtime += sta->airtime[ac].rx_airtime;
-+ tx_airtime += sta->airtime[ac].tx_airtime;
-+ deficit[ac] = sta->airtime[ac].deficit;
-+ spin_unlock_bh(&local->active_txq_lock[ac]);
-+ }
-+
-+ p += scnprintf(p, bufsz + buf - p,
-+ "RX: %llu us\nTX: %llu us\nWeight: %u\n"
-+ "Deficit: VO: %lld us VI: %lld us BE: %lld us BK: %lld us\n",
-+ rx_airtime,
-+ tx_airtime,
-+ sta->airtime_weight,
-+ deficit[0],
-+ deficit[1],
-+ deficit[2],
-+ deficit[3]);
-+
-+ rv = simple_read_from_buffer(userbuf, count, ppos, buf, p - buf);
-+ kfree(buf);
-+ return rv;
-+}
-+
-+static ssize_t sta_airtime_write(struct file *file, const char __user *userbuf,
-+ size_t count, loff_t *ppos)
-+{
-+ struct sta_info *sta = file->private_data;
-+ struct ieee80211_local *local = sta->sdata->local;
-+ int ac;
-+
-+ for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
-+ spin_lock_bh(&local->active_txq_lock[ac]);
-+ sta->airtime[ac].rx_airtime = 0;
-+ sta->airtime[ac].tx_airtime = 0;
-+ sta->airtime[ac].deficit = sta->airtime_weight;
-+ spin_unlock_bh(&local->active_txq_lock[ac]);
-+ }
-+
-+ return count;
-+}
-+STA_OPS_RW(airtime);
-+
- static ssize_t sta_agg_status_read(struct file *file, char __user *userbuf,
- size_t count, loff_t *ppos)
- {
-@@ -906,6 +964,10 @@ void ieee80211_sta_debugfs_add(struct st
- if (local->ops->wake_tx_queue)
- DEBUGFS_ADD(aqm);
-
-+ if (wiphy_ext_feature_isset(local->hw.wiphy,
-+ NL80211_EXT_FEATURE_AIRTIME_FAIRNESS))
-+ DEBUGFS_ADD(airtime);
-+
- if (sizeof(sta->driver_buffered_tids) == sizeof(u32))
- debugfs_create_x32("driver_buffered_tids", 0400,
- sta->debugfs_dir,
---- a/net/mac80211/ieee80211_i.h
-+++ b/net/mac80211/ieee80211_i.h
-@@ -1138,6 +1138,8 @@ struct ieee80211_local {
- struct list_head active_txqs[IEEE80211_NUM_ACS];
- u16 schedule_round[IEEE80211_NUM_ACS];
-
-+ u16 airtime_flags;
-+
- const struct ieee80211_ops *ops;
-
- /*
---- a/net/mac80211/main.c
-+++ b/net/mac80211/main.c
-@@ -669,6 +669,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
- INIT_LIST_HEAD(&local->active_txqs[i]);
- spin_lock_init(&local->active_txq_lock[i]);
- }
-+ local->airtime_flags = AIRTIME_USE_TX | AIRTIME_USE_RX;
-
- INIT_LIST_HEAD(&local->chanctx_list);
- mutex_init(&local->chanctx_mtx);
-@@ -1155,6 +1156,9 @@ int ieee80211_register_hw(struct ieee802
- if (!local->hw.max_nan_de_entries)
- local->hw.max_nan_de_entries = IEEE80211_MAX_NAN_INSTANCE_ID;
-
-+ if (!local->hw.weight_multiplier)
-+ local->hw.weight_multiplier = 1;
-+
- result = ieee80211_wep_init(local);
- if (result < 0)
- wiphy_debug(local->hw.wiphy, "Failed to initialize wep: %d\n",
---- a/net/mac80211/sta_info.c
-+++ b/net/mac80211/sta_info.c
-@@ -90,7 +90,6 @@ static void __cleanup_single_sta(struct
- struct tid_ampdu_tx *tid_tx;
- struct ieee80211_sub_if_data *sdata = sta->sdata;
- struct ieee80211_local *local = sdata->local;
-- struct fq *fq = &local->fq;
- struct ps_data *ps;
-
- if (test_sta_flag(sta, WLAN_STA_PS_STA) ||
-@@ -120,9 +119,7 @@ static void __cleanup_single_sta(struct
-
- txqi = to_txq_info(sta->sta.txq[i]);
-
-- spin_lock_bh(&fq->lock);
- ieee80211_txq_purge(local, txqi);
-- spin_unlock_bh(&fq->lock);
- }
- }
-
-@@ -387,9 +384,12 @@ struct sta_info *sta_info_alloc(struct i
- if (sta_prepare_rate_control(local, sta, gfp))
- goto free_txq;
-
-+ sta->airtime_weight = IEEE80211_DEFAULT_AIRTIME_WEIGHT;
-+
- for (i = 0; i < IEEE80211_NUM_ACS; i++) {
- skb_queue_head_init(&sta->ps_tx_buf[i]);
- skb_queue_head_init(&sta->tx_filtered[i]);
-+ sta->airtime[i].deficit = sta->airtime_weight;
- }
-
- for (i = 0; i < IEEE80211_NUM_TIDS; i++)
-@@ -1826,6 +1826,27 @@ void ieee80211_sta_set_buffered(struct i
- }
- EXPORT_SYMBOL(ieee80211_sta_set_buffered);
-
-+void ieee80211_sta_register_airtime(struct ieee80211_sta *pubsta, u8 tid,
-+ u32 tx_airtime, u32 rx_airtime)
-+{
-+ struct sta_info *sta = container_of(pubsta, struct sta_info, sta);
-+ struct ieee80211_local *local = sta->sdata->local;
-+ u8 ac = ieee80211_ac_from_tid(tid);
-+ u32 airtime = 0;
-+
-+ if (sta->local->airtime_flags & AIRTIME_USE_TX)
-+ airtime += tx_airtime;
-+ if (sta->local->airtime_flags & AIRTIME_USE_RX)
-+ airtime += rx_airtime;
-+
-+ spin_lock_bh(&local->active_txq_lock[ac]);
-+ sta->airtime[ac].tx_airtime += tx_airtime;
-+ sta->airtime[ac].rx_airtime += rx_airtime;
-+ sta->airtime[ac].deficit -= airtime;
-+ spin_unlock_bh(&local->active_txq_lock[ac]);
-+}
-+EXPORT_SYMBOL(ieee80211_sta_register_airtime);
-+
- int sta_info_move_state(struct sta_info *sta,
- enum ieee80211_sta_state new_state)
- {
-@@ -2188,6 +2209,23 @@ void sta_set_sinfo(struct sta_info *sta,
- sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_FAILED);
- }
-
-+ if (!(sinfo->filled & BIT_ULL(NL80211_STA_INFO_RX_DURATION))) {
-+ for (ac = 0; ac < IEEE80211_NUM_ACS; ac++)
-+ sinfo->rx_duration += sta->airtime[ac].rx_airtime;
-+ sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_DURATION);
-+ }
-+
-+ if (!(sinfo->filled & BIT_ULL(NL80211_STA_INFO_TX_DURATION))) {
-+ for (ac = 0; ac < IEEE80211_NUM_ACS; ac++)
-+ sinfo->tx_duration += sta->airtime[ac].tx_airtime;
-+ sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_DURATION);
-+ }
-+
-+ if (!(sinfo->filled & BIT_ULL(NL80211_STA_INFO_AIRTIME_WEIGHT))) {
-+ sinfo->airtime_weight = sta->airtime_weight;
-+ sinfo->filled |= BIT_ULL(NL80211_STA_INFO_AIRTIME_WEIGHT);
-+ }
-+
- sinfo->rx_dropped_misc = sta->rx_stats.dropped;
- if (sta->pcpu_rx_stats) {
- for_each_possible_cpu(cpu) {
---- a/net/mac80211/sta_info.h
-+++ b/net/mac80211/sta_info.h
-@@ -127,6 +127,16 @@ enum ieee80211_agg_stop_reason {
- AGG_STOP_DESTROY_STA,
- };
-
-+/* Debugfs flags to enable/disable use of RX/TX airtime in scheduler */
-+#define AIRTIME_USE_TX BIT(0)
-+#define AIRTIME_USE_RX BIT(1)
-+
-+struct airtime_info {
-+ u64 rx_airtime;
-+ u64 tx_airtime;
-+ s64 deficit;
-+};
-+
- struct sta_info;
-
- /**
-@@ -565,6 +575,9 @@ struct sta_info {
- } tx_stats;
- u16 tid_seq[IEEE80211_QOS_CTL_TID_MASK + 1];
-
-+ struct airtime_info airtime[IEEE80211_NUM_ACS];
-+ u16 airtime_weight;
-+
- /*
- * Aggregation information, locked with lock.
- */
---- a/net/mac80211/status.c
-+++ b/net/mac80211/status.c
-@@ -825,6 +825,12 @@ static void __ieee80211_tx_status(struct
- ieee80211_sta_tx_notify(sta->sdata, (void *) skb->data,
- acked, info->status.tx_time);
-
-+ if (info->status.tx_time &&
-+ wiphy_ext_feature_isset(local->hw.wiphy,
-+ NL80211_EXT_FEATURE_AIRTIME_FAIRNESS))
-+ ieee80211_sta_register_airtime(&sta->sta, tid,
-+ info->status.tx_time, 0);
-+
- if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) {
- if (info->flags & IEEE80211_TX_STAT_ACK) {
- if (sta->status_stats.lost_packets)
---- a/net/mac80211/tx.c
-+++ b/net/mac80211/tx.c
-@@ -1488,8 +1488,11 @@ void ieee80211_txq_purge(struct ieee8021
- struct fq *fq = &local->fq;
- struct fq_tin *tin = &txqi->tin;
-
-+ spin_lock_bh(&fq->lock);
- fq_tin_reset(fq, tin, fq_skb_free_func);
- ieee80211_purge_tx_queue(&local->hw, &txqi->frags);
-+ spin_unlock_bh(&fq->lock);
-+
- spin_lock_bh(&local->active_txq_lock[txqi->txq.ac]);
- list_del_init(&txqi->schedule_order);
- spin_unlock_bh(&local->active_txq_lock[txqi->txq.ac]);
-@@ -3652,11 +3655,28 @@ struct ieee80211_txq *ieee80211_next_txq
-
- lockdep_assert_held(&local->active_txq_lock[ac]);
-
-+ begin:
- txqi = list_first_entry_or_null(&local->active_txqs[ac],
- struct txq_info,
- schedule_order);
-+ if (!txqi)
-+ return NULL;
-+
-+ if (txqi->txq.sta) {
-+ struct sta_info *sta = container_of(txqi->txq.sta,
-+ struct sta_info, sta);
-+
-+ if (sta->airtime[txqi->txq.ac].deficit < 0) {
-+ sta->airtime[txqi->txq.ac].deficit +=
-+ sta->airtime_weight;
-+ list_move_tail(&txqi->schedule_order,
-+ &local->active_txqs[txqi->txq.ac]);
-+ goto begin;
-+ }
-+ }
-+
-
-- if (!txqi || txqi->schedule_round == local->schedule_round[ac])
-+ if (txqi->schedule_round == local->schedule_round[ac])
- return NULL;
-
- list_del_init(&txqi->schedule_order);
-@@ -3674,12 +3694,74 @@ void ieee80211_return_txq(struct ieee802
- lockdep_assert_held(&local->active_txq_lock[txq->ac]);
-
- if (list_empty(&txqi->schedule_order) &&
-- (!skb_queue_empty(&txqi->frags) || txqi->tin.backlog_packets))
-- list_add_tail(&txqi->schedule_order,
-- &local->active_txqs[txq->ac]);
-+ (!skb_queue_empty(&txqi->frags) || txqi->tin.backlog_packets)) {
-+ /* If airtime accounting is active, always enqueue STAs at the
-+ * head of the list to ensure that they only get moved to the
-+ * back by the airtime DRR scheduler once they have a negative
-+ * deficit. A station that already has a negative deficit will
-+ * get immediately moved to the back of the list on the next
-+ * call to ieee80211_next_txq().
-+ */
-+ if (txqi->txq.sta &&
-+ wiphy_ext_feature_isset(local->hw.wiphy,
-+ NL80211_EXT_FEATURE_AIRTIME_FAIRNESS))
-+ list_add(&txqi->schedule_order,
-+ &local->active_txqs[txq->ac]);
-+ else
-+ list_add_tail(&txqi->schedule_order,
-+ &local->active_txqs[txq->ac]);
-+ }
- }
- EXPORT_SYMBOL(ieee80211_return_txq);
-
-+bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw,
-+ struct ieee80211_txq *txq)
-+{
-+ struct ieee80211_local *local = hw_to_local(hw);
-+ struct txq_info *iter, *tmp, *txqi = to_txq_info(txq);
-+ struct sta_info *sta;
-+ u8 ac = txq->ac;
-+
-+ lockdep_assert_held(&local->active_txq_lock[ac]);
-+
-+ if (!txqi->txq.sta)
-+ goto out;
-+
-+ if (list_empty(&txqi->schedule_order))
-+ goto out;
-+
-+ list_for_each_entry_safe(iter, tmp, &local->active_txqs[ac],
-+ schedule_order) {
-+ if (iter == txqi)
-+ break;
-+
-+ if (!iter->txq.sta) {
-+ list_move_tail(&iter->schedule_order,
-+ &local->active_txqs[ac]);
-+ continue;
-+ }
-+ sta = container_of(iter->txq.sta, struct sta_info, sta);
-+ if (sta->airtime[ac].deficit < 0)
-+ sta->airtime[ac].deficit += sta->airtime_weight;
-+ list_move_tail(&iter->schedule_order, &local->active_txqs[ac]);
-+ }
-+
-+ sta = container_of(txqi->txq.sta, struct sta_info, sta);
-+ if (sta->airtime[ac].deficit >= 0)
-+ goto out;
-+
-+ sta->airtime[ac].deficit += sta->airtime_weight;
-+ list_move_tail(&txqi->schedule_order, &local->active_txqs[ac]);
-+
-+ return false;
-+out:
-+ if (!list_empty(&txqi->schedule_order))
-+ list_del_init(&txqi->schedule_order);
-+
-+ return true;
-+}
-+EXPORT_SYMBOL(ieee80211_txq_may_transmit);
-+
- void ieee80211_txq_schedule_start(struct ieee80211_hw *hw, u8 ac)
- __acquires(txq_lock)
- {
+++ /dev/null
-From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= <toke@redhat.com>
-Date: Tue, 22 Jan 2019 15:20:16 +0100
-Subject: [PATCH] mac80211: Expose ieee80211_schedule_txq() function
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Since we reworked ieee80211_return_txq() so it assumes that the caller
-takes care of logging, we need another function that can be called without
-holding any locks. Introduce ieee80211_schedule_txq() which serves this
-purpose.
-
-Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
-Signed-off-by: Johannes Berg <johannes.berg@intel.com>
----
-
---- a/include/net/mac80211.h
-+++ b/include/net/mac80211.h
-@@ -6210,6 +6210,19 @@ void ieee80211_txq_schedule_end(struct i
- __releases(txq_lock);
-
- /**
-+ * ieee80211_schedule_txq - schedule a TXQ for transmission
-+ *
-+ * @hw: pointer as obtained from ieee80211_alloc_hw()
-+ * @txq: pointer obtained from station or virtual interface
-+ *
-+ * Schedules a TXQ for transmission if it is not already scheduled. Takes a
-+ * lock, which means it must *not* be called between
-+ * ieee80211_txq_schedule_start() and ieee80211_txq_schedule_end()
-+ */
-+void ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq)
-+ __acquires(txq_lock) __releases(txq_lock);
-+
-+/**
- * ieee80211_txq_may_transmit - check whether TXQ is allowed to transmit
- *
- * This function is used to check whether given txq is allowed to transmit by
---- a/net/mac80211/driver-ops.h
-+++ b/net/mac80211/driver-ops.h
-@@ -1239,9 +1239,7 @@ static inline void drv_abort_pmsr(struct
- static inline void schedule_and_wake_txq(struct ieee80211_local *local,
- struct txq_info *txqi)
- {
-- spin_lock_bh(&local->active_txq_lock[txqi->txq.ac]);
-- ieee80211_return_txq(&local->hw, &txqi->txq);
-- spin_unlock_bh(&local->active_txq_lock[txqi->txq.ac]);
-+ ieee80211_schedule_txq(&local->hw, &txqi->txq);
- drv_wake_tx_queue(local, txqi);
- }
-
---- a/net/mac80211/tx.c
-+++ b/net/mac80211/tx.c
-@@ -3714,6 +3714,19 @@ void ieee80211_return_txq(struct ieee802
- }
- EXPORT_SYMBOL(ieee80211_return_txq);
-
-+void ieee80211_schedule_txq(struct ieee80211_hw *hw,
-+ struct ieee80211_txq *txq)
-+ __acquires(txq_lock) __releases(txq_lock)
-+{
-+ struct ieee80211_local *local = hw_to_local(hw);
-+ struct txq_info *txqi = to_txq_info(txq);
-+
-+ spin_lock_bh(&local->active_txq_lock[txq->ac]);
-+ ieee80211_return_txq(hw, txq);
-+ spin_unlock_bh(&local->active_txq_lock[txq->ac]);
-+}
-+EXPORT_SYMBOL(ieee80211_schedule_txq);
-+
- bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw,
- struct ieee80211_txq *txq)
- {
ieee80211_xmit_fast_finish(sta->sdata, sta, pn_offs,
tx.key, skb);
-@@ -4041,6 +4042,7 @@ ieee80211_build_data_template(struct iee
+@@ -4040,6 +4041,7 @@ ieee80211_build_data_template(struct iee
hdr = (void *)skb->data;
tx.sta = sta_info_get(sdata, hdr->addr1);
tx.skb = skb;
rcu_read_unlock();
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
-@@ -1416,6 +1416,7 @@ void ieee80211_send_auth(struct ieee8021
+@@ -1503,6 +1503,7 @@ void ieee80211_send_auth(struct ieee8021
struct ieee80211_local *local = sdata->local;
struct sk_buff *skb;
struct ieee80211_mgmt *mgmt;
int err;
/* 24 + 6 = header + auth_algo + auth_transaction + status_code */
-@@ -1439,8 +1440,10 @@ void ieee80211_send_auth(struct ieee8021
+@@ -1526,8 +1527,10 @@ void ieee80211_send_auth(struct ieee8021
skb_put_data(skb, extra, extra_len);
if (auth_alg == WLAN_AUTH_SHARED_KEY && transaction == 3) {
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
-@@ -2193,6 +2193,9 @@ struct ieee80211_txq {
- * @IEEE80211_HW_TX_STATUS_NO_AMPDU_LEN: Driver does not report accurate A-MPDU
- * length in tx status information
+@@ -2243,6 +2243,9 @@ struct ieee80211_txq {
+ * @IEEE80211_HW_SUPPORTS_ONLY_HE_MULTI_BSSID: Hardware supports multi BSSID
+ * only for HE APs. Applies if @IEEE80211_HW_SUPPORTS_MULTI_BSSID is set.
*
+ * @IEEE80211_HW_TX_NEEDS_ALIGNED4_SKBS: Driver need aligned skbs to four-byte.
+ * Padding will be added after ieee80211_hdr, before IV/LLC.
* @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
*/
enum ieee80211_hw_flags {
-@@ -2242,6 +2245,7 @@ enum ieee80211_hw_flags {
- IEEE80211_HW_SUPPORTS_VHT_EXT_NSS_BW,
- IEEE80211_HW_STA_MMPDU_TXQ,
+@@ -2294,6 +2297,7 @@ enum ieee80211_hw_flags {
IEEE80211_HW_TX_STATUS_NO_AMPDU_LEN,
+ IEEE80211_HW_SUPPORTS_MULTI_BSSID,
+ IEEE80211_HW_SUPPORTS_ONLY_HE_MULTI_BSSID,
+ IEEE80211_HW_TX_NEEDS_ALIGNED4_SKBS,
/* keep last, obviously */
NUM_IEEE80211_HW_FLAGS
-@@ -2533,6 +2537,40 @@ ieee80211_get_alt_retry_rate(const struc
+@@ -2587,6 +2591,40 @@ ieee80211_get_alt_retry_rate(const struc
void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb);
/**
if (!(mshdr->flags & MESH_FLAGS_AE)) {
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
-@@ -2643,7 +2643,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
+@@ -2660,7 +2660,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
struct ieee80211_local *local = rx->local;
struct ieee80211_sub_if_data *sdata = rx->sdata;
struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
int tailroom = 0;
hdr = (struct ieee80211_hdr *) skb->data;
-@@ -2736,7 +2736,9 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
+@@ -2753,7 +2753,9 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
if (sdata->crypto_tx_tailroom_needed_cnt)
tailroom = IEEE80211_ENCRYPT_TAILROOM;
sdata->encrypt_headroom,
tailroom, GFP_ATOMIC);
if (!fwd_skb)
-@@ -2768,6 +2770,12 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
+@@ -2785,6 +2787,12 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
return RX_DROP_MONITOR;
}
if (txq->sta)
tx.sta = container_of(txq->sta, struct sta_info, sta);
-@@ -4042,7 +4048,7 @@ ieee80211_build_data_template(struct iee
+@@ -4041,7 +4047,7 @@ ieee80211_build_data_template(struct iee
hdr = (void *)skb->data;
tx.sta = sta_info_get(sdata, hdr->addr1);
tx.skb = skb;
rcu_read_unlock();
--- a/net/mac80211/debugfs.c
+++ b/net/mac80211/debugfs.c
-@@ -219,6 +219,7 @@ static const char *hw_flag_names[] = {
- FLAG(SUPPORTS_VHT_EXT_NSS_BW),
- FLAG(STA_MMPDU_TXQ),
+@@ -221,6 +221,7 @@ static const char *hw_flag_names[] = {
FLAG(TX_STATUS_NO_AMPDU_LEN),
+ FLAG(SUPPORTS_MULTI_BSSID),
+ FLAG(SUPPORTS_ONLY_HE_MULTI_BSSID),
+ FLAG(TX_NEEDS_ALIGNED4_SKBS),
#undef FLAG
};
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
-@@ -6205,8 +6205,6 @@ struct sk_buff *ieee80211_tx_dequeue(str
+@@ -6269,8 +6269,6 @@ struct sk_buff *ieee80211_tx_dequeue(str
* @hw: pointer as obtained from ieee80211_alloc_hw()
* @ac: AC number to return packets from.
*
* Returns the next txq if successful, %NULL if no queue is eligible. If a txq
* is returned, it should be returned with ieee80211_return_txq() after the
* driver has finished scheduling it.
-@@ -6214,51 +6212,41 @@ struct sk_buff *ieee80211_tx_dequeue(str
+@@ -6278,51 +6276,41 @@ struct sk_buff *ieee80211_tx_dequeue(str
struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, u8 ac);
/**
if (list_empty(&txqi->schedule_order) &&
(!skb_queue_empty(&txqi->frags) || txqi->tin.backlog_packets)) {
-@@ -3718,18 +3723,7 @@ void ieee80211_return_txq(struct ieee802
+@@ -3718,17 +3723,7 @@ void ieee80211_return_txq(struct ieee802
list_add_tail(&txqi->schedule_order,
&local->active_txqs[txq->ac]);
}
-}
-EXPORT_SYMBOL(ieee80211_return_txq);
-
+-
-void ieee80211_schedule_txq(struct ieee80211_hw *hw,
- struct ieee80211_txq *txq)
- __acquires(txq_lock) __releases(txq_lock)
-{
- struct ieee80211_local *local = hw_to_local(hw);
-- struct txq_info *txqi = to_txq_info(txq);
--
+
- spin_lock_bh(&local->active_txq_lock[txq->ac]);
- ieee80211_return_txq(hw, txq);
spin_unlock_bh(&local->active_txq_lock[txq->ac]);
}
EXPORT_SYMBOL(ieee80211_schedule_txq);
-@@ -3742,7 +3736,7 @@ bool ieee80211_txq_may_transmit(struct i
+@@ -3741,7 +3736,7 @@ bool ieee80211_txq_may_transmit(struct i
struct sta_info *sta;
u8 ac = txq->ac;
if (!txqi->txq.sta)
goto out;
-@@ -3772,34 +3766,27 @@ bool ieee80211_txq_may_transmit(struct i
+@@ -3771,34 +3766,27 @@ bool ieee80211_txq_may_transmit(struct i
sta->airtime[ac].deficit += sta->airtime_weight;
list_move_tail(&txqi->schedule_order, &local->active_txqs[ac]);
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
-@@ -1112,16 +1112,13 @@ int mesh_nexthop_resolve(struct ieee8021
+@@ -1130,16 +1130,13 @@ int mesh_nexthop_resolve(struct ieee8021
struct mesh_path *mpath;
struct sk_buff *skb_to_free = NULL;
u8 *target_addr = hdr->addr3;
/* no nexthop found, start resolving */
mpath = mesh_path_lookup(sdata, target_addr);
-@@ -1129,8 +1126,7 @@ int mesh_nexthop_resolve(struct ieee8021
+@@ -1147,8 +1144,7 @@ int mesh_nexthop_resolve(struct ieee8021
mpath = mesh_path_add(sdata, target_addr);
if (IS_ERR(mpath)) {
mesh_path_discard_frame(sdata, skb);
}
}
-@@ -1143,13 +1139,10 @@ int mesh_nexthop_resolve(struct ieee8021
+@@ -1161,13 +1157,10 @@ int mesh_nexthop_resolve(struct ieee8021
info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING;
ieee80211_set_qos_hdr(sdata, skb);
skb_queue_tail(&mpath->frame_queue, skb);
}
/**
-@@ -1169,13 +1162,10 @@ int mesh_nexthop_lookup(struct ieee80211
+@@ -1187,13 +1180,10 @@ int mesh_nexthop_lookup(struct ieee80211
struct sta_info *next_hop;
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
u8 *target_addr = hdr->addr3;
if (time_after(jiffies,
mpath->exp_time -
-@@ -1190,12 +1180,10 @@ int mesh_nexthop_lookup(struct ieee80211
+@@ -1208,12 +1198,10 @@ int mesh_nexthop_lookup(struct ieee80211
memcpy(hdr->addr1, next_hop->sta.addr, ETH_ALEN);
memcpy(hdr->addr2, sdata->vif.addr, ETH_ALEN);
ieee80211_mps_set_frame_flags(sdata, next_hop, hdr);
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
-@@ -1766,6 +1766,9 @@ void ieee80211_clear_fast_xmit(struct st
+@@ -1780,6 +1780,9 @@ void ieee80211_clear_fast_xmit(struct st
int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev,
const u8 *buf, size_t len,
const u8 *dest, __be16 proto, bool unencrypted);
Fixes: 89cea7493a346 ("ath9k: Switch to mac80211 TXQ scheduling and airtime APIs")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
+Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
---
+ drivers/net/wireless/ath/ath10k/htt_rx.c | 2 +-
+ drivers/net/wireless/ath/ath10k/mac.c | 4 ++--
+ drivers/net/wireless/ath/ath9k/xmit.c | 5 ++++-
+ include/net/mac80211.h | 24 ++++++++++++++++++++----
+ net/mac80211/tx.c | 10 ++++++----
+ 5 files changed, 33 insertions(+), 12 deletions(-)
+--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
++++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
+@@ -2728,7 +2728,7 @@ static void ath10k_htt_rx_tx_fetch_ind(s
+ num_msdus++;
+ num_bytes += ret;
+ }
+- ieee80211_return_txq(hw, txq);
++ ieee80211_return_txq(hw, txq, false);
+ ieee80211_txq_schedule_end(hw, txq->ac);
+
+ record->num_msdus = cpu_to_le16(num_msdus);
+--- a/drivers/net/wireless/ath/ath10k/mac.c
++++ b/drivers/net/wireless/ath/ath10k/mac.c
+@@ -4089,7 +4089,7 @@ static int ath10k_mac_schedule_txq(struc
+ if (ret < 0)
+ break;
+ }
+- ieee80211_return_txq(hw, txq);
++ ieee80211_return_txq(hw, txq, false);
+ ath10k_htt_tx_txq_update(hw, txq);
+ if (ret == -EBUSY)
+ break;
+@@ -4374,7 +4374,7 @@ static void ath10k_mac_op_wake_tx_queue(
+ if (ret < 0)
+ break;
+ }
+- ieee80211_return_txq(hw, txq);
++ ieee80211_return_txq(hw, txq, false);
+ ath10k_htt_tx_txq_update(hw, txq);
+ out:
+ ieee80211_txq_schedule_end(hw, ac);
+--- a/drivers/net/wireless/ath/ath9k/xmit.c
++++ b/drivers/net/wireless/ath/ath9k/xmit.c
+@@ -1938,12 +1938,15 @@ void ath_txq_schedule(struct ath_softc *
+ goto out;
+
+ while ((queue = ieee80211_next_txq(hw, txq->mac80211_qnum))) {
++ bool force;
++
+ tid = (struct ath_atx_tid *)queue->drv_priv;
+
+ ret = ath_tx_sched_aggr(sc, txq, tid);
+ ath_dbg(common, QUEUE, "ath_tx_sched_aggr returned %d\n", ret);
+
+- ieee80211_return_txq(hw, queue);
++ force = !skb_queue_empty(&tid->retry_q);
++ ieee80211_return_txq(hw, queue, force);
+ }
+
+ out:
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
-@@ -6226,26 +6226,42 @@ static inline void ieee80211_txq_schedul
+@@ -6290,26 +6290,42 @@ static inline void ieee80211_txq_schedul
{
}
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
-@@ -1551,7 +1551,15 @@ static void sta_ps_start(struct sta_info
+@@ -1568,7 +1568,15 @@ static void sta_ps_start(struct sta_info
return;
for (tid = 0; tid < IEEE80211_NUM_TIDS; tid++) {
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
-@@ -3719,7 +3719,8 @@ struct cfg80211_ops {
+@@ -3767,7 +3767,8 @@ struct cfg80211_ops {
* on wiphy_new(), but can be changed by the driver if it has a good
* reason to override the default
* @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station
* control port protocol ethertype. The device also honours the
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
-@@ -3673,7 +3673,9 @@ int ieee80211_check_combinations(struct
+@@ -3760,7 +3760,9 @@ int ieee80211_check_combinations(struct
}
/* Always allow software iftypes */
break;
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
-@@ -3395,8 +3395,7 @@ static int nl80211_new_interface(struct
+@@ -3387,8 +3387,7 @@ static int nl80211_new_interface(struct
if (info->attrs[NL80211_ATTR_IFTYPE])
type = nla_get_u32(info->attrs[NL80211_ATTR_IFTYPE]);
return -EOPNOTSUPP;
if ((type == NL80211_IFTYPE_P2P_DEVICE || type == NL80211_IFTYPE_NAN ||
-@@ -3415,6 +3414,11 @@ static int nl80211_new_interface(struct
+@@ -3407,6 +3406,11 @@ static int nl80211_new_interface(struct
return err;
}
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
-@@ -3216,6 +3216,7 @@ struct cfg80211_pmsr_request {
+@@ -3264,6 +3264,7 @@ struct cfg80211_pmsr_request {
* (as advertised by the nl80211 feature flag.)
* @get_tx_power: store the current TX power into the dbm variable;
* return 0 if successful
*
* @set_wds_peer: set the WDS peer for a WDS interface
*
-@@ -3521,6 +3522,7 @@ struct cfg80211_ops {
+@@ -3569,6 +3570,7 @@ struct cfg80211_ops {
enum nl80211_tx_power_setting type, int mbm);
int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
int *dbm);
const u8 *addr);
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
-@@ -1431,6 +1431,7 @@ enum ieee80211_smps_mode {
+@@ -1472,6 +1472,7 @@ enum ieee80211_smps_mode {
*
* @power_level: requested transmit power (in dBm), backward compatibility
* value only that is set to the minimum of all interfaces
*
* @chandef: the channel definition to tune to
* @radar_enabled: whether radar detection is enabled
-@@ -1451,6 +1452,7 @@ enum ieee80211_smps_mode {
+@@ -1492,6 +1493,7 @@ enum ieee80211_smps_mode {
struct ieee80211_conf {
u32 flags;
int power_level, dynamic_ps_timeout;
u8 ps_dtim_period;
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
-@@ -2302,6 +2302,9 @@ enum nl80211_commands {
+@@ -2308,6 +2308,9 @@ enum nl80211_commands {
* @NL80211_ATTR_AIRTIME_WEIGHT: Station's weight when scheduled by the airtime
* scheduler.
*
* @NUM_NL80211_ATTR: total number of nl80211_attrs available
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
-@@ -2753,6 +2756,8 @@ enum nl80211_attrs {
+@@ -2759,6 +2762,8 @@ enum nl80211_attrs {
NL80211_ATTR_AIRTIME_WEIGHT,
__NL80211_ATTR_AFTER_LAST,
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
-@@ -2524,6 +2524,19 @@ static int ieee80211_get_tx_power(struct
+@@ -2533,6 +2533,19 @@ static int ieee80211_get_tx_power(struct
return 0;
}
static int ieee80211_set_wds_peer(struct wiphy *wiphy, struct net_device *dev,
const u8 *addr)
{
-@@ -3937,6 +3950,7 @@ const struct cfg80211_ops mac80211_confi
+@@ -3946,6 +3959,7 @@ const struct cfg80211_ops mac80211_confi
.set_wiphy_params = ieee80211_set_wiphy_params,
.set_tx_power = ieee80211_set_tx_power,
.get_tx_power = ieee80211_get_tx_power,
CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd)
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
-@@ -1370,6 +1370,7 @@ struct ieee80211_local {
+@@ -1376,6 +1376,7 @@ struct ieee80211_local {
int dynamic_ps_forced_timeout;
int user_power_level; /* in dBm, for all interfaces */
if (local->hw.conf.power_level != power) {
changed |= IEEE80211_CONF_CHANGE_POWER;
local->hw.conf.power_level = power;
-@@ -639,6 +645,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
+@@ -641,6 +647,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
IEEE80211_RADIOTAP_MCS_HAVE_BW;
local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI |
IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH;
local->user_power_level = IEEE80211_UNSET_POWER_LEVEL;
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
-@@ -558,6 +558,7 @@ const struct nla_policy nl80211_policy[N
- NLA_POLICY_NESTED(NL80211_PMSR_ATTR_MAX,
- nl80211_pmsr_attr_policy),
+@@ -541,6 +541,7 @@ const struct nla_policy nl80211_policy[N
+ [NL80211_ATTR_PEER_MEASUREMENTS] =
+ NLA_POLICY_NESTED(nl80211_pmsr_attr_policy),
[NL80211_ATTR_AIRTIME_WEIGHT] = NLA_POLICY_MIN(NLA_U16, 1),
+ [NL80211_ATTR_WIPHY_ANTENNA_GAIN] = { .type = NLA_U32 },
};
/* policy for the key attributes */
-@@ -2796,6 +2797,20 @@ static int nl80211_set_wiphy(struct sk_b
+@@ -2788,6 +2789,20 @@ static int nl80211_set_wiphy(struct sk_b
if (result)
return result;
}