hc
2024-05-16 8d2a02b24d66aa359e83eebc1ed3c0f85367a1cb
kernel/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
....@@ -1,17 +1,6 @@
1
+// SPDX-License-Identifier: ISC
12 /*
23 * Copyright (c) 2010 Broadcom Corporation
3
- *
4
- * Permission to use, copy, modify, and/or distribute this software for any
5
- * purpose with or without fee is hereby granted, provided that the above
6
- * copyright notice and this permission notice appear in all copies.
7
- *
8
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11
- * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
154 */
165
176 /* Toplevel file. Relies on dhd_linux.c to send commands to the dongle. */
....@@ -22,6 +11,7 @@
2211 #include <linux/vmalloc.h>
2312 #include <net/cfg80211.h>
2413 #include <net/netlink.h>
14
+#include <uapi/linux/if_arp.h>
2515
2616 #include <brcmu_utils.h>
2717 #include <defs.h>
....@@ -33,6 +23,7 @@
3323 #include "p2p.h"
3424 #include "btcoex.h"
3525 #include "pno.h"
26
+#include "fwsignal.h"
3627 #include "cfg80211.h"
3728 #include "feature.h"
3829 #include "fwil.h"
....@@ -65,6 +56,7 @@
6556 #define RSN_AKM_PSK 2 /* Pre-shared Key */
6657 #define RSN_AKM_SHA256_1X 5 /* SHA256, 802.1X */
6758 #define RSN_AKM_SHA256_PSK 6 /* SHA256, Pre-shared Key */
59
+#define RSN_AKM_SAE 8 /* SAE */
6860 #define RSN_CAP_LEN 2 /* Length of RSN capabilities */
6961 #define RSN_CAP_PTK_REPLAY_CNTR_MASK (BIT(2) | BIT(3))
7062 #define RSN_CAP_MFPR_MASK BIT(6)
....@@ -93,8 +85,13 @@
9385
9486 #define BRCMF_ND_INFO_TIMEOUT msecs_to_jiffies(2000)
9587
88
+#define BRCMF_PS_MAX_TIMEOUT_MS 2000
89
+
9690 #define BRCMF_ASSOC_PARAMS_FIXED_SIZE \
9791 (sizeof(struct brcmf_assoc_params_le) - sizeof(u16))
92
+
93
+#define BRCMF_MAX_CHANSPEC_LIST \
94
+ (BRCMF_DCMD_MEDLEN / sizeof(__le32) - 1)
9895
9996 static bool check_vif_up(struct brcmf_cfg80211_vif *vif)
10097 {
....@@ -200,9 +197,9 @@
200197 */
201198 REG_RULE(2484-10, 2484+10, 20, 6, 20, 0),
202199 /* IEEE 802.11a, channel 36..64 */
203
- REG_RULE(5150-10, 5350+10, 80, 6, 20, 0),
200
+ REG_RULE(5150-10, 5350+10, 160, 6, 20, 0),
204201 /* IEEE 802.11a, channel 100..165 */
205
- REG_RULE(5470-10, 5850+10, 80, 6, 20, 0), }
202
+ REG_RULE(5470-10, 5850+10, 160, 6, 20, 0), }
206203 };
207204
208205 /* Note: brcmf_cipher_suites is an array of int defining which cipher suites
....@@ -287,8 +284,26 @@
287284 else
288285 ch_inf.sb = BRCMU_CHAN_SB_UU;
289286 break;
290
- case NL80211_CHAN_WIDTH_80P80:
291287 case NL80211_CHAN_WIDTH_160:
288
+ ch_inf.bw = BRCMU_CHAN_BW_160;
289
+ if (primary_offset == -70)
290
+ ch_inf.sb = BRCMU_CHAN_SB_LLL;
291
+ else if (primary_offset == -50)
292
+ ch_inf.sb = BRCMU_CHAN_SB_LLU;
293
+ else if (primary_offset == -30)
294
+ ch_inf.sb = BRCMU_CHAN_SB_LUL;
295
+ else if (primary_offset == -10)
296
+ ch_inf.sb = BRCMU_CHAN_SB_LUU;
297
+ else if (primary_offset == 10)
298
+ ch_inf.sb = BRCMU_CHAN_SB_ULL;
299
+ else if (primary_offset == 30)
300
+ ch_inf.sb = BRCMU_CHAN_SB_ULU;
301
+ else if (primary_offset == 50)
302
+ ch_inf.sb = BRCMU_CHAN_SB_UUL;
303
+ else
304
+ ch_inf.sb = BRCMU_CHAN_SB_UUU;
305
+ break;
306
+ case NL80211_CHAN_WIDTH_80P80:
292307 case NL80211_CHAN_WIDTH_5:
293308 case NL80211_CHAN_WIDTH_10:
294309 default:
....@@ -307,6 +322,7 @@
307322 }
308323 d11inf->encchspec(&ch_inf);
309324
325
+ brcmf_dbg(TRACE, "chanspec: 0x%x\n", ch_inf.chspec);
310326 return ch_inf.chspec;
311327 }
312328
....@@ -457,6 +473,7 @@
457473 static int
458474 send_key_to_dongle(struct brcmf_if *ifp, struct brcmf_wsec_key *key)
459475 {
476
+ struct brcmf_pub *drvr = ifp->drvr;
460477 int err;
461478 struct brcmf_wsec_key_le key_le;
462479
....@@ -468,7 +485,7 @@
468485 sizeof(key_le));
469486
470487 if (err)
471
- brcmf_err("wsec_key error (%d)\n", err);
488
+ bphy_err(drvr, "wsec_key error (%d)\n", err);
472489 return err;
473490 }
474491
....@@ -508,6 +525,7 @@
508525
509526 static int brcmf_cfg80211_request_ap_if(struct brcmf_if *ifp)
510527 {
528
+ struct brcmf_pub *drvr = ifp->drvr;
511529 struct brcmf_mbss_ssid_le mbss_ssid_le;
512530 int bsscfgidx;
513531 int err;
....@@ -524,7 +542,7 @@
524542 err = brcmf_fil_bsscfg_data_set(ifp, "bsscfg:ssid", &mbss_ssid_le,
525543 sizeof(mbss_ssid_le));
526544 if (err < 0)
527
- brcmf_err("setting ssid failed %d\n", err);
545
+ bphy_err(drvr, "setting ssid failed %d\n", err);
528546
529547 return err;
530548 }
....@@ -542,6 +560,7 @@
542560 {
543561 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
544562 struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg));
563
+ struct brcmf_pub *drvr = cfg->pub;
545564 struct brcmf_cfg80211_vif *vif;
546565 int err;
547566
....@@ -567,7 +586,7 @@
567586 BRCMF_VIF_EVENT_TIMEOUT);
568587 brcmf_cfg80211_arm_vif_event(cfg, NULL);
569588 if (!err) {
570
- brcmf_err("timeout occurred\n");
589
+ bphy_err(drvr, "timeout occurred\n");
571590 err = -EIO;
572591 goto fail;
573592 }
....@@ -575,7 +594,7 @@
575594 /* interface created in firmware */
576595 ifp = vif->ifp;
577596 if (!ifp) {
578
- brcmf_err("no if pointer provided\n");
597
+ bphy_err(drvr, "no if pointer provided\n");
579598 err = -ENOENT;
580599 goto fail;
581600 }
....@@ -583,7 +602,7 @@
583602 strncpy(ifp->ndev->name, name, sizeof(ifp->ndev->name) - 1);
584603 err = brcmf_net_attach(ifp, true);
585604 if (err) {
586
- brcmf_err("Registering netdevice failed\n");
605
+ bphy_err(drvr, "Registering netdevice failed\n");
587606 free_netdev(ifp->ndev);
588607 goto fail;
589608 }
....@@ -608,19 +627,97 @@
608627 return vif->wdev.iftype == NL80211_IFTYPE_ADHOC;
609628 }
610629
630
+/**
631
+ * brcmf_mon_add_vif() - create monitor mode virtual interface
632
+ *
633
+ * @wiphy: wiphy device of new interface.
634
+ * @name: name of the new interface.
635
+ */
636
+static struct wireless_dev *brcmf_mon_add_vif(struct wiphy *wiphy,
637
+ const char *name)
638
+{
639
+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
640
+ struct brcmf_cfg80211_vif *vif;
641
+ struct net_device *ndev;
642
+ struct brcmf_if *ifp;
643
+ int err;
644
+
645
+ if (cfg->pub->mon_if) {
646
+ err = -EEXIST;
647
+ goto err_out;
648
+ }
649
+
650
+ vif = brcmf_alloc_vif(cfg, NL80211_IFTYPE_MONITOR);
651
+ if (IS_ERR(vif)) {
652
+ err = PTR_ERR(vif);
653
+ goto err_out;
654
+ }
655
+
656
+ ndev = alloc_netdev(sizeof(*ifp), name, NET_NAME_UNKNOWN, ether_setup);
657
+ if (!ndev) {
658
+ err = -ENOMEM;
659
+ goto err_free_vif;
660
+ }
661
+ ndev->type = ARPHRD_IEEE80211_RADIOTAP;
662
+ ndev->ieee80211_ptr = &vif->wdev;
663
+ ndev->needs_free_netdev = true;
664
+ ndev->priv_destructor = brcmf_cfg80211_free_netdev;
665
+ SET_NETDEV_DEV(ndev, wiphy_dev(cfg->wiphy));
666
+
667
+ ifp = netdev_priv(ndev);
668
+ ifp->vif = vif;
669
+ ifp->ndev = ndev;
670
+ ifp->drvr = cfg->pub;
671
+
672
+ vif->ifp = ifp;
673
+ vif->wdev.netdev = ndev;
674
+
675
+ err = brcmf_net_mon_attach(ifp);
676
+ if (err) {
677
+ brcmf_err("Failed to attach %s device\n", ndev->name);
678
+ free_netdev(ndev);
679
+ goto err_free_vif;
680
+ }
681
+
682
+ cfg->pub->mon_if = ifp;
683
+
684
+ return &vif->wdev;
685
+
686
+err_free_vif:
687
+ brcmf_free_vif(vif);
688
+err_out:
689
+ return ERR_PTR(err);
690
+}
691
+
692
+static int brcmf_mon_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev)
693
+{
694
+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
695
+ struct net_device *ndev = wdev->netdev;
696
+
697
+ ndev->netdev_ops->ndo_stop(ndev);
698
+
699
+ brcmf_net_detach(ndev, true);
700
+
701
+ cfg->pub->mon_if = NULL;
702
+
703
+ return 0;
704
+}
705
+
611706 static struct wireless_dev *brcmf_cfg80211_add_iface(struct wiphy *wiphy,
612707 const char *name,
613708 unsigned char name_assign_type,
614709 enum nl80211_iftype type,
615710 struct vif_params *params)
616711 {
712
+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
713
+ struct brcmf_pub *drvr = cfg->pub;
617714 struct wireless_dev *wdev;
618715 int err;
619716
620717 brcmf_dbg(TRACE, "enter: %s type %d\n", name, type);
621718 err = brcmf_vif_add_validate(wiphy_to_cfg(wiphy), type);
622719 if (err) {
623
- brcmf_err("iface validation failed: err=%d\n", err);
720
+ bphy_err(drvr, "iface validation failed: err=%d\n", err);
624721 return ERR_PTR(err);
625722 }
626723 switch (type) {
....@@ -628,9 +725,10 @@
628725 case NL80211_IFTYPE_STATION:
629726 case NL80211_IFTYPE_AP_VLAN:
630727 case NL80211_IFTYPE_WDS:
631
- case NL80211_IFTYPE_MONITOR:
632728 case NL80211_IFTYPE_MESH_POINT:
633729 return ERR_PTR(-EOPNOTSUPP);
730
+ case NL80211_IFTYPE_MONITOR:
731
+ return brcmf_mon_add_vif(wiphy, name);
634732 case NL80211_IFTYPE_AP:
635733 wdev = brcmf_ap_add_vif(wiphy, name, params);
636734 break;
....@@ -645,8 +743,8 @@
645743 }
646744
647745 if (IS_ERR(wdev))
648
- brcmf_err("add iface %s type %d failed: err=%d\n",
649
- name, type, (int)PTR_ERR(wdev));
746
+ bphy_err(drvr, "add iface %s type %d failed: err=%d\n", name,
747
+ type, (int)PTR_ERR(wdev));
650748 else
651749 brcmf_cfg80211_update_proto_addr_mode(wdev);
652750
....@@ -661,12 +759,13 @@
661759
662760 void brcmf_set_mpc(struct brcmf_if *ifp, int mpc)
663761 {
762
+ struct brcmf_pub *drvr = ifp->drvr;
664763 s32 err = 0;
665764
666765 if (check_vif_up(ifp->vif)) {
667766 err = brcmf_fil_iovar_int_set(ifp, "mpc", mpc);
668767 if (err) {
669
- brcmf_err("fail to set mpc\n");
768
+ bphy_err(drvr, "fail to set mpc\n");
670769 return;
671770 }
672771 brcmf_dbg(INFO, "MPC : %d\n", mpc);
....@@ -677,6 +776,7 @@
677776 struct brcmf_if *ifp, bool aborted,
678777 bool fw_abort)
679778 {
779
+ struct brcmf_pub *drvr = cfg->pub;
680780 struct brcmf_scan_params_le params_le;
681781 struct cfg80211_scan_request *scan_request;
682782 u64 reqid;
....@@ -711,7 +811,7 @@
711811 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCAN,
712812 &params_le, sizeof(params_le));
713813 if (err)
714
- brcmf_err("Scan abort failed\n");
814
+ bphy_err(drvr, "Scan abort failed\n");
715815 }
716816
717817 brcmf_scan_config_mpc(ifp, 1);
....@@ -756,6 +856,7 @@
756856 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
757857 struct net_device *ndev = wdev->netdev;
758858 struct brcmf_if *ifp = netdev_priv(ndev);
859
+ struct brcmf_pub *drvr = cfg->pub;
759860 int ret;
760861 int err;
761862
....@@ -763,7 +864,7 @@
763864
764865 err = brcmf_fil_bsscfg_data_set(ifp, "interface_remove", NULL, 0);
765866 if (err) {
766
- brcmf_err("interface_remove failed %d\n", err);
867
+ bphy_err(drvr, "interface_remove failed %d\n", err);
767868 goto err_unarm;
768869 }
769870
....@@ -771,7 +872,7 @@
771872 ret = brcmf_cfg80211_wait_vif_event(cfg, BRCMF_E_IF_DEL,
772873 BRCMF_VIF_EVENT_TIMEOUT);
773874 if (!ret) {
774
- brcmf_err("timeout occurred\n");
875
+ bphy_err(drvr, "timeout occurred\n");
775876 err = -EIO;
776877 goto err_unarm;
777878 }
....@@ -810,9 +911,10 @@
810911 case NL80211_IFTYPE_STATION:
811912 case NL80211_IFTYPE_AP_VLAN:
812913 case NL80211_IFTYPE_WDS:
813
- case NL80211_IFTYPE_MONITOR:
814914 case NL80211_IFTYPE_MESH_POINT:
815915 return -EOPNOTSUPP;
916
+ case NL80211_IFTYPE_MONITOR:
917
+ return brcmf_mon_del_vif(wiphy, wdev);
816918 case NL80211_IFTYPE_AP:
817919 return brcmf_cfg80211_del_ap_iface(wiphy, wdev);
818920 case NL80211_IFTYPE_P2P_CLIENT:
....@@ -834,6 +936,7 @@
834936 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
835937 struct brcmf_if *ifp = netdev_priv(ndev);
836938 struct brcmf_cfg80211_vif *vif = ifp->vif;
939
+ struct brcmf_pub *drvr = cfg->pub;
837940 s32 infra = 0;
838941 s32 ap = 0;
839942 s32 err = 0;
....@@ -873,14 +976,14 @@
873976 }
874977 err = brcmf_vif_change_validate(wiphy_to_cfg(wiphy), vif, type);
875978 if (err) {
876
- brcmf_err("iface validation failed: err=%d\n", err);
979
+ bphy_err(drvr, "iface validation failed: err=%d\n", err);
877980 return err;
878981 }
879982 switch (type) {
880983 case NL80211_IFTYPE_MONITOR:
881984 case NL80211_IFTYPE_WDS:
882
- brcmf_err("type (%d) : currently we do not support this type\n",
883
- type);
985
+ bphy_err(drvr, "type (%d) : currently we do not support this type\n",
986
+ type);
884987 return -EOPNOTSUPP;
885988 case NL80211_IFTYPE_ADHOC:
886989 infra = 0;
....@@ -908,7 +1011,7 @@
9081011 } else {
9091012 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, infra);
9101013 if (err) {
911
- brcmf_err("WLC_SET_INFRA error (%d)\n", err);
1014
+ bphy_err(drvr, "WLC_SET_INFRA error (%d)\n", err);
9121015 err = -EAGAIN;
9131016 goto done;
9141017 }
....@@ -999,6 +1102,7 @@
9991102 brcmf_run_escan(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp,
10001103 struct cfg80211_scan_request *request)
10011104 {
1105
+ struct brcmf_pub *drvr = cfg->pub;
10021106 s32 params_size = BRCMF_SCAN_PARAMS_FIXED_SIZE +
10031107 offsetof(struct brcmf_escan_params_le, params_le);
10041108 struct brcmf_escan_params_le *params;
....@@ -1030,7 +1134,7 @@
10301134 if (err == -EBUSY)
10311135 brcmf_dbg(INFO, "system busy : escan canceled\n");
10321136 else
1033
- brcmf_err("error (%d)\n", err);
1137
+ bphy_err(drvr, "error (%d)\n", err);
10341138 }
10351139
10361140 kfree(params);
....@@ -1067,6 +1171,7 @@
10671171 brcmf_cfg80211_scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
10681172 {
10691173 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
1174
+ struct brcmf_pub *drvr = cfg->pub;
10701175 struct brcmf_cfg80211_vif *vif;
10711176 s32 err = 0;
10721177
....@@ -1076,21 +1181,22 @@
10761181 return -EIO;
10771182
10781183 if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) {
1079
- brcmf_err("Scanning already: status (%lu)\n", cfg->scan_status);
1184
+ bphy_err(drvr, "Scanning already: status (%lu)\n",
1185
+ cfg->scan_status);
10801186 return -EAGAIN;
10811187 }
10821188 if (test_bit(BRCMF_SCAN_STATUS_ABORT, &cfg->scan_status)) {
1083
- brcmf_err("Scanning being aborted: status (%lu)\n",
1084
- cfg->scan_status);
1189
+ bphy_err(drvr, "Scanning being aborted: status (%lu)\n",
1190
+ cfg->scan_status);
10851191 return -EAGAIN;
10861192 }
10871193 if (test_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status)) {
1088
- brcmf_err("Scanning suppressed: status (%lu)\n",
1089
- cfg->scan_status);
1194
+ bphy_err(drvr, "Scanning suppressed: status (%lu)\n",
1195
+ cfg->scan_status);
10901196 return -EAGAIN;
10911197 }
10921198 if (test_bit(BRCMF_VIF_STATUS_CONNECTING, &vif->sme_state)) {
1093
- brcmf_err("Connecting: status (%lu)\n", vif->sme_state);
1199
+ bphy_err(drvr, "Connecting: status (%lu)\n", vif->sme_state);
10941200 return -EAGAIN;
10951201 }
10961202
....@@ -1124,7 +1230,7 @@
11241230 return 0;
11251231
11261232 scan_out:
1127
- brcmf_err("scan error (%d)\n", err);
1233
+ bphy_err(drvr, "scan error (%d)\n", err);
11281234 clear_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status);
11291235 cfg->scan_request = NULL;
11301236 return err;
....@@ -1132,36 +1238,41 @@
11321238
11331239 static s32 brcmf_set_rts(struct net_device *ndev, u32 rts_threshold)
11341240 {
1241
+ struct brcmf_if *ifp = netdev_priv(ndev);
1242
+ struct brcmf_pub *drvr = ifp->drvr;
11351243 s32 err = 0;
11361244
1137
- err = brcmf_fil_iovar_int_set(netdev_priv(ndev), "rtsthresh",
1138
- rts_threshold);
1245
+ err = brcmf_fil_iovar_int_set(ifp, "rtsthresh", rts_threshold);
11391246 if (err)
1140
- brcmf_err("Error (%d)\n", err);
1247
+ bphy_err(drvr, "Error (%d)\n", err);
11411248
11421249 return err;
11431250 }
11441251
11451252 static s32 brcmf_set_frag(struct net_device *ndev, u32 frag_threshold)
11461253 {
1254
+ struct brcmf_if *ifp = netdev_priv(ndev);
1255
+ struct brcmf_pub *drvr = ifp->drvr;
11471256 s32 err = 0;
11481257
1149
- err = brcmf_fil_iovar_int_set(netdev_priv(ndev), "fragthresh",
1258
+ err = brcmf_fil_iovar_int_set(ifp, "fragthresh",
11501259 frag_threshold);
11511260 if (err)
1152
- brcmf_err("Error (%d)\n", err);
1261
+ bphy_err(drvr, "Error (%d)\n", err);
11531262
11541263 return err;
11551264 }
11561265
11571266 static s32 brcmf_set_retry(struct net_device *ndev, u32 retry, bool l)
11581267 {
1268
+ struct brcmf_if *ifp = netdev_priv(ndev);
1269
+ struct brcmf_pub *drvr = ifp->drvr;
11591270 s32 err = 0;
11601271 u32 cmd = (l ? BRCMF_C_SET_LRL : BRCMF_C_SET_SRL);
11611272
1162
- err = brcmf_fil_cmd_int_set(netdev_priv(ndev), cmd, retry);
1273
+ err = brcmf_fil_cmd_int_set(ifp, cmd, retry);
11631274 if (err) {
1164
- brcmf_err("cmd (%d) , error (%d)\n", cmd, err);
1275
+ bphy_err(drvr, "cmd (%d) , error (%d)\n", cmd, err);
11651276 return err;
11661277 }
11671278 return err;
....@@ -1237,49 +1348,83 @@
12371348
12381349 static int brcmf_set_pmk(struct brcmf_if *ifp, const u8 *pmk_data, u16 pmk_len)
12391350 {
1351
+ struct brcmf_pub *drvr = ifp->drvr;
12401352 struct brcmf_wsec_pmk_le pmk;
1241
- int i, err;
1353
+ int err;
12421354
1243
- /* convert to firmware key format */
1244
- pmk.key_len = cpu_to_le16(pmk_len << 1);
1245
- pmk.flags = cpu_to_le16(BRCMF_WSEC_PASSPHRASE);
1246
- for (i = 0; i < pmk_len; i++)
1247
- snprintf(&pmk.key[2 * i], 3, "%02x", pmk_data[i]);
1355
+ memset(&pmk, 0, sizeof(pmk));
1356
+
1357
+ /* pass pmk directly */
1358
+ pmk.key_len = cpu_to_le16(pmk_len);
1359
+ pmk.flags = cpu_to_le16(0);
1360
+ memcpy(pmk.key, pmk_data, pmk_len);
12481361
12491362 /* store psk in firmware */
12501363 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_WSEC_PMK,
12511364 &pmk, sizeof(pmk));
12521365 if (err < 0)
1253
- brcmf_err("failed to change PSK in firmware (len=%u)\n",
1254
- pmk_len);
1366
+ bphy_err(drvr, "failed to change PSK in firmware (len=%u)\n",
1367
+ pmk_len);
12551368
12561369 return err;
12571370 }
12581371
1259
-static void brcmf_link_down(struct brcmf_cfg80211_vif *vif, u16 reason)
1372
+static int brcmf_set_sae_password(struct brcmf_if *ifp, const u8 *pwd_data,
1373
+ u16 pwd_len)
1374
+{
1375
+ struct brcmf_pub *drvr = ifp->drvr;
1376
+ struct brcmf_wsec_sae_pwd_le sae_pwd;
1377
+ int err;
1378
+
1379
+ if (pwd_len > BRCMF_WSEC_MAX_SAE_PASSWORD_LEN) {
1380
+ bphy_err(drvr, "sae_password must be less than %d\n",
1381
+ BRCMF_WSEC_MAX_SAE_PASSWORD_LEN);
1382
+ return -EINVAL;
1383
+ }
1384
+
1385
+ sae_pwd.key_len = cpu_to_le16(pwd_len);
1386
+ memcpy(sae_pwd.key, pwd_data, pwd_len);
1387
+
1388
+ err = brcmf_fil_iovar_data_set(ifp, "sae_password", &sae_pwd,
1389
+ sizeof(sae_pwd));
1390
+ if (err < 0)
1391
+ bphy_err(drvr, "failed to set SAE password in firmware (len=%u)\n",
1392
+ pwd_len);
1393
+
1394
+ return err;
1395
+}
1396
+
1397
+static void brcmf_link_down(struct brcmf_cfg80211_vif *vif, u16 reason,
1398
+ bool locally_generated)
12601399 {
12611400 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(vif->wdev.wiphy);
1401
+ struct brcmf_pub *drvr = cfg->pub;
1402
+ bool bus_up = drvr->bus_if->state == BRCMF_BUS_UP;
12621403 s32 err = 0;
12631404
12641405 brcmf_dbg(TRACE, "Enter\n");
12651406
12661407 if (test_and_clear_bit(BRCMF_VIF_STATUS_CONNECTED, &vif->sme_state)) {
1267
- brcmf_dbg(INFO, "Call WLC_DISASSOC to stop excess roaming\n");
1268
- err = brcmf_fil_cmd_data_set(vif->ifp,
1269
- BRCMF_C_DISASSOC, NULL, 0);
1270
- if (err) {
1271
- brcmf_err("WLC_DISASSOC failed (%d)\n", err);
1408
+ if (bus_up) {
1409
+ brcmf_dbg(INFO, "Call WLC_DISASSOC to stop excess roaming\n");
1410
+ err = brcmf_fil_cmd_data_set(vif->ifp,
1411
+ BRCMF_C_DISASSOC, NULL, 0);
1412
+ if (err)
1413
+ bphy_err(drvr, "WLC_DISASSOC failed (%d)\n",
1414
+ err);
12721415 }
1416
+
12731417 if ((vif->wdev.iftype == NL80211_IFTYPE_STATION) ||
12741418 (vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT))
12751419 cfg80211_disconnected(vif->wdev.netdev, reason, NULL, 0,
1276
- true, GFP_KERNEL);
1420
+ locally_generated, GFP_KERNEL);
12771421 }
12781422 clear_bit(BRCMF_VIF_STATUS_CONNECTING, &vif->sme_state);
12791423 clear_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status);
12801424 brcmf_btcoex_set_mode(vif, BRCMF_BTCOEX_ENABLED, 0);
12811425 if (vif->profile.use_fwsup != BRCMF_PROFILE_FWSUP_NONE) {
1282
- brcmf_set_pmk(vif->ifp, NULL, 0);
1426
+ if (bus_up)
1427
+ brcmf_set_pmk(vif->ifp, NULL, 0);
12831428 vif->profile.use_fwsup = BRCMF_PROFILE_FWSUP_NONE;
12841429 }
12851430 brcmf_dbg(TRACE, "Exit\n");
....@@ -1292,6 +1437,7 @@
12921437 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
12931438 struct brcmf_if *ifp = netdev_priv(ndev);
12941439 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
1440
+ struct brcmf_pub *drvr = cfg->pub;
12951441 struct brcmf_join_params join_params;
12961442 size_t join_params_size = 0;
12971443 s32 err = 0;
....@@ -1356,7 +1502,7 @@
13561502
13571503 err = brcmf_fil_iovar_int_set(ifp, "wsec", wsec);
13581504 if (err) {
1359
- brcmf_err("wsec failed (%d)\n", err);
1505
+ bphy_err(drvr, "wsec failed (%d)\n", err);
13601506 goto done;
13611507 }
13621508
....@@ -1368,7 +1514,7 @@
13681514
13691515 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD, bcnprd);
13701516 if (err) {
1371
- brcmf_err("WLC_SET_BCNPRD failed (%d)\n", err);
1517
+ bphy_err(drvr, "WLC_SET_BCNPRD failed (%d)\n", err);
13721518 goto done;
13731519 }
13741520
....@@ -1413,7 +1559,7 @@
14131559 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_CHANNEL,
14141560 target_channel);
14151561 if (err) {
1416
- brcmf_err("WLC_SET_CHANNEL failed (%d)\n", err);
1562
+ bphy_err(drvr, "WLC_SET_CHANNEL failed (%d)\n", err);
14171563 goto done;
14181564 }
14191565 } else
....@@ -1425,7 +1571,7 @@
14251571 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
14261572 &join_params, join_params_size);
14271573 if (err) {
1428
- brcmf_err("WLC_SET_SSID failed (%d)\n", err);
1574
+ bphy_err(drvr, "WLC_SET_SSID failed (%d)\n", err);
14291575 goto done;
14301576 }
14311577
....@@ -1450,7 +1596,7 @@
14501596 return 0;
14511597 }
14521598
1453
- brcmf_link_down(ifp->vif, WLAN_REASON_DEAUTH_LEAVING);
1599
+ brcmf_link_down(ifp->vif, WLAN_REASON_DEAUTH_LEAVING, true);
14541600 brcmf_net_setcarrier(ifp, false);
14551601
14561602 brcmf_dbg(TRACE, "Exit\n");
....@@ -1461,7 +1607,9 @@
14611607 static s32 brcmf_set_wpa_version(struct net_device *ndev,
14621608 struct cfg80211_connect_params *sme)
14631609 {
1610
+ struct brcmf_if *ifp = netdev_priv(ndev);
14641611 struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
1612
+ struct brcmf_pub *drvr = ifp->drvr;
14651613 struct brcmf_cfg80211_security *sec;
14661614 s32 val = 0;
14671615 s32 err = 0;
....@@ -1470,12 +1618,14 @@
14701618 val = WPA_AUTH_PSK | WPA_AUTH_UNSPECIFIED;
14711619 else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2)
14721620 val = WPA2_AUTH_PSK | WPA2_AUTH_UNSPECIFIED;
1621
+ else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_3)
1622
+ val = WPA3_AUTH_SAE_PSK;
14731623 else
14741624 val = WPA_AUTH_DISABLED;
14751625 brcmf_dbg(CONN, "setting wpa_auth to 0x%0x\n", val);
1476
- err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wpa_auth", val);
1626
+ err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", val);
14771627 if (err) {
1478
- brcmf_err("set wpa_auth failed (%d)\n", err);
1628
+ bphy_err(drvr, "set wpa_auth failed (%d)\n", err);
14791629 return err;
14801630 }
14811631 sec = &profile->sec;
....@@ -1486,7 +1636,9 @@
14861636 static s32 brcmf_set_auth_type(struct net_device *ndev,
14871637 struct cfg80211_connect_params *sme)
14881638 {
1639
+ struct brcmf_if *ifp = netdev_priv(ndev);
14891640 struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
1641
+ struct brcmf_pub *drvr = ifp->drvr;
14901642 struct brcmf_cfg80211_security *sec;
14911643 s32 val = 0;
14921644 s32 err = 0;
....@@ -1500,15 +1652,19 @@
15001652 val = 1;
15011653 brcmf_dbg(CONN, "shared key\n");
15021654 break;
1655
+ case NL80211_AUTHTYPE_SAE:
1656
+ val = 3;
1657
+ brcmf_dbg(CONN, "SAE authentication\n");
1658
+ break;
15031659 default:
15041660 val = 2;
15051661 brcmf_dbg(CONN, "automatic, auth type (%d)\n", sme->auth_type);
15061662 break;
15071663 }
15081664
1509
- err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "auth", val);
1665
+ err = brcmf_fil_bsscfg_int_set(ifp, "auth", val);
15101666 if (err) {
1511
- brcmf_err("set auth failed (%d)\n", err);
1667
+ bphy_err(drvr, "set auth failed (%d)\n", err);
15121668 return err;
15131669 }
15141670 sec = &profile->sec;
....@@ -1520,7 +1676,9 @@
15201676 brcmf_set_wsec_mode(struct net_device *ndev,
15211677 struct cfg80211_connect_params *sme)
15221678 {
1679
+ struct brcmf_if *ifp = netdev_priv(ndev);
15231680 struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
1681
+ struct brcmf_pub *drvr = ifp->drvr;
15241682 struct brcmf_cfg80211_security *sec;
15251683 s32 pval = 0;
15261684 s32 gval = 0;
....@@ -1543,8 +1701,8 @@
15431701 pval = AES_ENABLED;
15441702 break;
15451703 default:
1546
- brcmf_err("invalid cipher pairwise (%d)\n",
1547
- sme->crypto.ciphers_pairwise[0]);
1704
+ bphy_err(drvr, "invalid cipher pairwise (%d)\n",
1705
+ sme->crypto.ciphers_pairwise[0]);
15481706 return -EINVAL;
15491707 }
15501708 }
....@@ -1564,8 +1722,8 @@
15641722 gval = AES_ENABLED;
15651723 break;
15661724 default:
1567
- brcmf_err("invalid cipher group (%d)\n",
1568
- sme->crypto.cipher_group);
1725
+ bphy_err(drvr, "invalid cipher group (%d)\n",
1726
+ sme->crypto.cipher_group);
15691727 return -EINVAL;
15701728 }
15711729 }
....@@ -1578,9 +1736,9 @@
15781736 pval = AES_ENABLED;
15791737
15801738 wsec = pval | gval;
1581
- err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wsec", wsec);
1739
+ err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
15821740 if (err) {
1583
- brcmf_err("error (%d)\n", err);
1741
+ bphy_err(drvr, "error (%d)\n", err);
15841742 return err;
15851743 }
15861744
....@@ -1596,6 +1754,7 @@
15961754 {
15971755 struct brcmf_if *ifp = netdev_priv(ndev);
15981756 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
1757
+ struct brcmf_pub *drvr = ifp->drvr;
15991758 s32 val;
16001759 s32 err;
16011760 const struct brcmf_tlv *rsn_ie;
....@@ -1607,13 +1766,14 @@
16071766 u16 count;
16081767
16091768 profile->use_fwsup = BRCMF_PROFILE_FWSUP_NONE;
1769
+ profile->is_ft = false;
16101770
16111771 if (!sme->crypto.n_akm_suites)
16121772 return 0;
16131773
16141774 err = brcmf_fil_bsscfg_int_get(netdev_priv(ndev), "wpa_auth", &val);
16151775 if (err) {
1616
- brcmf_err("could not get wpa_auth (%d)\n", err);
1776
+ bphy_err(drvr, "could not get wpa_auth (%d)\n", err);
16171777 return err;
16181778 }
16191779 if (val & (WPA_AUTH_PSK | WPA_AUTH_UNSPECIFIED)) {
....@@ -1627,8 +1787,8 @@
16271787 val = WPA_AUTH_PSK;
16281788 break;
16291789 default:
1630
- brcmf_err("invalid cipher group (%d)\n",
1631
- sme->crypto.cipher_group);
1790
+ bphy_err(drvr, "invalid cipher group (%d)\n",
1791
+ sme->crypto.cipher_group);
16321792 return -EINVAL;
16331793 }
16341794 } else if (val & (WPA2_AUTH_PSK | WPA2_AUTH_UNSPECIFIED)) {
....@@ -1649,9 +1809,33 @@
16491809 case WLAN_AKM_SUITE_PSK:
16501810 val = WPA2_AUTH_PSK;
16511811 break;
1812
+ case WLAN_AKM_SUITE_FT_8021X:
1813
+ val = WPA2_AUTH_UNSPECIFIED | WPA2_AUTH_FT;
1814
+ profile->is_ft = true;
1815
+ if (sme->want_1x)
1816
+ profile->use_fwsup = BRCMF_PROFILE_FWSUP_1X;
1817
+ break;
1818
+ case WLAN_AKM_SUITE_FT_PSK:
1819
+ val = WPA2_AUTH_PSK | WPA2_AUTH_FT;
1820
+ profile->is_ft = true;
1821
+ break;
16521822 default:
1653
- brcmf_err("invalid cipher group (%d)\n",
1654
- sme->crypto.cipher_group);
1823
+ bphy_err(drvr, "invalid cipher group (%d)\n",
1824
+ sme->crypto.cipher_group);
1825
+ return -EINVAL;
1826
+ }
1827
+ } else if (val & WPA3_AUTH_SAE_PSK) {
1828
+ switch (sme->crypto.akm_suites[0]) {
1829
+ case WLAN_AKM_SUITE_SAE:
1830
+ val = WPA3_AUTH_SAE_PSK;
1831
+ if (sme->crypto.sae_pwd) {
1832
+ brcmf_dbg(INFO, "using SAE offload\n");
1833
+ profile->use_fwsup = BRCMF_PROFILE_FWSUP_SAE;
1834
+ }
1835
+ break;
1836
+ default:
1837
+ bphy_err(drvr, "invalid cipher group (%d)\n",
1838
+ sme->crypto.cipher_group);
16551839 return -EINVAL;
16561840 }
16571841 }
....@@ -1697,7 +1881,7 @@
16971881 brcmf_dbg(CONN, "setting wpa_auth to %d\n", val);
16981882 err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wpa_auth", val);
16991883 if (err) {
1700
- brcmf_err("could not set wpa_auth (%d)\n", err);
1884
+ bphy_err(drvr, "could not set wpa_auth (%d)\n", err);
17011885 return err;
17021886 }
17031887
....@@ -1708,6 +1892,8 @@
17081892 brcmf_set_sharedkey(struct net_device *ndev,
17091893 struct cfg80211_connect_params *sme)
17101894 {
1895
+ struct brcmf_if *ifp = netdev_priv(ndev);
1896
+ struct brcmf_pub *drvr = ifp->drvr;
17111897 struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
17121898 struct brcmf_cfg80211_security *sec;
17131899 struct brcmf_wsec_key key;
....@@ -1723,7 +1909,8 @@
17231909 brcmf_dbg(CONN, "wpa_versions 0x%x cipher_pairwise 0x%x\n",
17241910 sec->wpa_versions, sec->cipher_pairwise);
17251911
1726
- if (sec->wpa_versions & (NL80211_WPA_VERSION_1 | NL80211_WPA_VERSION_2))
1912
+ if (sec->wpa_versions & (NL80211_WPA_VERSION_1 | NL80211_WPA_VERSION_2 |
1913
+ NL80211_WPA_VERSION_3))
17271914 return 0;
17281915
17291916 if (!(sec->cipher_pairwise &
....@@ -1734,7 +1921,7 @@
17341921 key.len = (u32) sme->key_len;
17351922 key.index = (u32) sme->key_idx;
17361923 if (key.len > sizeof(key.data)) {
1737
- brcmf_err("Too long key length (%u)\n", key.len);
1924
+ bphy_err(drvr, "Too long key length (%u)\n", key.len);
17381925 return -EINVAL;
17391926 }
17401927 memcpy(key.data, sme->key, key.len);
....@@ -1747,24 +1934,24 @@
17471934 key.algo = CRYPTO_ALGO_WEP128;
17481935 break;
17491936 default:
1750
- brcmf_err("Invalid algorithm (%d)\n",
1751
- sme->crypto.ciphers_pairwise[0]);
1937
+ bphy_err(drvr, "Invalid algorithm (%d)\n",
1938
+ sme->crypto.ciphers_pairwise[0]);
17521939 return -EINVAL;
17531940 }
17541941 /* Set the new key/index */
17551942 brcmf_dbg(CONN, "key length (%d) key index (%d) algo (%d)\n",
17561943 key.len, key.index, key.algo);
17571944 brcmf_dbg(CONN, "key \"%s\"\n", key.data);
1758
- err = send_key_to_dongle(netdev_priv(ndev), &key);
1945
+ err = send_key_to_dongle(ifp, &key);
17591946 if (err)
17601947 return err;
17611948
17621949 if (sec->auth_type == NL80211_AUTHTYPE_SHARED_KEY) {
17631950 brcmf_dbg(CONN, "set auth_type to shared key\n");
17641951 val = WL_AUTH_SHARED_KEY; /* shared key */
1765
- err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "auth", val);
1952
+ err = brcmf_fil_bsscfg_int_set(ifp, "auth", val);
17661953 if (err)
1767
- brcmf_err("set auth failed (%d)\n", err);
1954
+ bphy_err(drvr, "set auth failed (%d)\n", err);
17681955 }
17691956 return err;
17701957 }
....@@ -1784,6 +1971,7 @@
17841971 static void brcmf_set_join_pref(struct brcmf_if *ifp,
17851972 struct cfg80211_bss_selection *bss_select)
17861973 {
1974
+ struct brcmf_pub *drvr = ifp->drvr;
17871975 struct brcmf_join_pref_params join_pref_params[2];
17881976 enum nl80211_band band;
17891977 int err, i = 0;
....@@ -1822,7 +2010,7 @@
18222010 err = brcmf_fil_iovar_data_set(ifp, "join_pref", join_pref_params,
18232011 sizeof(join_pref_params));
18242012 if (err)
1825
- brcmf_err("Set join_pref error (%d)\n", err);
2013
+ bphy_err(drvr, "Set join_pref error (%d)\n", err);
18262014 }
18272015
18282016 static s32
....@@ -1833,6 +2021,7 @@
18332021 struct brcmf_if *ifp = netdev_priv(ndev);
18342022 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
18352023 struct ieee80211_channel *chan = sme->channel;
2024
+ struct brcmf_pub *drvr = ifp->drvr;
18362025 struct brcmf_join_params join_params;
18372026 size_t join_params_size;
18382027 const struct brcmf_tlv *rsn_ie;
....@@ -1849,7 +2038,7 @@
18492038 return -EIO;
18502039
18512040 if (!sme->ssid) {
1852
- brcmf_err("Invalid ssid\n");
2041
+ bphy_err(drvr, "Invalid ssid\n");
18532042 return -EOPNOTSUPP;
18542043 }
18552044
....@@ -1878,7 +2067,7 @@
18782067 err = brcmf_vif_set_mgmt_ie(ifp->vif, BRCMF_VNDR_IE_ASSOCREQ_FLAG,
18792068 sme->ie, sme->ie_len);
18802069 if (err)
1881
- brcmf_err("Set Assoc REQ IE Failed\n");
2070
+ bphy_err(drvr, "Set Assoc REQ IE Failed\n");
18822071 else
18832072 brcmf_dbg(TRACE, "Applied Vndr IEs for Assoc request\n");
18842073
....@@ -1899,36 +2088,37 @@
18992088
19002089 err = brcmf_set_wpa_version(ndev, sme);
19012090 if (err) {
1902
- brcmf_err("wl_set_wpa_version failed (%d)\n", err);
2091
+ bphy_err(drvr, "wl_set_wpa_version failed (%d)\n", err);
19032092 goto done;
19042093 }
19052094
19062095 sme->auth_type = brcmf_war_auth_type(ifp, sme->auth_type);
19072096 err = brcmf_set_auth_type(ndev, sme);
19082097 if (err) {
1909
- brcmf_err("wl_set_auth_type failed (%d)\n", err);
2098
+ bphy_err(drvr, "wl_set_auth_type failed (%d)\n", err);
19102099 goto done;
19112100 }
19122101
19132102 err = brcmf_set_wsec_mode(ndev, sme);
19142103 if (err) {
1915
- brcmf_err("wl_set_set_cipher failed (%d)\n", err);
2104
+ bphy_err(drvr, "wl_set_set_cipher failed (%d)\n", err);
19162105 goto done;
19172106 }
19182107
19192108 err = brcmf_set_key_mgmt(ndev, sme);
19202109 if (err) {
1921
- brcmf_err("wl_set_key_mgmt failed (%d)\n", err);
2110
+ bphy_err(drvr, "wl_set_key_mgmt failed (%d)\n", err);
19222111 goto done;
19232112 }
19242113
19252114 err = brcmf_set_sharedkey(ndev, sme);
19262115 if (err) {
1927
- brcmf_err("brcmf_set_sharedkey failed (%d)\n", err);
2116
+ bphy_err(drvr, "brcmf_set_sharedkey failed (%d)\n", err);
19282117 goto done;
19292118 }
19302119
1931
- if (sme->crypto.psk) {
2120
+ if (sme->crypto.psk &&
2121
+ profile->use_fwsup != BRCMF_PROFILE_FWSUP_SAE) {
19322122 if (WARN_ON(profile->use_fwsup != BRCMF_PROFILE_FWSUP_NONE)) {
19332123 err = -EINVAL;
19342124 goto done;
....@@ -1941,17 +2131,29 @@
19412131 /* enable firmware supplicant for this interface */
19422132 err = brcmf_fil_iovar_int_set(ifp, "sup_wpa", 1);
19432133 if (err < 0) {
1944
- brcmf_err("failed to enable fw supplicant\n");
2134
+ bphy_err(drvr, "failed to enable fw supplicant\n");
19452135 goto done;
19462136 }
19472137 }
19482138
1949
- if (profile->use_fwsup == BRCMF_PROFILE_FWSUP_PSK) {
2139
+ if (profile->use_fwsup == BRCMF_PROFILE_FWSUP_PSK)
19502140 err = brcmf_set_pmk(ifp, sme->crypto.psk,
19512141 BRCMF_WSEC_MAX_PSK_LEN);
1952
- if (err)
2142
+ else if (profile->use_fwsup == BRCMF_PROFILE_FWSUP_SAE) {
2143
+ /* clean up user-space RSNE */
2144
+ err = brcmf_fil_iovar_data_set(ifp, "wpaie", NULL, 0);
2145
+ if (err) {
2146
+ bphy_err(drvr, "failed to clean up user-space RSNE\n");
19532147 goto done;
2148
+ }
2149
+ err = brcmf_set_sae_password(ifp, sme->crypto.sae_pwd,
2150
+ sme->crypto.sae_pwd_len);
2151
+ if (!err && sme->crypto.psk)
2152
+ err = brcmf_set_pmk(ifp, sme->crypto.psk,
2153
+ BRCMF_WSEC_MAX_PSK_LEN);
19542154 }
2155
+ if (err)
2156
+ goto done;
19552157
19562158 /* Join with specific BSSID and cached SSID
19572159 * If SSID is zero join based on BSSID only
....@@ -2036,7 +2238,7 @@
20362238 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
20372239 &join_params, join_params_size);
20382240 if (err)
2039
- brcmf_err("BRCMF_C_SET_SSID failed (%d)\n", err);
2241
+ bphy_err(drvr, "BRCMF_C_SET_SSID failed (%d)\n", err);
20402242
20412243 done:
20422244 if (err)
....@@ -2049,8 +2251,10 @@
20492251 brcmf_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *ndev,
20502252 u16 reason_code)
20512253 {
2254
+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
20522255 struct brcmf_if *ifp = netdev_priv(ndev);
20532256 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
2257
+ struct brcmf_pub *drvr = cfg->pub;
20542258 struct brcmf_scb_val_le scbval;
20552259 s32 err = 0;
20562260
....@@ -2067,7 +2271,7 @@
20672271 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_DISASSOC,
20682272 &scbval, sizeof(scbval));
20692273 if (err)
2070
- brcmf_err("error (%d)\n", err);
2274
+ bphy_err(drvr, "error (%d)\n", err);
20712275
20722276 brcmf_dbg(TRACE, "Exit\n");
20732277 return err;
....@@ -2080,6 +2284,7 @@
20802284 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
20812285 struct net_device *ndev = cfg_to_ndev(cfg);
20822286 struct brcmf_if *ifp = netdev_priv(ndev);
2287
+ struct brcmf_pub *drvr = cfg->pub;
20832288 s32 err;
20842289 s32 disable;
20852290 u32 qdbm = 127;
....@@ -2094,7 +2299,7 @@
20942299 case NL80211_TX_POWER_LIMITED:
20952300 case NL80211_TX_POWER_FIXED:
20962301 if (mbm < 0) {
2097
- brcmf_err("TX_POWER_FIXED - dbm is negative\n");
2302
+ bphy_err(drvr, "TX_POWER_FIXED - dbm is negative\n");
20982303 err = -EINVAL;
20992304 goto done;
21002305 }
....@@ -2104,7 +2309,7 @@
21042309 qdbm |= WL_TXPWR_OVERRIDE;
21052310 break;
21062311 default:
2107
- brcmf_err("Unsupported type %d\n", type);
2312
+ bphy_err(drvr, "Unsupported type %d\n", type);
21082313 err = -EINVAL;
21092314 goto done;
21102315 }
....@@ -2112,11 +2317,11 @@
21122317 disable = WL_RADIO_SW_DISABLE << 16;
21132318 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_RADIO, disable);
21142319 if (err)
2115
- brcmf_err("WLC_SET_RADIO error (%d)\n", err);
2320
+ bphy_err(drvr, "WLC_SET_RADIO error (%d)\n", err);
21162321
21172322 err = brcmf_fil_iovar_int_set(ifp, "qtxpower", qdbm);
21182323 if (err)
2119
- brcmf_err("qtxpower error (%d)\n", err);
2324
+ bphy_err(drvr, "qtxpower error (%d)\n", err);
21202325
21212326 done:
21222327 brcmf_dbg(TRACE, "Exit %d (qdbm)\n", qdbm & ~WL_TXPWR_OVERRIDE);
....@@ -2127,7 +2332,9 @@
21272332 brcmf_cfg80211_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
21282333 s32 *dbm)
21292334 {
2335
+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
21302336 struct brcmf_cfg80211_vif *vif = wdev_to_vif(wdev);
2337
+ struct brcmf_pub *drvr = cfg->pub;
21312338 s32 qdbm = 0;
21322339 s32 err;
21332340
....@@ -2137,7 +2344,7 @@
21372344
21382345 err = brcmf_fil_iovar_int_get(vif->ifp, "qtxpower", &qdbm);
21392346 if (err) {
2140
- brcmf_err("error (%d)\n", err);
2347
+ bphy_err(drvr, "error (%d)\n", err);
21412348 goto done;
21422349 }
21432350 *dbm = (qdbm & ~WL_TXPWR_OVERRIDE) / 4;
....@@ -2152,6 +2359,7 @@
21522359 u8 key_idx, bool unicast, bool multicast)
21532360 {
21542361 struct brcmf_if *ifp = netdev_priv(ndev);
2362
+ struct brcmf_pub *drvr = ifp->drvr;
21552363 u32 index;
21562364 u32 wsec;
21572365 s32 err = 0;
....@@ -2163,7 +2371,7 @@
21632371
21642372 err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
21652373 if (err) {
2166
- brcmf_err("WLC_GET_WSEC error (%d)\n", err);
2374
+ bphy_err(drvr, "WLC_GET_WSEC error (%d)\n", err);
21672375 goto done;
21682376 }
21692377
....@@ -2173,7 +2381,7 @@
21732381 err = brcmf_fil_cmd_int_set(ifp,
21742382 BRCMF_C_SET_KEY_PRIMARY, index);
21752383 if (err)
2176
- brcmf_err("error (%d)\n", err);
2384
+ bphy_err(drvr, "error (%d)\n", err);
21772385 }
21782386 done:
21792387 brcmf_dbg(TRACE, "Exit\n");
....@@ -2222,7 +2430,9 @@
22222430 u8 key_idx, bool pairwise, const u8 *mac_addr,
22232431 struct key_params *params)
22242432 {
2433
+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
22252434 struct brcmf_if *ifp = netdev_priv(ndev);
2435
+ struct brcmf_pub *drvr = cfg->pub;
22262436 struct brcmf_wsec_key *key;
22272437 s32 val;
22282438 s32 wsec;
....@@ -2237,7 +2447,7 @@
22372447
22382448 if (key_idx >= BRCMF_MAX_DEFAULT_KEYS) {
22392449 /* we ignore this key index in this case */
2240
- brcmf_err("invalid key index (%d)\n", key_idx);
2450
+ bphy_err(drvr, "invalid key index (%d)\n", key_idx);
22412451 return -EINVAL;
22422452 }
22432453
....@@ -2246,7 +2456,7 @@
22462456 mac_addr);
22472457
22482458 if (params->key_len > sizeof(key->data)) {
2249
- brcmf_err("Too long key length (%u)\n", params->key_len);
2459
+ bphy_err(drvr, "Too long key length (%u)\n", params->key_len);
22502460 return -EINVAL;
22512461 }
22522462
....@@ -2266,6 +2476,17 @@
22662476 memcpy(key->data, params->key, key->len);
22672477 if (!ext_key)
22682478 key->flags = BRCMF_PRIMARY_KEY;
2479
+
2480
+ if (params->seq && params->seq_len == 6) {
2481
+ /* rx iv */
2482
+ u8 *ivptr;
2483
+
2484
+ ivptr = (u8 *)params->seq;
2485
+ key->rxiv.hi = (ivptr[5] << 24) | (ivptr[4] << 16) |
2486
+ (ivptr[3] << 8) | ivptr[2];
2487
+ key->rxiv.lo = (ivptr[1] << 8) | ivptr[0];
2488
+ key->iv_initialized = true;
2489
+ }
22692490
22702491 switch (params->cipher) {
22712492 case WLAN_CIPHER_SUITE_WEP40:
....@@ -2300,7 +2521,7 @@
23002521 brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_CCMP\n");
23012522 break;
23022523 default:
2303
- brcmf_err("Invalid cipher (0x%x)\n", params->cipher);
2524
+ bphy_err(drvr, "Invalid cipher (0x%x)\n", params->cipher);
23042525 err = -EINVAL;
23052526 goto done;
23062527 }
....@@ -2311,13 +2532,13 @@
23112532
23122533 err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
23132534 if (err) {
2314
- brcmf_err("get wsec error (%d)\n", err);
2535
+ bphy_err(drvr, "get wsec error (%d)\n", err);
23152536 goto done;
23162537 }
23172538 wsec |= val;
23182539 err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
23192540 if (err) {
2320
- brcmf_err("set wsec error (%d)\n", err);
2541
+ bphy_err(drvr, "set wsec error (%d)\n", err);
23212542 goto done;
23222543 }
23232544
....@@ -2332,9 +2553,11 @@
23322553 void (*callback)(void *cookie,
23332554 struct key_params *params))
23342555 {
2556
+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
23352557 struct key_params params;
23362558 struct brcmf_if *ifp = netdev_priv(ndev);
23372559 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
2560
+ struct brcmf_pub *drvr = cfg->pub;
23382561 struct brcmf_cfg80211_security *sec;
23392562 s32 wsec;
23402563 s32 err = 0;
....@@ -2348,7 +2571,7 @@
23482571
23492572 err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
23502573 if (err) {
2351
- brcmf_err("WLC_GET_WSEC error (%d)\n", err);
2574
+ bphy_err(drvr, "WLC_GET_WSEC error (%d)\n", err);
23522575 /* Ignore this error, may happen during DISASSOC */
23532576 err = -EAGAIN;
23542577 goto done;
....@@ -2369,7 +2592,7 @@
23692592 params.cipher = WLAN_CIPHER_SUITE_AES_CMAC;
23702593 brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_AES_CMAC\n");
23712594 } else {
2372
- brcmf_err("Invalid algo (0x%x)\n", wsec);
2595
+ bphy_err(drvr, "Invalid algo (0x%x)\n", wsec);
23732596 err = -EINVAL;
23742597 goto done;
23752598 }
....@@ -2399,6 +2622,7 @@
23992622 static void
24002623 brcmf_cfg80211_reconfigure_wep(struct brcmf_if *ifp)
24012624 {
2625
+ struct brcmf_pub *drvr = ifp->drvr;
24022626 s32 err;
24032627 u8 key_idx;
24042628 struct brcmf_wsec_key *key;
....@@ -2415,18 +2639,18 @@
24152639
24162640 err = send_key_to_dongle(ifp, key);
24172641 if (err) {
2418
- brcmf_err("Setting WEP key failed (%d)\n", err);
2642
+ bphy_err(drvr, "Setting WEP key failed (%d)\n", err);
24192643 return;
24202644 }
24212645 err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
24222646 if (err) {
2423
- brcmf_err("get wsec error (%d)\n", err);
2647
+ bphy_err(drvr, "get wsec error (%d)\n", err);
24242648 return;
24252649 }
24262650 wsec |= WEP_ENABLED;
24272651 err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
24282652 if (err)
2429
- brcmf_err("set wsec error (%d)\n", err);
2653
+ bphy_err(drvr, "set wsec error (%d)\n", err);
24302654 }
24312655
24322656 static void brcmf_convert_sta_flags(u32 fw_sta_flags, struct station_info *si)
....@@ -2452,6 +2676,7 @@
24522676
24532677 static void brcmf_fill_bss_param(struct brcmf_if *ifp, struct station_info *si)
24542678 {
2679
+ struct brcmf_pub *drvr = ifp->drvr;
24552680 struct {
24562681 __le32 len;
24572682 struct brcmf_bss_info_le bss_le;
....@@ -2467,7 +2692,7 @@
24672692 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO, buf,
24682693 WL_BSS_INFO_MAX);
24692694 if (err) {
2470
- brcmf_err("Failed to get bss info (%d)\n", err);
2695
+ bphy_err(drvr, "Failed to get bss info (%d)\n", err);
24712696 goto out_kfree;
24722697 }
24732698 si->filled |= BIT_ULL(NL80211_STA_INFO_BSS_PARAM);
....@@ -2489,6 +2714,7 @@
24892714 brcmf_cfg80211_get_station_ibss(struct brcmf_if *ifp,
24902715 struct station_info *sinfo)
24912716 {
2717
+ struct brcmf_pub *drvr = ifp->drvr;
24922718 struct brcmf_scb_val_le scbval;
24932719 struct brcmf_pktcnt_le pktcnt;
24942720 s32 err;
....@@ -2498,7 +2724,7 @@
24982724 /* Get the current tx rate */
24992725 err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_RATE, &rate);
25002726 if (err < 0) {
2501
- brcmf_err("BRCMF_C_GET_RATE error (%d)\n", err);
2727
+ bphy_err(drvr, "BRCMF_C_GET_RATE error (%d)\n", err);
25022728 return err;
25032729 }
25042730 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE);
....@@ -2508,7 +2734,7 @@
25082734 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI, &scbval,
25092735 sizeof(scbval));
25102736 if (err) {
2511
- brcmf_err("BRCMF_C_GET_RSSI error (%d)\n", err);
2737
+ bphy_err(drvr, "BRCMF_C_GET_RSSI error (%d)\n", err);
25122738 return err;
25132739 }
25142740 rssi = le32_to_cpu(scbval.val);
....@@ -2518,7 +2744,7 @@
25182744 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_GET_PKTCNTS, &pktcnt,
25192745 sizeof(pktcnt));
25202746 if (err) {
2521
- brcmf_err("BRCMF_C_GET_GET_PKTCNTS error (%d)\n", err);
2747
+ bphy_err(drvr, "BRCMF_C_GET_GET_PKTCNTS error (%d)\n", err);
25222748 return err;
25232749 }
25242750 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_PACKETS) |
....@@ -2537,7 +2763,9 @@
25372763 brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
25382764 const u8 *mac, struct station_info *sinfo)
25392765 {
2766
+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
25402767 struct brcmf_if *ifp = netdev_priv(ndev);
2768
+ struct brcmf_pub *drvr = cfg->pub;
25412769 struct brcmf_scb_val_le scb_val;
25422770 s32 err = 0;
25432771 struct brcmf_sta_info_le sta_info_le;
....@@ -2567,7 +2795,7 @@
25672795 &sta_info_le,
25682796 sizeof(sta_info_le));
25692797 if (err < 0) {
2570
- brcmf_err("GET STA INFO failed, %d\n", err);
2798
+ bphy_err(drvr, "GET STA INFO failed, %d\n", err);
25712799 goto done;
25722800 }
25732801 }
....@@ -2638,7 +2866,8 @@
26382866 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI,
26392867 &scb_val, sizeof(scb_val));
26402868 if (err) {
2641
- brcmf_err("Could not get rssi (%d)\n", err);
2869
+ bphy_err(drvr, "Could not get rssi (%d)\n",
2870
+ err);
26422871 goto done;
26432872 } else {
26442873 rssi = le32_to_cpu(scb_val.val);
....@@ -2659,6 +2888,7 @@
26592888 {
26602889 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
26612890 struct brcmf_if *ifp = netdev_priv(ndev);
2891
+ struct brcmf_pub *drvr = cfg->pub;
26622892 s32 err;
26632893
26642894 brcmf_dbg(TRACE, "Enter, idx %d\n", idx);
....@@ -2669,8 +2899,8 @@
26692899 &cfg->assoclist,
26702900 sizeof(cfg->assoclist));
26712901 if (err) {
2672
- brcmf_err("BRCMF_C_GET_ASSOCLIST unsupported, err=%d\n",
2673
- err);
2902
+ bphy_err(drvr, "BRCMF_C_GET_ASSOCLIST unsupported, err=%d\n",
2903
+ err);
26742904 cfg->assoclist.count = 0;
26752905 return -EOPNOTSUPP;
26762906 }
....@@ -2690,6 +2920,7 @@
26902920 s32 err = 0;
26912921 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
26922922 struct brcmf_if *ifp = netdev_priv(ndev);
2923
+ struct brcmf_pub *drvr = cfg->pub;
26932924
26942925 brcmf_dbg(TRACE, "Enter\n");
26952926
....@@ -2718,10 +2949,16 @@
27182949 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM, pm);
27192950 if (err) {
27202951 if (err == -ENODEV)
2721
- brcmf_err("net_device is not ready yet\n");
2952
+ bphy_err(drvr, "net_device is not ready yet\n");
27222953 else
2723
- brcmf_err("error (%d)\n", err);
2954
+ bphy_err(drvr, "error (%d)\n", err);
27242955 }
2956
+
2957
+ err = brcmf_fil_iovar_int_set(ifp, "pm2_sleep_ret",
2958
+ min_t(u32, timeout, BRCMF_PS_MAX_TIMEOUT_MS));
2959
+ if (err)
2960
+ bphy_err(drvr, "Unable to set pm timeout, (%d)\n", err);
2961
+
27252962 done:
27262963 brcmf_dbg(TRACE, "Exit\n");
27272964 return err;
....@@ -2731,6 +2968,7 @@
27312968 struct brcmf_bss_info_le *bi)
27322969 {
27332970 struct wiphy *wiphy = cfg_to_wiphy(cfg);
2971
+ struct brcmf_pub *drvr = cfg->pub;
27342972 struct cfg80211_bss *bss;
27352973 enum nl80211_band band;
27362974 struct brcmu_chan ch;
....@@ -2743,8 +2981,8 @@
27432981 struct cfg80211_inform_bss bss_data = {};
27442982
27452983 if (le32_to_cpu(bi->length) > WL_BSS_INFO_MAX) {
2746
- brcmf_err("Bss info is larger than buffer. Discarding\n");
2747
- return 0;
2984
+ bphy_err(drvr, "Bss info is larger than buffer. Discarding\n");
2985
+ return -EINVAL;
27482986 }
27492987
27502988 if (!bi->ctl_ch) {
....@@ -2802,6 +3040,7 @@
28023040
28033041 static s32 brcmf_inform_bss(struct brcmf_cfg80211_info *cfg)
28043042 {
3043
+ struct brcmf_pub *drvr = cfg->pub;
28053044 struct brcmf_scan_results *bss_list;
28063045 struct brcmf_bss_info_le *bi = NULL; /* must be initialized */
28073046 s32 err = 0;
....@@ -2810,8 +3049,8 @@
28103049 bss_list = (struct brcmf_scan_results *)cfg->escan_info.escan_buf;
28113050 if (bss_list->count != 0 &&
28123051 bss_list->version != BRCMF_BSS_INFO_VERSION) {
2813
- brcmf_err("Version %d != WL_BSS_INFO_VERSION\n",
2814
- bss_list->version);
3052
+ bphy_err(drvr, "Version %d != WL_BSS_INFO_VERSION\n",
3053
+ bss_list->version);
28153054 return -EOPNOTSUPP;
28163055 }
28173056 brcmf_dbg(SCAN, "scanned AP count (%d)\n", bss_list->count);
....@@ -2828,6 +3067,7 @@
28283067 struct net_device *ndev, const u8 *bssid)
28293068 {
28303069 struct wiphy *wiphy = cfg_to_wiphy(cfg);
3070
+ struct brcmf_pub *drvr = cfg->pub;
28313071 struct ieee80211_channel *notify_channel;
28323072 struct brcmf_bss_info_le *bi = NULL;
28333073 struct ieee80211_supported_band *band;
....@@ -2855,7 +3095,7 @@
28553095 err = brcmf_fil_cmd_data_get(netdev_priv(ndev), BRCMF_C_GET_BSS_INFO,
28563096 buf, WL_BSS_INFO_MAX);
28573097 if (err) {
2858
- brcmf_err("WLC_GET_BSS_INFO failed: %d\n", err);
3098
+ bphy_err(drvr, "WLC_GET_BSS_INFO failed: %d\n", err);
28593099 goto CleanUp;
28603100 }
28613101
....@@ -2909,10 +3149,9 @@
29093149 static s32 brcmf_update_bss_info(struct brcmf_cfg80211_info *cfg,
29103150 struct brcmf_if *ifp)
29113151 {
3152
+ struct brcmf_pub *drvr = cfg->pub;
29123153 struct brcmf_bss_info_le *bi;
29133154 const struct brcmf_tlv *tim;
2914
- u16 beacon_interval;
2915
- u8 dtim_period;
29163155 size_t ie_len;
29173156 u8 *ie;
29183157 s32 err = 0;
....@@ -2925,7 +3164,7 @@
29253164 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO,
29263165 cfg->extra_buf, WL_EXTRA_BUF_MAX);
29273166 if (err) {
2928
- brcmf_err("Could not get bss info %d\n", err);
3167
+ bphy_err(drvr, "Could not get bss info %d\n", err);
29293168 goto update_bss_info_out;
29303169 }
29313170
....@@ -2936,12 +3175,9 @@
29363175
29373176 ie = ((u8 *)bi) + le16_to_cpu(bi->ie_offset);
29383177 ie_len = le32_to_cpu(bi->ie_length);
2939
- beacon_interval = le16_to_cpu(bi->beacon_period);
29403178
29413179 tim = brcmf_parse_tlvs(ie, ie_len, WLAN_EID_TIM);
2942
- if (tim)
2943
- dtim_period = tim->data[1];
2944
- else {
3180
+ if (!tim) {
29453181 /*
29463182 * active scan was done so we could not get dtim
29473183 * information out of probe response.
....@@ -2950,10 +3186,9 @@
29503186 u32 var;
29513187 err = brcmf_fil_iovar_int_get(ifp, "dtim_assoc", &var);
29523188 if (err) {
2953
- brcmf_err("wl dtim_assoc failed (%d)\n", err);
3189
+ bphy_err(drvr, "wl dtim_assoc failed (%d)\n", err);
29543190 goto update_bss_info_out;
29553191 }
2956
- dtim_period = (u8)var;
29573192 }
29583193
29593194 update_bss_info_out:
....@@ -2988,9 +3223,10 @@
29883223 {
29893224 struct brcmf_cfg80211_info *cfg =
29903225 from_timer(cfg, t, escan_timeout);
3226
+ struct brcmf_pub *drvr = cfg->pub;
29913227
29923228 if (cfg->int_escan_map || cfg->scan_request) {
2993
- brcmf_err("timer expired\n");
3229
+ bphy_err(drvr, "timer expired\n");
29943230 schedule_work(&cfg->escan_timeout_work);
29953231 }
29963232 }
....@@ -3038,7 +3274,8 @@
30383274 brcmf_cfg80211_escan_handler(struct brcmf_if *ifp,
30393275 const struct brcmf_event_msg *e, void *data)
30403276 {
3041
- struct brcmf_cfg80211_info *cfg = ifp->drvr->config;
3277
+ struct brcmf_pub *drvr = ifp->drvr;
3278
+ struct brcmf_cfg80211_info *cfg = drvr->config;
30423279 s32 status;
30433280 struct brcmf_escan_result_le *escan_result_le;
30443281 u32 escan_buflen;
....@@ -3055,32 +3292,33 @@
30553292 goto exit;
30563293
30573294 if (!test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) {
3058
- brcmf_err("scan not ready, bsscfgidx=%d\n", ifp->bsscfgidx);
3295
+ bphy_err(drvr, "scan not ready, bsscfgidx=%d\n",
3296
+ ifp->bsscfgidx);
30593297 return -EPERM;
30603298 }
30613299
30623300 if (status == BRCMF_E_STATUS_PARTIAL) {
30633301 brcmf_dbg(SCAN, "ESCAN Partial result\n");
30643302 if (e->datalen < sizeof(*escan_result_le)) {
3065
- brcmf_err("invalid event data length\n");
3303
+ bphy_err(drvr, "invalid event data length\n");
30663304 goto exit;
30673305 }
30683306 escan_result_le = (struct brcmf_escan_result_le *) data;
30693307 if (!escan_result_le) {
3070
- brcmf_err("Invalid escan result (NULL pointer)\n");
3308
+ bphy_err(drvr, "Invalid escan result (NULL pointer)\n");
30713309 goto exit;
30723310 }
30733311 escan_buflen = le32_to_cpu(escan_result_le->buflen);
30743312 if (escan_buflen > BRCMF_ESCAN_BUF_SIZE ||
30753313 escan_buflen > e->datalen ||
30763314 escan_buflen < sizeof(*escan_result_le)) {
3077
- brcmf_err("Invalid escan buffer length: %d\n",
3078
- escan_buflen);
3315
+ bphy_err(drvr, "Invalid escan buffer length: %d\n",
3316
+ escan_buflen);
30793317 goto exit;
30803318 }
30813319 if (le16_to_cpu(escan_result_le->bss_count) != 1) {
3082
- brcmf_err("Invalid bss_count %d: ignoring\n",
3083
- escan_result_le->bss_count);
3320
+ bphy_err(drvr, "Invalid bss_count %d: ignoring\n",
3321
+ escan_result_le->bss_count);
30843322 goto exit;
30853323 }
30863324 bss_info_le = &escan_result_le->bss_info_le;
....@@ -3095,8 +3333,8 @@
30953333
30963334 bi_length = le32_to_cpu(bss_info_le->length);
30973335 if (bi_length != escan_buflen - WL_ESCAN_RESULTS_FIXED_SIZE) {
3098
- brcmf_err("Ignoring invalid bss_info length: %d\n",
3099
- bi_length);
3336
+ bphy_err(drvr, "Ignoring invalid bss_info length: %d\n",
3337
+ bi_length);
31003338 goto exit;
31013339 }
31023340
....@@ -3104,7 +3342,7 @@
31043342 BIT(NL80211_IFTYPE_ADHOC))) {
31053343 if (le16_to_cpu(bss_info_le->capability) &
31063344 WLAN_CAPABILITY_IBSS) {
3107
- brcmf_err("Ignoring IBSS result\n");
3345
+ bphy_err(drvr, "Ignoring IBSS result\n");
31083346 goto exit;
31093347 }
31103348 }
....@@ -3112,7 +3350,7 @@
31123350 list = (struct brcmf_scan_results *)
31133351 cfg->escan_info.escan_buf;
31143352 if (bi_length > BRCMF_ESCAN_BUF_SIZE - list->buflen) {
3115
- brcmf_err("Buffer is too small: ignoring\n");
3353
+ bphy_err(drvr, "Buffer is too small: ignoring\n");
31163354 goto exit;
31173355 }
31183356
....@@ -3248,7 +3486,7 @@
32483486 switch (pfn_v1->version) {
32493487 default:
32503488 WARN_ON(1);
3251
- /* fall-thru */
3489
+ fallthrough;
32523490 case cpu_to_le32(1):
32533491 netinfo = (struct brcmf_pno_net_info_le *)(pfn_v1 + 1);
32543492 break;
....@@ -3271,7 +3509,8 @@
32713509 brcmf_notify_sched_scan_results(struct brcmf_if *ifp,
32723510 const struct brcmf_event_msg *e, void *data)
32733511 {
3274
- struct brcmf_cfg80211_info *cfg = ifp->drvr->config;
3512
+ struct brcmf_pub *drvr = ifp->drvr;
3513
+ struct brcmf_cfg80211_info *cfg = drvr->config;
32753514 struct brcmf_pno_net_info_le *netinfo, *netinfo_start;
32763515 struct cfg80211_scan_request *request = NULL;
32773516 struct wiphy *wiphy = cfg_to_wiphy(cfg);
....@@ -3304,14 +3543,14 @@
33043543 WARN_ON(status != BRCMF_PNO_SCAN_COMPLETE);
33053544 brcmf_dbg(SCAN, "PFN NET FOUND event. count: %d\n", result_count);
33063545 if (!result_count) {
3307
- brcmf_err("FALSE PNO Event. (pfn_count == 0)\n");
3546
+ bphy_err(drvr, "FALSE PNO Event. (pfn_count == 0)\n");
33083547 goto out_err;
33093548 }
33103549
33113550 netinfo_start = brcmf_get_netinfo_array(pfn_result);
33123551 datalen = e->datalen - ((void *)netinfo_start - (void *)pfn_result);
33133552 if (datalen < result_count * sizeof(*netinfo)) {
3314
- brcmf_err("insufficient event data\n");
3553
+ bphy_err(drvr, "insufficient event data\n");
33153554 goto out_err;
33163555 }
33173556
....@@ -3358,15 +3597,16 @@
33583597 struct net_device *ndev,
33593598 struct cfg80211_sched_scan_request *req)
33603599 {
3361
- struct brcmf_if *ifp = netdev_priv(ndev);
33623600 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
3601
+ struct brcmf_if *ifp = netdev_priv(ndev);
3602
+ struct brcmf_pub *drvr = cfg->pub;
33633603
33643604 brcmf_dbg(SCAN, "Enter: n_match_sets=%d n_ssids=%d\n",
33653605 req->n_match_sets, req->n_ssids);
33663606
33673607 if (test_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status)) {
3368
- brcmf_err("Scanning suppressed: status=%lu\n",
3369
- cfg->scan_status);
3608
+ bphy_err(drvr, "Scanning suppressed: status=%lu\n",
3609
+ cfg->scan_status);
33703610 return -EAGAIN;
33713611 }
33723612
....@@ -3444,7 +3684,8 @@
34443684 brcmf_wowl_nd_results(struct brcmf_if *ifp, const struct brcmf_event_msg *e,
34453685 void *data)
34463686 {
3447
- struct brcmf_cfg80211_info *cfg = ifp->drvr->config;
3687
+ struct brcmf_pub *drvr = ifp->drvr;
3688
+ struct brcmf_cfg80211_info *cfg = drvr->config;
34483689 struct brcmf_pno_scanresults_le *pfn_result;
34493690 struct brcmf_pno_net_info_le *netinfo;
34503691
....@@ -3463,8 +3704,8 @@
34633704 }
34643705
34653706 if (le32_to_cpu(pfn_result->count) < 1) {
3466
- brcmf_err("Invalid result count, expected 1 (%d)\n",
3467
- le32_to_cpu(pfn_result->count));
3707
+ bphy_err(drvr, "Invalid result count, expected 1 (%d)\n",
3708
+ le32_to_cpu(pfn_result->count));
34683709 return -EINVAL;
34693710 }
34703711
....@@ -3493,6 +3734,7 @@
34933734 static void brcmf_report_wowl_wakeind(struct wiphy *wiphy, struct brcmf_if *ifp)
34943735 {
34953736 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
3737
+ struct brcmf_pub *drvr = cfg->pub;
34963738 struct brcmf_wowl_wakeind_le wake_ind_le;
34973739 struct cfg80211_wowlan_wakeup wakeup_data;
34983740 struct cfg80211_wowlan_wakeup *wakeup;
....@@ -3503,7 +3745,7 @@
35033745 err = brcmf_fil_iovar_data_get(ifp, "wowl_wakeind", &wake_ind_le,
35043746 sizeof(wake_ind_le));
35053747 if (err) {
3506
- brcmf_err("Get wowl_wakeind failed, err = %d\n", err);
3748
+ bphy_err(drvr, "Get wowl_wakeind failed, err = %d\n", err);
35073749 return;
35083750 }
35093751
....@@ -3544,7 +3786,7 @@
35443786 cfg->wowl.nd_data_completed,
35453787 BRCMF_ND_INFO_TIMEOUT);
35463788 if (!timeout)
3547
- brcmf_err("No result for wowl net detect\n");
3789
+ bphy_err(drvr, "No result for wowl net detect\n");
35483790 else
35493791 wakeup_data.net_detect = cfg->wowl.nd_info;
35503792 }
....@@ -3683,7 +3925,7 @@
36833925 * disassociate from AP to save power while system is
36843926 * in suspended state
36853927 */
3686
- brcmf_link_down(vif, WLAN_REASON_UNSPECIFIED);
3928
+ brcmf_link_down(vif, WLAN_REASON_UNSPECIFIED, true);
36873929 /* Make sure WPA_Supplicant receives all the event
36883930 * generated due to DISASSOC call to the fw to keep
36893931 * the state fw and WPA_Supplicant state consistent
....@@ -3733,6 +3975,7 @@
37333975 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
37343976 struct brcmf_if *ifp = netdev_priv(ndev);
37353977 struct brcmf_pmksa *pmk = &cfg->pmk_list.pmk[0];
3978
+ struct brcmf_pub *drvr = cfg->pub;
37363979 s32 err;
37373980 u32 npmk, i;
37383981
....@@ -3752,15 +3995,12 @@
37523995 cfg->pmk_list.npmk = cpu_to_le32(npmk);
37533996 }
37543997 } else {
3755
- brcmf_err("Too many PMKSA entries cached %d\n", npmk);
3998
+ bphy_err(drvr, "Too many PMKSA entries cached %d\n", npmk);
37563999 return -EINVAL;
37574000 }
37584001
37594002 brcmf_dbg(CONN, "set_pmksa - PMK bssid: %pM =\n", pmk[npmk].bssid);
3760
- for (i = 0; i < WLAN_PMKID_LEN; i += 4)
3761
- brcmf_dbg(CONN, "%02x %02x %02x %02x\n", pmk[npmk].pmkid[i],
3762
- pmk[npmk].pmkid[i + 1], pmk[npmk].pmkid[i + 2],
3763
- pmk[npmk].pmkid[i + 3]);
4003
+ brcmf_dbg(CONN, "%*ph\n", WLAN_PMKID_LEN, pmk[npmk].pmkid);
37644004
37654005 err = brcmf_update_pmklist(cfg, ifp);
37664006
....@@ -3775,6 +4015,7 @@
37754015 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
37764016 struct brcmf_if *ifp = netdev_priv(ndev);
37774017 struct brcmf_pmksa *pmk = &cfg->pmk_list.pmk[0];
4018
+ struct brcmf_pub *drvr = cfg->pub;
37784019 s32 err;
37794020 u32 npmk, i;
37804021
....@@ -3798,7 +4039,7 @@
37984039 memset(&pmk[i], 0, sizeof(*pmk));
37994040 cfg->pmk_list.npmk = cpu_to_le32(npmk - 1);
38004041 } else {
3801
- brcmf_err("Cache entry not found\n");
4042
+ bphy_err(drvr, "Cache entry not found\n");
38024043 return -EINVAL;
38034044 }
38044045
....@@ -3830,19 +4071,20 @@
38304071
38314072 static s32 brcmf_configure_opensecurity(struct brcmf_if *ifp)
38324073 {
4074
+ struct brcmf_pub *drvr = ifp->drvr;
38334075 s32 err;
38344076 s32 wpa_val;
38354077
38364078 /* set auth */
38374079 err = brcmf_fil_bsscfg_int_set(ifp, "auth", 0);
38384080 if (err < 0) {
3839
- brcmf_err("auth error %d\n", err);
4081
+ bphy_err(drvr, "auth error %d\n", err);
38404082 return err;
38414083 }
38424084 /* set wsec */
38434085 err = brcmf_fil_bsscfg_int_set(ifp, "wsec", 0);
38444086 if (err < 0) {
3845
- brcmf_err("wsec error %d\n", err);
4087
+ bphy_err(drvr, "wsec error %d\n", err);
38464088 return err;
38474089 }
38484090 /* set upper-layer auth */
....@@ -3852,7 +4094,7 @@
38524094 wpa_val = WPA_AUTH_DISABLED;
38534095 err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", wpa_val);
38544096 if (err < 0) {
3855
- brcmf_err("wpa_auth error %d\n", err);
4097
+ bphy_err(drvr, "wpa_auth error %d\n", err);
38564098 return err;
38574099 }
38584100
....@@ -3872,6 +4114,7 @@
38724114 const struct brcmf_vs_tlv *wpa_ie,
38734115 bool is_rsn_ie)
38744116 {
4117
+ struct brcmf_pub *drvr = ifp->drvr;
38754118 u32 auth = 0; /* d11 open authentication */
38764119 u16 count;
38774120 s32 err = 0;
....@@ -3902,13 +4145,13 @@
39024145 /* check for multicast cipher suite */
39034146 if (offset + WPA_IE_MIN_OUI_LEN > len) {
39044147 err = -EINVAL;
3905
- brcmf_err("no multicast cipher suite\n");
4148
+ bphy_err(drvr, "no multicast cipher suite\n");
39064149 goto exit;
39074150 }
39084151
39094152 if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) {
39104153 err = -EINVAL;
3911
- brcmf_err("ivalid OUI\n");
4154
+ bphy_err(drvr, "ivalid OUI\n");
39124155 goto exit;
39134156 }
39144157 offset += TLV_OUI_LEN;
....@@ -3930,7 +4173,7 @@
39304173 break;
39314174 default:
39324175 err = -EINVAL;
3933
- brcmf_err("Invalid multi cast cipher info\n");
4176
+ bphy_err(drvr, "Invalid multi cast cipher info\n");
39344177 goto exit;
39354178 }
39364179
....@@ -3941,13 +4184,13 @@
39414184 /* Check for unicast suite(s) */
39424185 if (offset + (WPA_IE_MIN_OUI_LEN * count) > len) {
39434186 err = -EINVAL;
3944
- brcmf_err("no unicast cipher suite\n");
4187
+ bphy_err(drvr, "no unicast cipher suite\n");
39454188 goto exit;
39464189 }
39474190 for (i = 0; i < count; i++) {
39484191 if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) {
39494192 err = -EINVAL;
3950
- brcmf_err("ivalid OUI\n");
4193
+ bphy_err(drvr, "ivalid OUI\n");
39514194 goto exit;
39524195 }
39534196 offset += TLV_OUI_LEN;
....@@ -3965,7 +4208,7 @@
39654208 pval |= AES_ENABLED;
39664209 break;
39674210 default:
3968
- brcmf_err("Invalid unicast security info\n");
4211
+ bphy_err(drvr, "Invalid unicast security info\n");
39694212 }
39704213 offset++;
39714214 }
....@@ -3975,13 +4218,13 @@
39754218 /* Check for auth key management suite(s) */
39764219 if (offset + (WPA_IE_MIN_OUI_LEN * count) > len) {
39774220 err = -EINVAL;
3978
- brcmf_err("no auth key mgmt suite\n");
4221
+ bphy_err(drvr, "no auth key mgmt suite\n");
39794222 goto exit;
39804223 }
39814224 for (i = 0; i < count; i++) {
39824225 if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) {
39834226 err = -EINVAL;
3984
- brcmf_err("ivalid OUI\n");
4227
+ bphy_err(drvr, "ivalid OUI\n");
39854228 goto exit;
39864229 }
39874230 offset += TLV_OUI_LEN;
....@@ -4008,8 +4251,12 @@
40084251 brcmf_dbg(TRACE, "RSN_AKM_MFP_1X\n");
40094252 wpa_auth |= WPA2_AUTH_1X_SHA256;
40104253 break;
4254
+ case RSN_AKM_SAE:
4255
+ brcmf_dbg(TRACE, "RSN_AKM_SAE\n");
4256
+ wpa_auth |= WPA3_AUTH_SAE_PSK;
4257
+ break;
40114258 default:
4012
- brcmf_err("Invalid key mgmt info\n");
4259
+ bphy_err(drvr, "Invalid key mgmt info\n");
40134260 }
40144261 offset++;
40154262 }
....@@ -4025,11 +4272,12 @@
40254272 brcmf_dbg(TRACE, "MFP Required\n");
40264273 mfp = BRCMF_MFP_REQUIRED;
40274274 /* Firmware only supports mfp required in
4028
- * combination with WPA2_AUTH_PSK_SHA256 or
4029
- * WPA2_AUTH_1X_SHA256.
4275
+ * combination with WPA2_AUTH_PSK_SHA256,
4276
+ * WPA2_AUTH_1X_SHA256, or WPA3_AUTH_SAE_PSK.
40304277 */
40314278 if (!(wpa_auth & (WPA2_AUTH_PSK_SHA256 |
4032
- WPA2_AUTH_1X_SHA256))) {
4279
+ WPA2_AUTH_1X_SHA256 |
4280
+ WPA3_AUTH_SAE_PSK))) {
40334281 err = -EINVAL;
40344282 goto exit;
40354283 }
....@@ -4051,7 +4299,7 @@
40514299 err = brcmf_fil_bsscfg_int_set(ifp, "wme_bss_disable",
40524300 wme_bss_disable);
40534301 if (err < 0) {
4054
- brcmf_err("wme_bss_disable error %d\n", err);
4302
+ bphy_err(drvr, "wme_bss_disable error %d\n", err);
40554303 goto exit;
40564304 }
40574305
....@@ -4065,7 +4313,7 @@
40654313 &data[offset],
40664314 WPA_IE_MIN_OUI_LEN);
40674315 if (err < 0) {
4068
- brcmf_err("bip error %d\n", err);
4316
+ bphy_err(drvr, "bip error %d\n", err);
40694317 goto exit;
40704318 }
40714319 }
....@@ -4076,13 +4324,13 @@
40764324 /* set auth */
40774325 err = brcmf_fil_bsscfg_int_set(ifp, "auth", auth);
40784326 if (err < 0) {
4079
- brcmf_err("auth error %d\n", err);
4327
+ bphy_err(drvr, "auth error %d\n", err);
40804328 goto exit;
40814329 }
40824330 /* set wsec */
40834331 err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
40844332 if (err < 0) {
4085
- brcmf_err("wsec error %d\n", err);
4333
+ bphy_err(drvr, "wsec error %d\n", err);
40864334 goto exit;
40874335 }
40884336 /* Configure MFP, this needs to go after wsec otherwise the wsec command
....@@ -4091,14 +4339,14 @@
40914339 if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MFP)) {
40924340 err = brcmf_fil_bsscfg_int_set(ifp, "mfp", mfp);
40934341 if (err < 0) {
4094
- brcmf_err("mfp error %d\n", err);
4342
+ bphy_err(drvr, "mfp error %d\n", err);
40954343 goto exit;
40964344 }
40974345 }
40984346 /* set upper-layer auth */
40994347 err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", wpa_auth);
41004348 if (err < 0) {
4101
- brcmf_err("wpa_auth error %d\n", err);
4349
+ bphy_err(drvr, "wpa_auth error %d\n", err);
41024350 goto exit;
41034351 }
41044352
....@@ -4146,10 +4394,8 @@
41464394
41474395 vndr_ies->count++;
41484396
4149
- brcmf_dbg(TRACE, "** OUI %02x %02x %02x, type 0x%02x\n",
4150
- parsed_info->vndrie.oui[0],
4151
- parsed_info->vndrie.oui[1],
4152
- parsed_info->vndrie.oui[2],
4397
+ brcmf_dbg(TRACE, "** OUI %3ph, type 0x%02x\n",
4398
+ parsed_info->vndrie.oui,
41534399 parsed_info->vndrie.oui_type);
41544400
41554401 if (vndr_ies->count >= VNDR_IE_PARSE_LIMIT)
....@@ -4168,9 +4414,7 @@
41684414 static u32
41694415 brcmf_vndr_ie(u8 *iebuf, s32 pktflag, u8 *ie_ptr, u32 ie_len, s8 *add_del_cmd)
41704416 {
4171
-
4172
- strncpy(iebuf, add_del_cmd, VNDR_IE_CMD_LEN - 1);
4173
- iebuf[VNDR_IE_CMD_LEN - 1] = '\0';
4417
+ strscpy(iebuf, add_del_cmd, VNDR_IE_CMD_LEN);
41744418
41754419 put_unaligned_le32(1, &iebuf[VNDR_IE_COUNT_OFFSET]);
41764420
....@@ -4184,6 +4428,7 @@
41844428 s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag,
41854429 const u8 *vndr_ie_buf, u32 vndr_ie_len)
41864430 {
4431
+ struct brcmf_pub *drvr;
41874432 struct brcmf_if *ifp;
41884433 struct vif_saved_ie *saved_ie;
41894434 s32 err = 0;
....@@ -4205,6 +4450,7 @@
42054450 if (!vif)
42064451 return -ENODEV;
42074452 ifp = vif->ifp;
4453
+ drvr = ifp->drvr;
42084454 saved_ie = &vif->saved_ie;
42094455
42104456 brcmf_dbg(TRACE, "bsscfgidx %d, pktflag : 0x%02X\n", ifp->bsscfgidx,
....@@ -4234,15 +4480,20 @@
42344480 mgmt_ie_len = &saved_ie->assoc_req_ie_len;
42354481 mgmt_ie_buf_len = sizeof(saved_ie->assoc_req_ie);
42364482 break;
4483
+ case BRCMF_VNDR_IE_ASSOCRSP_FLAG:
4484
+ mgmt_ie_buf = saved_ie->assoc_res_ie;
4485
+ mgmt_ie_len = &saved_ie->assoc_res_ie_len;
4486
+ mgmt_ie_buf_len = sizeof(saved_ie->assoc_res_ie);
4487
+ break;
42374488 default:
42384489 err = -EPERM;
4239
- brcmf_err("not suitable type\n");
4490
+ bphy_err(drvr, "not suitable type\n");
42404491 goto exit;
42414492 }
42424493
42434494 if (vndr_ie_len > mgmt_ie_buf_len) {
42444495 err = -ENOMEM;
4245
- brcmf_err("extra IE size too big\n");
4496
+ bphy_err(drvr, "extra IE size too big\n");
42464497 goto exit;
42474498 }
42484499
....@@ -4273,12 +4524,10 @@
42734524 for (i = 0; i < old_vndr_ies.count; i++) {
42744525 vndrie_info = &old_vndr_ies.ie_info[i];
42754526
4276
- brcmf_dbg(TRACE, "DEL ID : %d, Len: %d , OUI:%02x:%02x:%02x\n",
4527
+ brcmf_dbg(TRACE, "DEL ID : %d, Len: %d , OUI:%3ph\n",
42774528 vndrie_info->vndrie.id,
42784529 vndrie_info->vndrie.len,
4279
- vndrie_info->vndrie.oui[0],
4280
- vndrie_info->vndrie.oui[1],
4281
- vndrie_info->vndrie.oui[2]);
4530
+ vndrie_info->vndrie.oui);
42824531
42834532 del_add_ie_buf_len = brcmf_vndr_ie(curr_ie_buf, pktflag,
42844533 vndrie_info->ie_ptr,
....@@ -4303,19 +4552,17 @@
43034552 /* verify remained buf size before copy data */
43044553 if (remained_buf_len < (vndrie_info->vndrie.len +
43054554 VNDR_IE_VSIE_OFFSET)) {
4306
- brcmf_err("no space in mgmt_ie_buf: len left %d",
4307
- remained_buf_len);
4555
+ bphy_err(drvr, "no space in mgmt_ie_buf: len left %d",
4556
+ remained_buf_len);
43084557 break;
43094558 }
43104559 remained_buf_len -= (vndrie_info->ie_len +
43114560 VNDR_IE_VSIE_OFFSET);
43124561
4313
- brcmf_dbg(TRACE, "ADDED ID : %d, Len: %d, OUI:%02x:%02x:%02x\n",
4562
+ brcmf_dbg(TRACE, "ADDED ID : %d, Len: %d, OUI:%3ph\n",
43144563 vndrie_info->vndrie.id,
43154564 vndrie_info->vndrie.len,
4316
- vndrie_info->vndrie.oui[0],
4317
- vndrie_info->vndrie.oui[1],
4318
- vndrie_info->vndrie.oui[2]);
4565
+ vndrie_info->vndrie.oui);
43194566
43204567 del_add_ie_buf_len = brcmf_vndr_ie(curr_ie_buf, pktflag,
43214568 vndrie_info->ie_ptr,
....@@ -4335,7 +4582,7 @@
43354582 err = brcmf_fil_bsscfg_data_set(ifp, "vndr_ie", iovar_ie_buf,
43364583 total_ie_buf_len);
43374584 if (err)
4338
- brcmf_err("vndr ie set error : %d\n", err);
4585
+ bphy_err(drvr, "vndr ie set error : %d\n", err);
43394586 }
43404587
43414588 exit:
....@@ -4363,13 +4610,14 @@
43634610 brcmf_config_ap_mgmt_ie(struct brcmf_cfg80211_vif *vif,
43644611 struct cfg80211_beacon_data *beacon)
43654612 {
4613
+ struct brcmf_pub *drvr = vif->ifp->drvr;
43664614 s32 err;
43674615
43684616 /* Set Beacon IEs to FW */
43694617 err = brcmf_vif_set_mgmt_ie(vif, BRCMF_VNDR_IE_BEACON_FLAG,
43704618 beacon->tail, beacon->tail_len);
43714619 if (err) {
4372
- brcmf_err("Set Beacon IE Failed\n");
4620
+ bphy_err(drvr, "Set Beacon IE Failed\n");
43734621 return err;
43744622 }
43754623 brcmf_dbg(TRACE, "Applied Vndr IEs for Beacon\n");
....@@ -4379,9 +4627,60 @@
43794627 beacon->proberesp_ies,
43804628 beacon->proberesp_ies_len);
43814629 if (err)
4382
- brcmf_err("Set Probe Resp IE Failed\n");
4630
+ bphy_err(drvr, "Set Probe Resp IE Failed\n");
43834631 else
43844632 brcmf_dbg(TRACE, "Applied Vndr IEs for Probe Resp\n");
4633
+
4634
+ /* Set Assoc Response IEs to FW */
4635
+ err = brcmf_vif_set_mgmt_ie(vif, BRCMF_VNDR_IE_ASSOCRSP_FLAG,
4636
+ beacon->assocresp_ies,
4637
+ beacon->assocresp_ies_len);
4638
+ if (err)
4639
+ brcmf_err("Set Assoc Resp IE Failed\n");
4640
+ else
4641
+ brcmf_dbg(TRACE, "Applied Vndr IEs for Assoc Resp\n");
4642
+
4643
+ return err;
4644
+}
4645
+
4646
+static s32
4647
+brcmf_parse_configure_security(struct brcmf_if *ifp,
4648
+ struct cfg80211_ap_settings *settings,
4649
+ enum nl80211_iftype dev_role)
4650
+{
4651
+ const struct brcmf_tlv *rsn_ie;
4652
+ const struct brcmf_vs_tlv *wpa_ie;
4653
+ s32 err = 0;
4654
+
4655
+ /* find the RSN_IE */
4656
+ rsn_ie = brcmf_parse_tlvs((u8 *)settings->beacon.tail,
4657
+ settings->beacon.tail_len, WLAN_EID_RSN);
4658
+
4659
+ /* find the WPA_IE */
4660
+ wpa_ie = brcmf_find_wpaie((u8 *)settings->beacon.tail,
4661
+ settings->beacon.tail_len);
4662
+
4663
+ if (wpa_ie || rsn_ie) {
4664
+ brcmf_dbg(TRACE, "WPA(2) IE is found\n");
4665
+ if (wpa_ie) {
4666
+ /* WPA IE */
4667
+ err = brcmf_configure_wpaie(ifp, wpa_ie, false);
4668
+ if (err < 0)
4669
+ return err;
4670
+ } else {
4671
+ struct brcmf_vs_tlv *tmp_ie;
4672
+
4673
+ tmp_ie = (struct brcmf_vs_tlv *)rsn_ie;
4674
+
4675
+ /* RSN IE */
4676
+ err = brcmf_configure_wpaie(ifp, tmp_ie, true);
4677
+ if (err < 0)
4678
+ return err;
4679
+ }
4680
+ } else {
4681
+ brcmf_dbg(TRACE, "No WPA(2) IEs found\n");
4682
+ brcmf_configure_opensecurity(ifp);
4683
+ }
43854684
43864685 return err;
43874686 }
....@@ -4393,12 +4692,13 @@
43934692 s32 ie_offset;
43944693 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
43954694 struct brcmf_if *ifp = netdev_priv(ndev);
4695
+ struct brcmf_pub *drvr = cfg->pub;
4696
+ struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
4697
+ struct cfg80211_crypto_settings *crypto = &settings->crypto;
43964698 const struct brcmf_tlv *ssid_ie;
43974699 const struct brcmf_tlv *country_ie;
43984700 struct brcmf_ssid_le ssid_le;
43994701 s32 err = -EPERM;
4400
- const struct brcmf_tlv *rsn_ie;
4401
- const struct brcmf_vs_tlv *wpa_ie;
44024702 struct brcmf_join_params join_params;
44034703 enum nl80211_iftype dev_role;
44044704 struct brcmf_fil_bss_enable_le bss_enable;
....@@ -4452,43 +4752,14 @@
44524752 brcmf_configure_arp_nd_offload(ifp, false);
44534753 }
44544754
4455
- /* find the RSN_IE */
4456
- rsn_ie = brcmf_parse_tlvs((u8 *)settings->beacon.tail,
4457
- settings->beacon.tail_len, WLAN_EID_RSN);
4458
-
4459
- /* find the WPA_IE */
4460
- wpa_ie = brcmf_find_wpaie((u8 *)settings->beacon.tail,
4461
- settings->beacon.tail_len);
4462
-
4463
- if ((wpa_ie != NULL || rsn_ie != NULL)) {
4464
- brcmf_dbg(TRACE, "WPA(2) IE is found\n");
4465
- if (wpa_ie != NULL) {
4466
- /* WPA IE */
4467
- err = brcmf_configure_wpaie(ifp, wpa_ie, false);
4468
- if (err < 0)
4469
- goto exit;
4470
- } else {
4471
- struct brcmf_vs_tlv *tmp_ie;
4472
-
4473
- tmp_ie = (struct brcmf_vs_tlv *)rsn_ie;
4474
-
4475
- /* RSN IE */
4476
- err = brcmf_configure_wpaie(ifp, tmp_ie, true);
4477
- if (err < 0)
4478
- goto exit;
4479
- }
4480
- } else {
4481
- brcmf_dbg(TRACE, "No WPA(2) IEs found\n");
4482
- brcmf_configure_opensecurity(ifp);
4483
- }
4484
-
44854755 /* Parameters shared by all radio interfaces */
44864756 if (!mbss) {
44874757 if ((supports_11d) && (is_11d != ifp->vif->is_11d)) {
44884758 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY,
44894759 is_11d);
44904760 if (err < 0) {
4491
- brcmf_err("Regulatory Set Error, %d\n", err);
4761
+ bphy_err(drvr, "Regulatory Set Error, %d\n",
4762
+ err);
44924763 goto exit;
44934764 }
44944765 }
....@@ -4496,8 +4767,8 @@
44964767 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD,
44974768 settings->beacon_interval);
44984769 if (err < 0) {
4499
- brcmf_err("Beacon Interval Set Error, %d\n",
4500
- err);
4770
+ bphy_err(drvr, "Beacon Interval Set Error, %d\n",
4771
+ err);
45014772 goto exit;
45024773 }
45034774 }
....@@ -4505,17 +4776,20 @@
45054776 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_DTIMPRD,
45064777 settings->dtim_period);
45074778 if (err < 0) {
4508
- brcmf_err("DTIM Interval Set Error, %d\n", err);
4779
+ bphy_err(drvr, "DTIM Interval Set Error, %d\n",
4780
+ err);
45094781 goto exit;
45104782 }
45114783 }
45124784
45134785 if ((dev_role == NL80211_IFTYPE_AP) &&
45144786 ((ifp->ifidx == 0) ||
4515
- !brcmf_feat_is_enabled(ifp, BRCMF_FEAT_RSDB))) {
4787
+ (!brcmf_feat_is_enabled(ifp, BRCMF_FEAT_RSDB) &&
4788
+ !brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN)))) {
45164789 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1);
45174790 if (err < 0) {
4518
- brcmf_err("BRCMF_C_DOWN error %d\n", err);
4791
+ bphy_err(drvr, "BRCMF_C_DOWN error %d\n",
4792
+ err);
45194793 goto exit;
45204794 }
45214795 brcmf_fil_iovar_int_set(ifp, "apsta", 0);
....@@ -4523,7 +4797,7 @@
45234797
45244798 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, 1);
45254799 if (err < 0) {
4526
- brcmf_err("SET INFRA error %d\n", err);
4800
+ bphy_err(drvr, "SET INFRA error %d\n", err);
45274801 goto exit;
45284802 }
45294803 } else if (WARN_ON(supports_11d && (is_11d != ifp->vif->is_11d))) {
....@@ -4539,7 +4813,8 @@
45394813
45404814 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 1);
45414815 if (err < 0) {
4542
- brcmf_err("setting AP mode failed %d\n", err);
4816
+ bphy_err(drvr, "setting AP mode failed %d\n",
4817
+ err);
45434818 goto exit;
45444819 }
45454820 if (!mbss) {
....@@ -4548,16 +4823,43 @@
45484823 */
45494824 err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec);
45504825 if (err < 0) {
4551
- brcmf_err("Set Channel failed: chspec=%d, %d\n",
4552
- chanspec, err);
4826
+ bphy_err(drvr, "Set Channel failed: chspec=%d, %d\n",
4827
+ chanspec, err);
45534828 goto exit;
45544829 }
45554830 }
45564831 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1);
45574832 if (err < 0) {
4558
- brcmf_err("BRCMF_C_UP error (%d)\n", err);
4833
+ bphy_err(drvr, "BRCMF_C_UP error (%d)\n", err);
45594834 goto exit;
45604835 }
4836
+
4837
+ if (crypto->psk) {
4838
+ brcmf_dbg(INFO, "using PSK offload\n");
4839
+ profile->use_fwauth |= BIT(BRCMF_PROFILE_FWAUTH_PSK);
4840
+ err = brcmf_set_pmk(ifp, crypto->psk,
4841
+ BRCMF_WSEC_MAX_PSK_LEN);
4842
+ if (err < 0)
4843
+ goto exit;
4844
+ }
4845
+ if (crypto->sae_pwd) {
4846
+ brcmf_dbg(INFO, "using SAE offload\n");
4847
+ profile->use_fwauth |= BIT(BRCMF_PROFILE_FWAUTH_SAE);
4848
+ err = brcmf_set_sae_password(ifp, crypto->sae_pwd,
4849
+ crypto->sae_pwd_len);
4850
+ if (err < 0)
4851
+ goto exit;
4852
+ }
4853
+ if (profile->use_fwauth == 0)
4854
+ profile->use_fwauth = BIT(BRCMF_PROFILE_FWAUTH_NONE);
4855
+
4856
+ err = brcmf_parse_configure_security(ifp, settings,
4857
+ NL80211_IFTYPE_AP);
4858
+ if (err < 0) {
4859
+ bphy_err(drvr, "brcmf_parse_configure_security error\n");
4860
+ goto exit;
4861
+ }
4862
+
45614863 /* On DOWN the firmware removes the WEP keys, reconfigure
45624864 * them if they were set.
45634865 */
....@@ -4570,30 +4872,40 @@
45704872 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
45714873 &join_params, sizeof(join_params));
45724874 if (err < 0) {
4573
- brcmf_err("SET SSID error (%d)\n", err);
4875
+ bphy_err(drvr, "SET SSID error (%d)\n", err);
45744876 goto exit;
45754877 }
45764878
4577
- if (settings->hidden_ssid) {
4578
- err = brcmf_fil_iovar_int_set(ifp, "closednet", 1);
4579
- if (err) {
4580
- brcmf_err("closednet error (%d)\n", err);
4581
- goto exit;
4582
- }
4879
+ err = brcmf_fil_iovar_int_set(ifp, "closednet",
4880
+ settings->hidden_ssid);
4881
+ if (err) {
4882
+ bphy_err(drvr, "%s closednet error (%d)\n",
4883
+ settings->hidden_ssid ?
4884
+ "enabled" : "disabled",
4885
+ err);
4886
+ goto exit;
45834887 }
45844888
45854889 brcmf_dbg(TRACE, "AP mode configuration complete\n");
45864890 } else if (dev_role == NL80211_IFTYPE_P2P_GO) {
45874891 err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec);
45884892 if (err < 0) {
4589
- brcmf_err("Set Channel failed: chspec=%d, %d\n",
4590
- chanspec, err);
4893
+ bphy_err(drvr, "Set Channel failed: chspec=%d, %d\n",
4894
+ chanspec, err);
45914895 goto exit;
45924896 }
4897
+
4898
+ err = brcmf_parse_configure_security(ifp, settings,
4899
+ NL80211_IFTYPE_P2P_GO);
4900
+ if (err < 0) {
4901
+ brcmf_err("brcmf_parse_configure_security error\n");
4902
+ goto exit;
4903
+ }
4904
+
45934905 err = brcmf_fil_bsscfg_data_set(ifp, "ssid", &ssid_le,
45944906 sizeof(ssid_le));
45954907 if (err < 0) {
4596
- brcmf_err("setting ssid failed %d\n", err);
4908
+ bphy_err(drvr, "setting ssid failed %d\n", err);
45974909 goto exit;
45984910 }
45994911 bss_enable.bsscfgidx = cpu_to_le32(ifp->bsscfgidx);
....@@ -4601,7 +4913,7 @@
46014913 err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable,
46024914 sizeof(bss_enable));
46034915 if (err < 0) {
4604
- brcmf_err("bss_enable config failed %d\n", err);
4916
+ bphy_err(drvr, "bss_enable config failed %d\n", err);
46054917 goto exit;
46064918 }
46074919
....@@ -4624,7 +4936,10 @@
46244936
46254937 static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev)
46264938 {
4939
+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
46274940 struct brcmf_if *ifp = netdev_priv(ndev);
4941
+ struct brcmf_pub *drvr = cfg->pub;
4942
+ struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
46284943 s32 err;
46294944 struct brcmf_fil_bss_enable_le bss_enable;
46304945 struct brcmf_join_params join_params;
....@@ -4635,6 +4950,14 @@
46354950 /* Due to most likely deauths outstanding we sleep */
46364951 /* first to make sure they get processed by fw. */
46374952 msleep(400);
4953
+
4954
+ if (profile->use_fwauth != BIT(BRCMF_PROFILE_FWAUTH_NONE)) {
4955
+ if (profile->use_fwauth & BIT(BRCMF_PROFILE_FWAUTH_PSK))
4956
+ brcmf_set_pmk(ifp, NULL, 0);
4957
+ if (profile->use_fwauth & BIT(BRCMF_PROFILE_FWAUTH_SAE))
4958
+ brcmf_set_sae_password(ifp, NULL, 0);
4959
+ profile->use_fwauth = BIT(BRCMF_PROFILE_FWAUTH_NONE);
4960
+ }
46384961
46394962 if (ifp->vif->mbss) {
46404963 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1);
....@@ -4649,13 +4972,13 @@
46494972 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
46504973 &join_params, sizeof(join_params));
46514974 if (err < 0)
4652
- brcmf_err("SET SSID error (%d)\n", err);
4975
+ bphy_err(drvr, "SET SSID error (%d)\n", err);
46534976 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1);
46544977 if (err < 0)
4655
- brcmf_err("BRCMF_C_DOWN error %d\n", err);
4978
+ bphy_err(drvr, "BRCMF_C_DOWN error %d\n", err);
46564979 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 0);
46574980 if (err < 0)
4658
- brcmf_err("setting AP mode failed %d\n", err);
4981
+ bphy_err(drvr, "setting AP mode failed %d\n", err);
46594982 if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS))
46604983 brcmf_fil_iovar_int_set(ifp, "mbss", 0);
46614984 brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY,
....@@ -4663,7 +4986,7 @@
46634986 /* Bring device back up so it can be used again */
46644987 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1);
46654988 if (err < 0)
4666
- brcmf_err("BRCMF_C_UP error %d\n", err);
4989
+ bphy_err(drvr, "BRCMF_C_UP error %d\n", err);
46674990
46684991 brcmf_vif_clear_mgmt_ies(ifp->vif);
46694992 } else {
....@@ -4672,7 +4995,7 @@
46724995 err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable,
46734996 sizeof(bss_enable));
46744997 if (err < 0)
4675
- brcmf_err("bss_enable config failed %d\n", err);
4998
+ bphy_err(drvr, "bss_enable config failed %d\n", err);
46764999 }
46775000 brcmf_set_mpc(ifp, 1);
46785001 brcmf_configure_arp_nd_offload(ifp, true);
....@@ -4701,6 +5024,7 @@
47015024 struct station_del_parameters *params)
47025025 {
47035026 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
5027
+ struct brcmf_pub *drvr = cfg->pub;
47045028 struct brcmf_scb_val_le scbval;
47055029 struct brcmf_if *ifp = netdev_priv(ndev);
47065030 s32 err;
....@@ -4720,7 +5044,8 @@
47205044 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCB_DEAUTHENTICATE_FOR_REASON,
47215045 &scbval, sizeof(scbval));
47225046 if (err)
4723
- brcmf_err("SCB_DEAUTHENTICATE_FOR_REASON failed %d\n", err);
5047
+ bphy_err(drvr, "SCB_DEAUTHENTICATE_FOR_REASON failed %d\n",
5048
+ err);
47245049
47255050 brcmf_dbg(TRACE, "Exit\n");
47265051 return err;
....@@ -4730,6 +5055,8 @@
47305055 brcmf_cfg80211_change_station(struct wiphy *wiphy, struct net_device *ndev,
47315056 const u8 *mac, struct station_parameters *params)
47325057 {
5058
+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
5059
+ struct brcmf_pub *drvr = cfg->pub;
47335060 struct brcmf_if *ifp = netdev_priv(ndev);
47345061 s32 err;
47355062
....@@ -4750,27 +5077,21 @@
47505077 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SCB_DEAUTHORIZE,
47515078 (void *)mac, ETH_ALEN);
47525079 if (err < 0)
4753
- brcmf_err("Setting SCB (de-)authorize failed, %d\n", err);
5080
+ bphy_err(drvr, "Setting SCB (de-)authorize failed, %d\n", err);
47545081
47555082 return err;
47565083 }
47575084
47585085 static void
4759
-brcmf_cfg80211_mgmt_frame_register(struct wiphy *wiphy,
4760
- struct wireless_dev *wdev,
4761
- u16 frame_type, bool reg)
5086
+brcmf_cfg80211_update_mgmt_frame_registrations(struct wiphy *wiphy,
5087
+ struct wireless_dev *wdev,
5088
+ struct mgmt_frame_regs *upd)
47625089 {
47635090 struct brcmf_cfg80211_vif *vif;
4764
- u16 mgmt_type;
47655091
4766
- brcmf_dbg(TRACE, "Enter, frame_type %04x, reg=%d\n", frame_type, reg);
4767
-
4768
- mgmt_type = (frame_type & IEEE80211_FCTL_STYPE) >> 4;
47695092 vif = container_of(wdev, struct brcmf_cfg80211_vif, wdev);
4770
- if (reg)
4771
- vif->mgmt_rx_reg |= BIT(mgmt_type);
4772
- else
4773
- vif->mgmt_rx_reg &= ~BIT(mgmt_type);
5093
+
5094
+ vif->mgmt_rx_reg = upd->interface_stypes;
47745095 }
47755096
47765097
....@@ -4780,6 +5101,7 @@
47805101 {
47815102 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
47825103 struct ieee80211_channel *chan = params->chan;
5104
+ struct brcmf_pub *drvr = cfg->pub;
47835105 const u8 *buf = params->buf;
47845106 size_t len = params->len;
47855107 const struct ieee80211_mgmt *mgmt;
....@@ -4800,7 +5122,7 @@
48005122 mgmt = (const struct ieee80211_mgmt *)buf;
48015123
48025124 if (!ieee80211_is_mgmt(mgmt->frame_control)) {
4803
- brcmf_err("Driver only allows MGMT packet type\n");
5125
+ bphy_err(drvr, "Driver only allows MGMT packet type\n");
48045126 return -EPERM;
48055127 }
48065128
....@@ -4831,13 +5153,13 @@
48315153 GFP_KERNEL);
48325154 } else if (ieee80211_is_action(mgmt->frame_control)) {
48335155 if (len > BRCMF_FIL_ACTION_FRAME_SIZE + DOT11_MGMT_HDR_LEN) {
4834
- brcmf_err("invalid action frame length\n");
5156
+ bphy_err(drvr, "invalid action frame length\n");
48355157 err = -EINVAL;
48365158 goto exit;
48375159 }
48385160 af_params = kzalloc(sizeof(*af_params), GFP_KERNEL);
48395161 if (af_params == NULL) {
4840
- brcmf_err("unable to allocate frame\n");
5162
+ bphy_err(drvr, "unable to allocate frame\n");
48415163 err = -ENOMEM;
48425164 goto exit;
48435165 }
....@@ -4859,7 +5181,7 @@
48595181 &freq);
48605182 chan_nr = ieee80211_frequency_to_channel(freq);
48615183 af_params->channel = cpu_to_le32(chan_nr);
4862
-
5184
+ af_params->dwell_time = cpu_to_le32(params->wait);
48635185 memcpy(action_frame->data, &buf[DOT11_MGMT_HDR_LEN],
48645186 le16_to_cpu(action_frame->len));
48655187
....@@ -4888,6 +5210,7 @@
48885210 u64 cookie)
48895211 {
48905212 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
5213
+ struct brcmf_pub *drvr = cfg->pub;
48915214 struct brcmf_cfg80211_vif *vif;
48925215 int err = 0;
48935216
....@@ -4895,7 +5218,7 @@
48955218
48965219 vif = cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif;
48975220 if (vif == NULL) {
4898
- brcmf_err("No p2p device available for probe response\n");
5221
+ bphy_err(drvr, "No p2p device available for probe response\n");
48995222 err = -ENODEV;
49005223 goto exit;
49015224 }
....@@ -4910,20 +5233,19 @@
49105233 {
49115234 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
49125235 struct net_device *ndev = wdev->netdev;
4913
- struct brcmf_if *ifp;
5236
+ struct brcmf_pub *drvr = cfg->pub;
49145237 struct brcmu_chan ch;
49155238 enum nl80211_band band = 0;
49165239 enum nl80211_chan_width width = 0;
49175240 u32 chanspec;
49185241 int freq, err;
49195242
4920
- if (!ndev)
5243
+ if (!ndev || drvr->bus_if->state != BRCMF_BUS_UP)
49215244 return -ENODEV;
4922
- ifp = netdev_priv(ndev);
49235245
4924
- err = brcmf_fil_iovar_int_get(ifp, "chanspec", &chanspec);
5246
+ err = brcmf_fil_iovar_int_get(netdev_priv(ndev), "chanspec", &chanspec);
49255247 if (err) {
4926
- brcmf_err("chanspec failed (%d)\n", err);
5248
+ bphy_err(drvr, "chanspec failed (%d)\n", err);
49275249 return err;
49285250 }
49295251
....@@ -5045,6 +5367,8 @@
50455367 struct net_device *ndev, const u8 *peer,
50465368 enum nl80211_tdls_operation oper)
50475369 {
5370
+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
5371
+ struct brcmf_pub *drvr = cfg->pub;
50485372 struct brcmf_if *ifp;
50495373 struct brcmf_tdls_iovar_le info;
50505374 int ret = 0;
....@@ -5062,7 +5386,7 @@
50625386 ret = brcmf_fil_iovar_data_set(ifp, "tdls_endpoint",
50635387 &info, sizeof(info));
50645388 if (ret < 0)
5065
- brcmf_err("tdls_endpoint iovar failed: ret=%d\n", ret);
5389
+ bphy_err(drvr, "tdls_endpoint iovar failed: ret=%d\n", ret);
50665390
50675391 return ret;
50685392 }
....@@ -5073,6 +5397,8 @@
50735397 struct cfg80211_connect_params *sme,
50745398 u32 changed)
50755399 {
5400
+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
5401
+ struct brcmf_pub *drvr = cfg->pub;
50765402 struct brcmf_if *ifp;
50775403 int err;
50785404
....@@ -5083,7 +5409,7 @@
50835409 err = brcmf_vif_set_mgmt_ie(ifp->vif, BRCMF_VNDR_IE_ASSOCREQ_FLAG,
50845410 sme->ie, sme->ie_len);
50855411 if (err)
5086
- brcmf_err("Set Assoc REQ IE Failed\n");
5412
+ bphy_err(drvr, "Set Assoc REQ IE Failed\n");
50875413 else
50885414 brcmf_dbg(TRACE, "Applied Vndr IEs for Assoc request\n");
50895415
....@@ -5095,6 +5421,8 @@
50955421 brcmf_cfg80211_set_rekey_data(struct wiphy *wiphy, struct net_device *ndev,
50965422 struct cfg80211_gtk_rekey_data *gtk)
50975423 {
5424
+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
5425
+ struct brcmf_pub *drvr = cfg->pub;
50985426 struct brcmf_if *ifp = netdev_priv(ndev);
50995427 struct brcmf_gtk_keyinfo_le gtk_le;
51005428 int ret;
....@@ -5109,7 +5437,7 @@
51095437 ret = brcmf_fil_iovar_data_set(ifp, "gtk_key_info", &gtk_le,
51105438 sizeof(gtk_le));
51115439 if (ret < 0)
5112
- brcmf_err("gtk_key_info iovar failed: ret=%d\n", ret);
5440
+ bphy_err(drvr, "gtk_key_info iovar failed: ret=%d\n", ret);
51135441
51145442 return ret;
51155443 }
....@@ -5178,7 +5506,8 @@
51785506 .change_station = brcmf_cfg80211_change_station,
51795507 .sched_scan_start = brcmf_cfg80211_sched_scan_start,
51805508 .sched_scan_stop = brcmf_cfg80211_sched_scan_stop,
5181
- .mgmt_frame_register = brcmf_cfg80211_mgmt_frame_register,
5509
+ .update_mgmt_frame_registrations =
5510
+ brcmf_cfg80211_update_mgmt_frame_registrations,
51825511 .mgmt_tx = brcmf_cfg80211_mgmt_tx,
51835512 .remain_on_channel = brcmf_p2p_remain_on_channel,
51845513 .cancel_remain_on_channel = brcmf_cfg80211_cancel_remain_on_channel,
....@@ -5212,6 +5541,7 @@
52125541 struct brcmf_cfg80211_vif *vif_walk;
52135542 struct brcmf_cfg80211_vif *vif;
52145543 bool mbss;
5544
+ struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
52155545
52165546 brcmf_dbg(TRACE, "allocating virtual interface (size=%zu)\n",
52175547 sizeof(*vif));
....@@ -5224,7 +5554,8 @@
52245554
52255555 brcmf_init_prof(&vif->profile);
52265556
5227
- if (type == NL80211_IFTYPE_AP) {
5557
+ if (type == NL80211_IFTYPE_AP &&
5558
+ brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) {
52285559 mbss = false;
52295560 list_for_each_entry(vif_walk, &cfg->vif_list, list) {
52305561 if (vif_walk->wdev.iftype == NL80211_IFTYPE_AP) {
....@@ -5263,14 +5594,16 @@
52635594 u32 event = e->event_code;
52645595 u32 status = e->status;
52655596
5266
- if (vif->profile.use_fwsup == BRCMF_PROFILE_FWSUP_PSK &&
5597
+ if ((vif->profile.use_fwsup == BRCMF_PROFILE_FWSUP_PSK ||
5598
+ vif->profile.use_fwsup == BRCMF_PROFILE_FWSUP_SAE) &&
52675599 event == BRCMF_E_PSK_SUP &&
52685600 status == BRCMF_E_STATUS_FWSUP_COMPLETED)
52695601 set_bit(BRCMF_VIF_STATUS_EAP_SUCCESS, &vif->sme_state);
52705602 if (event == BRCMF_E_SET_SSID && status == BRCMF_E_STATUS_SUCCESS) {
52715603 brcmf_dbg(CONN, "Processing set ssid\n");
52725604 memcpy(vif->profile.bssid, e->addr, ETH_ALEN);
5273
- if (vif->profile.use_fwsup != BRCMF_PROFILE_FWSUP_PSK)
5605
+ if (vif->profile.use_fwsup != BRCMF_PROFILE_FWSUP_PSK &&
5606
+ vif->profile.use_fwsup != BRCMF_PROFILE_FWSUP_SAE)
52745607 return true;
52755608
52765609 set_bit(BRCMF_VIF_STATUS_ASSOC_SUCCESS, &vif->sme_state);
....@@ -5341,11 +5674,151 @@
53415674 conn_info->resp_ie_len = 0;
53425675 }
53435676
5677
+u8 brcmf_map_prio_to_prec(void *config, u8 prio)
5678
+{
5679
+ struct brcmf_cfg80211_info *cfg = (struct brcmf_cfg80211_info *)config;
5680
+
5681
+ if (!cfg)
5682
+ return (prio == PRIO_8021D_NONE || prio == PRIO_8021D_BE) ?
5683
+ (prio ^ 2) : prio;
5684
+
5685
+ /* For those AC(s) with ACM flag set to 1, convert its 4-level priority
5686
+ * to an 8-level precedence which is the same as BE's
5687
+ */
5688
+ if (prio > PRIO_8021D_EE &&
5689
+ cfg->ac_priority[prio] == cfg->ac_priority[PRIO_8021D_BE])
5690
+ return cfg->ac_priority[prio] * 2;
5691
+
5692
+ /* Conversion of 4-level priority to 8-level precedence */
5693
+ if (prio == PRIO_8021D_BE || prio == PRIO_8021D_BK ||
5694
+ prio == PRIO_8021D_CL || prio == PRIO_8021D_VO)
5695
+ return cfg->ac_priority[prio] * 2;
5696
+ else
5697
+ return cfg->ac_priority[prio] * 2 + 1;
5698
+}
5699
+
5700
+u8 brcmf_map_prio_to_aci(void *config, u8 prio)
5701
+{
5702
+ /* Prio here refers to the 802.1d priority in range of 0 to 7.
5703
+ * ACI here refers to the WLAN AC Index in range of 0 to 3.
5704
+ * This function will return ACI corresponding to input prio.
5705
+ */
5706
+ struct brcmf_cfg80211_info *cfg = (struct brcmf_cfg80211_info *)config;
5707
+
5708
+ if (cfg)
5709
+ return cfg->ac_priority[prio];
5710
+
5711
+ return prio;
5712
+}
5713
+
5714
+static void brcmf_init_wmm_prio(u8 *priority)
5715
+{
5716
+ /* Initialize AC priority array to default
5717
+ * 802.1d priority as per following table:
5718
+ * 802.1d prio 0,3 maps to BE
5719
+ * 802.1d prio 1,2 maps to BK
5720
+ * 802.1d prio 4,5 maps to VI
5721
+ * 802.1d prio 6,7 maps to VO
5722
+ */
5723
+ priority[0] = BRCMF_FWS_FIFO_AC_BE;
5724
+ priority[3] = BRCMF_FWS_FIFO_AC_BE;
5725
+ priority[1] = BRCMF_FWS_FIFO_AC_BK;
5726
+ priority[2] = BRCMF_FWS_FIFO_AC_BK;
5727
+ priority[4] = BRCMF_FWS_FIFO_AC_VI;
5728
+ priority[5] = BRCMF_FWS_FIFO_AC_VI;
5729
+ priority[6] = BRCMF_FWS_FIFO_AC_VO;
5730
+ priority[7] = BRCMF_FWS_FIFO_AC_VO;
5731
+}
5732
+
5733
+static void brcmf_wifi_prioritize_acparams(const
5734
+ struct brcmf_cfg80211_edcf_acparam *acp, u8 *priority)
5735
+{
5736
+ u8 aci;
5737
+ u8 aifsn;
5738
+ u8 ecwmin;
5739
+ u8 ecwmax;
5740
+ u8 acm;
5741
+ u8 ranking_basis[EDCF_AC_COUNT];
5742
+ u8 aci_prio[EDCF_AC_COUNT]; /* AC_BE, AC_BK, AC_VI, AC_VO */
5743
+ u8 index;
5744
+
5745
+ for (aci = 0; aci < EDCF_AC_COUNT; aci++, acp++) {
5746
+ aifsn = acp->ACI & EDCF_AIFSN_MASK;
5747
+ acm = (acp->ACI & EDCF_ACM_MASK) ? 1 : 0;
5748
+ ecwmin = acp->ECW & EDCF_ECWMIN_MASK;
5749
+ ecwmax = (acp->ECW & EDCF_ECWMAX_MASK) >> EDCF_ECWMAX_SHIFT;
5750
+ brcmf_dbg(CONN, "ACI %d aifsn %d acm %d ecwmin %d ecwmax %d\n",
5751
+ aci, aifsn, acm, ecwmin, ecwmax);
5752
+ /* Default AC_VO will be the lowest ranking value */
5753
+ ranking_basis[aci] = aifsn + ecwmin + ecwmax;
5754
+ /* Initialise priority starting at 0 (AC_BE) */
5755
+ aci_prio[aci] = 0;
5756
+
5757
+ /* If ACM is set, STA can't use this AC as per 802.11.
5758
+ * Change the ranking to BE
5759
+ */
5760
+ if (aci != AC_BE && aci != AC_BK && acm == 1)
5761
+ ranking_basis[aci] = ranking_basis[AC_BE];
5762
+ }
5763
+
5764
+ /* Ranking method which works for AC priority
5765
+ * swapping when values for cwmin, cwmax and aifsn are varied
5766
+ * Compare each aci_prio against each other aci_prio
5767
+ */
5768
+ for (aci = 0; aci < EDCF_AC_COUNT; aci++) {
5769
+ for (index = 0; index < EDCF_AC_COUNT; index++) {
5770
+ if (index != aci) {
5771
+ /* Smaller ranking value has higher priority,
5772
+ * so increment priority for each ACI which has
5773
+ * a higher ranking value
5774
+ */
5775
+ if (ranking_basis[aci] < ranking_basis[index])
5776
+ aci_prio[aci]++;
5777
+ }
5778
+ }
5779
+ }
5780
+
5781
+ /* By now, aci_prio[] will be in range of 0 to 3.
5782
+ * Use ACI prio to get the new priority value for
5783
+ * each 802.1d traffic type, in this range.
5784
+ */
5785
+ if (!(aci_prio[AC_BE] == aci_prio[AC_BK] &&
5786
+ aci_prio[AC_BK] == aci_prio[AC_VI] &&
5787
+ aci_prio[AC_VI] == aci_prio[AC_VO])) {
5788
+ /* 802.1d 0,3 maps to BE */
5789
+ priority[0] = aci_prio[AC_BE];
5790
+ priority[3] = aci_prio[AC_BE];
5791
+
5792
+ /* 802.1d 1,2 maps to BK */
5793
+ priority[1] = aci_prio[AC_BK];
5794
+ priority[2] = aci_prio[AC_BK];
5795
+
5796
+ /* 802.1d 4,5 maps to VO */
5797
+ priority[4] = aci_prio[AC_VI];
5798
+ priority[5] = aci_prio[AC_VI];
5799
+
5800
+ /* 802.1d 6,7 maps to VO */
5801
+ priority[6] = aci_prio[AC_VO];
5802
+ priority[7] = aci_prio[AC_VO];
5803
+ } else {
5804
+ /* Initialize to default priority */
5805
+ brcmf_init_wmm_prio(priority);
5806
+ }
5807
+
5808
+ brcmf_dbg(CONN, "Adj prio BE 0->%d, BK 1->%d, BK 2->%d, BE 3->%d\n",
5809
+ priority[0], priority[1], priority[2], priority[3]);
5810
+
5811
+ brcmf_dbg(CONN, "Adj prio VI 4->%d, VI 5->%d, VO 6->%d, VO 7->%d\n",
5812
+ priority[4], priority[5], priority[6], priority[7]);
5813
+}
5814
+
53445815 static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg,
53455816 struct brcmf_if *ifp)
53465817 {
5818
+ struct brcmf_pub *drvr = cfg->pub;
53475819 struct brcmf_cfg80211_assoc_ielen_le *assoc_info;
53485820 struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg);
5821
+ struct brcmf_cfg80211_edcf_acparam edcf_acparam_info[EDCF_AC_COUNT];
53495822 u32 req_len;
53505823 u32 resp_len;
53515824 s32 err = 0;
....@@ -5355,19 +5828,24 @@
53555828 err = brcmf_fil_iovar_data_get(ifp, "assoc_info",
53565829 cfg->extra_buf, WL_ASSOC_INFO_MAX);
53575830 if (err) {
5358
- brcmf_err("could not get assoc info (%d)\n", err);
5831
+ bphy_err(drvr, "could not get assoc info (%d)\n", err);
53595832 return err;
53605833 }
53615834 assoc_info =
53625835 (struct brcmf_cfg80211_assoc_ielen_le *)cfg->extra_buf;
53635836 req_len = le32_to_cpu(assoc_info->req_len);
53645837 resp_len = le32_to_cpu(assoc_info->resp_len);
5838
+ if (req_len > WL_EXTRA_BUF_MAX || resp_len > WL_EXTRA_BUF_MAX) {
5839
+ bphy_err(drvr, "invalid lengths in assoc info: req %u resp %u\n",
5840
+ req_len, resp_len);
5841
+ return -EINVAL;
5842
+ }
53655843 if (req_len) {
53665844 err = brcmf_fil_iovar_data_get(ifp, "assoc_req_ies",
53675845 cfg->extra_buf,
53685846 WL_ASSOC_INFO_MAX);
53695847 if (err) {
5370
- brcmf_err("could not get assoc req (%d)\n", err);
5848
+ bphy_err(drvr, "could not get assoc req (%d)\n", err);
53715849 return err;
53725850 }
53735851 conn_info->req_ie_len = req_len;
....@@ -5385,7 +5863,7 @@
53855863 cfg->extra_buf,
53865864 WL_ASSOC_INFO_MAX);
53875865 if (err) {
5388
- brcmf_err("could not get assoc resp (%d)\n", err);
5866
+ bphy_err(drvr, "could not get assoc resp (%d)\n", err);
53895867 return err;
53905868 }
53915869 conn_info->resp_ie_len = resp_len;
....@@ -5394,6 +5872,17 @@
53945872 GFP_KERNEL);
53955873 if (!conn_info->resp_ie)
53965874 conn_info->resp_ie_len = 0;
5875
+
5876
+ err = brcmf_fil_iovar_data_get(ifp, "wme_ac_sta",
5877
+ edcf_acparam_info,
5878
+ sizeof(edcf_acparam_info));
5879
+ if (err) {
5880
+ brcmf_err("could not get wme_ac_sta (%d)\n", err);
5881
+ return err;
5882
+ }
5883
+
5884
+ brcmf_wifi_prioritize_acparams(edcf_acparam_info,
5885
+ cfg->ac_priority);
53975886 } else {
53985887 conn_info->resp_ie_len = 0;
53995888 conn_info->resp_ie = NULL;
....@@ -5467,6 +5956,11 @@
54675956 cfg80211_roamed(ndev, &roam_info, GFP_KERNEL);
54685957 brcmf_dbg(CONN, "Report roaming result\n");
54695958
5959
+ if (profile->use_fwsup == BRCMF_PROFILE_FWSUP_1X && profile->is_ft) {
5960
+ cfg80211_port_authorized(ndev, profile->bssid, GFP_KERNEL);
5961
+ brcmf_dbg(CONN, "Report port authorized\n");
5962
+ }
5963
+
54705964 set_bit(BRCMF_VIF_STATUS_CONNECTED, &ifp->vif->sme_state);
54715965 brcmf_dbg(TRACE, "Exit\n");
54725966 return err;
....@@ -5514,6 +6008,7 @@
55146008 struct net_device *ndev,
55156009 const struct brcmf_event_msg *e, void *data)
55166010 {
6011
+ struct brcmf_pub *drvr = cfg->pub;
55176012 static int generation;
55186013 u32 event = e->event_code;
55196014 u32 reason = e->reason;
....@@ -5531,7 +6026,7 @@
55316026 if (((event == BRCMF_E_ASSOC_IND) || (event == BRCMF_E_REASSOC_IND)) &&
55326027 (reason == BRCMF_E_STATUS_SUCCESS)) {
55336028 if (!data) {
5534
- brcmf_err("No IEs present in ASSOC/REASSOC_IND");
6029
+ bphy_err(drvr, "No IEs present in ASSOC/REASSOC_IND\n");
55356030 return -EINVAL;
55366031 }
55376032
....@@ -5589,10 +6084,19 @@
55896084 brcmf_net_setcarrier(ifp, true);
55906085 } else if (brcmf_is_linkdown(ifp->vif, e)) {
55916086 brcmf_dbg(CONN, "Linkdown\n");
5592
- if (!brcmf_is_ibssmode(ifp->vif)) {
6087
+ if (!brcmf_is_ibssmode(ifp->vif) &&
6088
+ test_bit(BRCMF_VIF_STATUS_CONNECTED,
6089
+ &ifp->vif->sme_state)) {
6090
+ if (memcmp(profile->bssid, e->addr, ETH_ALEN))
6091
+ return err;
6092
+
55936093 brcmf_bss_connect_done(cfg, ndev, e, false);
55946094 brcmf_link_down(ifp->vif,
5595
- brcmf_map_fw_linkdown_reason(e));
6095
+ brcmf_map_fw_linkdown_reason(e),
6096
+ e->event_code &
6097
+ (BRCMF_E_DEAUTH_IND |
6098
+ BRCMF_E_DISASSOC_IND)
6099
+ ? false : true);
55966100 brcmf_init_prof(ndev_to_prof(ndev));
55976101 if (ndev != cfg_to_ndev(cfg))
55986102 complete(&cfg->vif_disabled);
....@@ -5804,6 +6308,7 @@
58046308 mutex_init(&cfg->usr_sync);
58056309 brcmf_init_escan(cfg);
58066310 brcmf_init_conf(cfg->conf);
6311
+ brcmf_init_wmm_prio(cfg->ac_priority);
58076312 init_completion(&cfg->vif_disabled);
58086313 return err;
58096314 }
....@@ -5823,6 +6328,7 @@
58236328
58246329 static s32 brcmf_dongle_roam(struct brcmf_if *ifp)
58256330 {
6331
+ struct brcmf_pub *drvr = ifp->drvr;
58266332 s32 err;
58276333 u32 bcn_timeout;
58286334 __le32 roamtrigger[2];
....@@ -5835,7 +6341,7 @@
58356341 bcn_timeout = BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_ON;
58366342 err = brcmf_fil_iovar_int_set(ifp, "bcn_timeout", bcn_timeout);
58376343 if (err) {
5838
- brcmf_err("bcn_timeout error (%d)\n", err);
6344
+ bphy_err(drvr, "bcn_timeout error (%d)\n", err);
58396345 goto roam_setup_done;
58406346 }
58416347
....@@ -5847,7 +6353,7 @@
58476353 err = brcmf_fil_iovar_int_set(ifp, "roam_off",
58486354 ifp->drvr->settings->roamoff);
58496355 if (err) {
5850
- brcmf_err("roam_off error (%d)\n", err);
6356
+ bphy_err(drvr, "roam_off error (%d)\n", err);
58516357 goto roam_setup_done;
58526358 }
58536359
....@@ -5855,19 +6361,17 @@
58556361 roamtrigger[1] = cpu_to_le32(BRCM_BAND_ALL);
58566362 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_ROAM_TRIGGER,
58576363 (void *)roamtrigger, sizeof(roamtrigger));
5858
- if (err) {
5859
- brcmf_err("WLC_SET_ROAM_TRIGGER error (%d)\n", err);
5860
- goto roam_setup_done;
5861
- }
6364
+ if (err)
6365
+ bphy_err(drvr, "WLC_SET_ROAM_TRIGGER error (%d)\n", err);
58626366
58636367 roam_delta[0] = cpu_to_le32(WL_ROAM_DELTA);
58646368 roam_delta[1] = cpu_to_le32(BRCM_BAND_ALL);
58656369 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_ROAM_DELTA,
58666370 (void *)roam_delta, sizeof(roam_delta));
5867
- if (err) {
5868
- brcmf_err("WLC_SET_ROAM_DELTA error (%d)\n", err);
5869
- goto roam_setup_done;
5870
- }
6371
+ if (err)
6372
+ bphy_err(drvr, "WLC_SET_ROAM_DELTA error (%d)\n", err);
6373
+
6374
+ return 0;
58716375
58726376 roam_setup_done:
58736377 return err;
....@@ -5876,25 +6380,26 @@
58766380 static s32
58776381 brcmf_dongle_scantime(struct brcmf_if *ifp)
58786382 {
6383
+ struct brcmf_pub *drvr = ifp->drvr;
58796384 s32 err = 0;
58806385
58816386 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_CHANNEL_TIME,
58826387 BRCMF_SCAN_CHANNEL_TIME);
58836388 if (err) {
5884
- brcmf_err("Scan assoc time error (%d)\n", err);
6389
+ bphy_err(drvr, "Scan assoc time error (%d)\n", err);
58856390 goto dongle_scantime_out;
58866391 }
58876392 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_UNASSOC_TIME,
58886393 BRCMF_SCAN_UNASSOC_TIME);
58896394 if (err) {
5890
- brcmf_err("Scan unassoc time error (%d)\n", err);
6395
+ bphy_err(drvr, "Scan unassoc time error (%d)\n", err);
58916396 goto dongle_scantime_out;
58926397 }
58936398
58946399 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_PASSIVE_TIME,
58956400 BRCMF_SCAN_PASSIVE_TIME);
58966401 if (err) {
5897
- brcmf_err("Scan passive time error (%d)\n", err);
6402
+ bphy_err(drvr, "Scan passive time error (%d)\n", err);
58986403 goto dongle_scantime_out;
58996404 }
59006405
....@@ -5926,10 +6431,11 @@
59266431 static int brcmf_construct_chaninfo(struct brcmf_cfg80211_info *cfg,
59276432 u32 bw_cap[])
59286433 {
5929
- struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
6434
+ struct wiphy *wiphy = cfg_to_wiphy(cfg);
6435
+ struct brcmf_pub *drvr = cfg->pub;
6436
+ struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
59306437 struct ieee80211_supported_band *band;
59316438 struct ieee80211_channel *channel;
5932
- struct wiphy *wiphy;
59336439 struct brcmf_chanspec_list *list;
59346440 struct brcmu_chan ch;
59356441 int err;
....@@ -5948,11 +6454,10 @@
59486454 err = brcmf_fil_iovar_data_get(ifp, "chanspecs", pbuf,
59496455 BRCMF_DCMD_MEDLEN);
59506456 if (err) {
5951
- brcmf_err("get chanspecs error (%d)\n", err);
6457
+ bphy_err(drvr, "get chanspecs error (%d)\n", err);
59526458 goto fail_pbuf;
59536459 }
59546460
5955
- wiphy = cfg_to_wiphy(cfg);
59566461 band = wiphy->bands[NL80211_BAND_2GHZ];
59576462 if (band)
59586463 for (i = 0; i < band->n_channels; i++)
....@@ -5963,6 +6468,13 @@
59636468 band->channels[i].flags = IEEE80211_CHAN_DISABLED;
59646469
59656470 total = le32_to_cpu(list->count);
6471
+ if (total > BRCMF_MAX_CHANSPEC_LIST) {
6472
+ bphy_err(drvr, "Invalid count of channel Spec. (%u)\n",
6473
+ total);
6474
+ err = -EINVAL;
6475
+ goto fail_pbuf;
6476
+ }
6477
+
59666478 for (i = 0; i < total; i++) {
59676479 ch.chspec = (u16)le32_to_cpu(list->element[i]);
59686480 cfg->d11inf.decchspec(&ch);
....@@ -5972,7 +6484,8 @@
59726484 } else if (ch.band == BRCMU_CHAN_BAND_5G) {
59736485 band = wiphy->bands[NL80211_BAND_5GHZ];
59746486 } else {
5975
- brcmf_err("Invalid channel Spec. 0x%x.\n", ch.chspec);
6487
+ bphy_err(drvr, "Invalid channel Spec. 0x%x.\n",
6488
+ ch.chspec);
59766489 continue;
59776490 }
59786491 if (!band)
....@@ -5995,8 +6508,8 @@
59956508 /* It seems firmware supports some channel we never
59966509 * considered. Something new in IEEE standard?
59976510 */
5998
- brcmf_err("Ignoring unexpected firmware channel %d\n",
5999
- ch.control_ch_num);
6511
+ bphy_err(drvr, "Ignoring unexpected firmware channel %d\n",
6512
+ ch.control_ch_num);
60006513 continue;
60016514 }
60026515
....@@ -6006,11 +6519,21 @@
60066519 /* assuming the chanspecs order is HT20,
60076520 * HT40 upper, HT40 lower, and VHT80.
60086521 */
6009
- if (ch.bw == BRCMU_CHAN_BW_80) {
6522
+ switch (ch.bw) {
6523
+ case BRCMU_CHAN_BW_160:
6524
+ channel->flags &= ~IEEE80211_CHAN_NO_160MHZ;
6525
+ break;
6526
+ case BRCMU_CHAN_BW_80:
60106527 channel->flags &= ~IEEE80211_CHAN_NO_80MHZ;
6011
- } else if (ch.bw == BRCMU_CHAN_BW_40) {
6528
+ break;
6529
+ case BRCMU_CHAN_BW_40:
60126530 brcmf_update_bw40_channel_flag(channel, &ch);
6013
- } else {
6531
+ break;
6532
+ default:
6533
+ wiphy_warn(wiphy, "Firmware reported unsupported bandwidth %d\n",
6534
+ ch.bw);
6535
+ fallthrough;
6536
+ case BRCMU_CHAN_BW_20:
60146537 /* enable the channel and disable other bandwidths
60156538 * for now as mentioned order assure they are enabled
60166539 * for subsequent chanspecs.
....@@ -6042,7 +6565,8 @@
60426565
60436566 static int brcmf_enable_bw40_2g(struct brcmf_cfg80211_info *cfg)
60446567 {
6045
- struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
6568
+ struct brcmf_pub *drvr = cfg->pub;
6569
+ struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
60466570 struct ieee80211_supported_band *band;
60476571 struct brcmf_fil_bwcap_le band_bwcap;
60486572 struct brcmf_chanspec_list *list;
....@@ -6088,7 +6612,7 @@
60886612 err = brcmf_fil_iovar_data_get(ifp, "chanspecs", pbuf,
60896613 BRCMF_DCMD_MEDLEN);
60906614 if (err) {
6091
- brcmf_err("get chanspecs error (%d)\n", err);
6615
+ bphy_err(drvr, "get chanspecs error (%d)\n", err);
60926616 kfree(pbuf);
60936617 return err;
60946618 }
....@@ -6096,6 +6620,13 @@
60966620 band = cfg_to_wiphy(cfg)->bands[NL80211_BAND_2GHZ];
60976621 list = (struct brcmf_chanspec_list *)pbuf;
60986622 num_chan = le32_to_cpu(list->count);
6623
+ if (num_chan > BRCMF_MAX_CHANSPEC_LIST) {
6624
+ bphy_err(drvr, "Invalid count of channel Spec. (%u)\n",
6625
+ num_chan);
6626
+ kfree(pbuf);
6627
+ return -EINVAL;
6628
+ }
6629
+
60996630 for (i = 0; i < num_chan; i++) {
61006631 ch.chspec = (u16)le32_to_cpu(list->element[i]);
61016632 cfg->d11inf.decchspec(&ch);
....@@ -6119,6 +6650,7 @@
61196650
61206651 static void brcmf_get_bwcap(struct brcmf_if *ifp, u32 bw_cap[])
61216652 {
6653
+ struct brcmf_pub *drvr = ifp->drvr;
61226654 u32 band, mimo_bwcap;
61236655 int err;
61246656
....@@ -6145,16 +6677,16 @@
61456677 switch (mimo_bwcap) {
61466678 case WLC_N_BW_40ALL:
61476679 bw_cap[NL80211_BAND_2GHZ] |= WLC_BW_40MHZ_BIT;
6148
- /* fall-thru */
6680
+ fallthrough;
61496681 case WLC_N_BW_20IN2G_40IN5G:
61506682 bw_cap[NL80211_BAND_5GHZ] |= WLC_BW_40MHZ_BIT;
6151
- /* fall-thru */
6683
+ fallthrough;
61526684 case WLC_N_BW_20ALL:
61536685 bw_cap[NL80211_BAND_2GHZ] |= WLC_BW_20MHZ_BIT;
61546686 bw_cap[NL80211_BAND_5GHZ] |= WLC_BW_20MHZ_BIT;
61556687 break;
61566688 default:
6157
- brcmf_err("invalid mimo_bw_cap value\n");
6689
+ bphy_err(drvr, "invalid mimo_bw_cap value\n");
61586690 }
61596691 }
61606692
....@@ -6229,8 +6761,9 @@
62296761
62306762 static int brcmf_setup_wiphybands(struct brcmf_cfg80211_info *cfg)
62316763 {
6232
- struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
6233
- struct wiphy *wiphy;
6764
+ struct brcmf_pub *drvr = cfg->pub;
6765
+ struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
6766
+ struct wiphy *wiphy = cfg_to_wiphy(cfg);
62346767 u32 nmode = 0;
62356768 u32 vhtmode = 0;
62366769 u32 bw_cap[2] = { WLC_BW_20MHZ_BIT, WLC_BW_20MHZ_BIT };
....@@ -6246,7 +6779,7 @@
62466779 (void)brcmf_fil_iovar_int_get(ifp, "vhtmode", &vhtmode);
62476780 err = brcmf_fil_iovar_int_get(ifp, "nmode", &nmode);
62486781 if (err) {
6249
- brcmf_err("nmode error (%d)\n", err);
6782
+ bphy_err(drvr, "nmode error (%d)\n", err);
62506783 } else {
62516784 brcmf_get_bwcap(ifp, bw_cap);
62526785 }
....@@ -6256,7 +6789,7 @@
62566789
62576790 err = brcmf_fil_iovar_int_get(ifp, "rxchain", &rxchain);
62586791 if (err) {
6259
- brcmf_err("rxchain error (%d)\n", err);
6792
+ bphy_err(drvr, "rxchain error (%d)\n", err);
62606793 nchain = 1;
62616794 } else {
62626795 for (nchain = 0; rxchain; nchain++)
....@@ -6266,7 +6799,7 @@
62666799
62676800 err = brcmf_construct_chaninfo(cfg, bw_cap);
62686801 if (err) {
6269
- brcmf_err("brcmf_construct_chaninfo failed (%d)\n", err);
6802
+ bphy_err(drvr, "brcmf_construct_chaninfo failed (%d)\n", err);
62706803 return err;
62716804 }
62726805
....@@ -6278,7 +6811,6 @@
62786811 &txbf_bfr_cap);
62796812 }
62806813
6281
- wiphy = cfg_to_wiphy(cfg);
62826814 for (i = 0; i < ARRAY_SIZE(wiphy->bands); i++) {
62836815 band = wiphy->bands[i];
62846816 if (band == NULL)
....@@ -6351,6 +6883,9 @@
63516883 * #STA <= 1, #AP <= 1, channels = 1, 2 total
63526884 * #AP <= 4, matching BI, channels = 1, 4 total
63536885 *
6886
+ * no p2p and rsdb:
6887
+ * #STA <= 1, #AP <= 2, channels = 2, 4 total
6888
+ *
63546889 * p2p, no mchan, and mbss:
63556890 *
63566891 * #STA <= 1, #P2P-DEV <= 1, #{P2P-CL, P2P-GO} <= 1, channels = 1, 3 total
....@@ -6362,6 +6897,10 @@
63626897 * #STA <= 1, #P2P-DEV <= 1, #{P2P-CL, P2P-GO} <= 1, channels = 2, 3 total
63636898 * #STA <= 1, #P2P-DEV <= 1, #AP <= 1, #P2P-CL <= 1, channels = 1, 4 total
63646899 * #AP <= 4, matching BI, channels = 1, 4 total
6900
+ *
6901
+ * p2p, rsdb, and no mbss:
6902
+ * #STA <= 1, #P2P-DEV <= 1, #{P2P-CL, P2P-GO} <= 2, AP <= 2,
6903
+ * channels = 2, 4 total
63656904 */
63666905 static int brcmf_setup_ifmodes(struct wiphy *wiphy, struct brcmf_if *ifp)
63676906 {
....@@ -6369,13 +6908,16 @@
63696908 struct ieee80211_iface_limit *c0_limits = NULL;
63706909 struct ieee80211_iface_limit *p2p_limits = NULL;
63716910 struct ieee80211_iface_limit *mbss_limits = NULL;
6372
- bool mbss, p2p;
6373
- int i, c, n_combos;
6911
+ bool mon_flag, mbss, p2p, rsdb, mchan;
6912
+ int i, c, n_combos, n_limits;
63746913
6914
+ mon_flag = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MONITOR_FLAG);
63756915 mbss = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS);
63766916 p2p = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_P2P);
6917
+ rsdb = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_RSDB);
6918
+ mchan = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN);
63776919
6378
- n_combos = 1 + !!p2p + !!mbss;
6920
+ n_combos = 1 + !!(p2p && !rsdb) + !!mbss;
63796921 combo = kcalloc(n_combos, sizeof(*combo), GFP_KERNEL);
63806922 if (!combo)
63816923 goto err;
....@@ -6383,37 +6925,53 @@
63836925 wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
63846926 BIT(NL80211_IFTYPE_ADHOC) |
63856927 BIT(NL80211_IFTYPE_AP);
6386
-
6387
- c = 0;
6388
- i = 0;
6389
- c0_limits = kcalloc(p2p ? 3 : 2, sizeof(*c0_limits), GFP_KERNEL);
6390
- if (!c0_limits)
6391
- goto err;
6392
- c0_limits[i].max = 1;
6393
- c0_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
6394
- if (p2p) {
6395
- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN))
6396
- combo[c].num_different_channels = 2;
6397
- else
6398
- combo[c].num_different_channels = 1;
6928
+ if (mon_flag)
6929
+ wiphy->interface_modes |= BIT(NL80211_IFTYPE_MONITOR);
6930
+ if (p2p)
63996931 wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_CLIENT) |
64006932 BIT(NL80211_IFTYPE_P2P_GO) |
64016933 BIT(NL80211_IFTYPE_P2P_DEVICE);
6934
+
6935
+ c = 0;
6936
+ i = 0;
6937
+ n_limits = 1 + mon_flag + (p2p ? 2 : 0) + (rsdb || !p2p);
6938
+ c0_limits = kcalloc(n_limits, sizeof(*c0_limits), GFP_KERNEL);
6939
+ if (!c0_limits)
6940
+ goto err;
6941
+
6942
+ combo[c].num_different_channels = 1 + (rsdb || (p2p && mchan));
6943
+ c0_limits[i].max = 1;
6944
+ c0_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
6945
+ if (mon_flag) {
6946
+ c0_limits[i].max = 1;
6947
+ c0_limits[i++].types = BIT(NL80211_IFTYPE_MONITOR);
6948
+ }
6949
+ if (p2p) {
64026950 c0_limits[i].max = 1;
64036951 c0_limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
6404
- c0_limits[i].max = 1;
6952
+ c0_limits[i].max = 1 + rsdb;
64056953 c0_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
64066954 BIT(NL80211_IFTYPE_P2P_GO);
6955
+ }
6956
+ if (p2p && rsdb) {
6957
+ c0_limits[i].max = 2;
6958
+ c0_limits[i++].types = BIT(NL80211_IFTYPE_AP);
6959
+ combo[c].max_interfaces = 4;
6960
+ } else if (p2p) {
6961
+ combo[c].max_interfaces = i;
6962
+ } else if (rsdb) {
6963
+ c0_limits[i].max = 2;
6964
+ c0_limits[i++].types = BIT(NL80211_IFTYPE_AP);
6965
+ combo[c].max_interfaces = 3;
64076966 } else {
6408
- combo[c].num_different_channels = 1;
64096967 c0_limits[i].max = 1;
64106968 c0_limits[i++].types = BIT(NL80211_IFTYPE_AP);
6969
+ combo[c].max_interfaces = i;
64116970 }
6412
- combo[c].max_interfaces = i;
64136971 combo[c].n_limits = i;
64146972 combo[c].limits = c0_limits;
64156973
6416
- if (p2p) {
6974
+ if (p2p && !rsdb) {
64176975 c++;
64186976 i = 0;
64196977 p2p_limits = kcalloc(4, sizeof(*p2p_limits), GFP_KERNEL);
....@@ -6436,14 +6994,20 @@
64366994 if (mbss) {
64376995 c++;
64386996 i = 0;
6439
- mbss_limits = kcalloc(1, sizeof(*mbss_limits), GFP_KERNEL);
6997
+ n_limits = 1 + mon_flag;
6998
+ mbss_limits = kcalloc(n_limits, sizeof(*mbss_limits),
6999
+ GFP_KERNEL);
64407000 if (!mbss_limits)
64417001 goto err;
64427002 mbss_limits[i].max = 4;
64437003 mbss_limits[i++].types = BIT(NL80211_IFTYPE_AP);
7004
+ if (mon_flag) {
7005
+ mbss_limits[i].max = 1;
7006
+ mbss_limits[i++].types = BIT(NL80211_IFTYPE_MONITOR);
7007
+ }
64447008 combo[c].beacon_int_infra_match = true;
64457009 combo[c].num_different_channels = 1;
6446
- combo[c].max_interfaces = 4;
7010
+ combo[c].max_interfaces = 4 + mon_flag;
64477011 combo[c].n_limits = i;
64487012 combo[c].limits = mbss_limits;
64497013 }
....@@ -6474,12 +7038,13 @@
64747038 {
64757039 #ifdef CONFIG_PM
64767040 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
7041
+ struct brcmf_pub *drvr = cfg->pub;
64777042 struct wiphy_wowlan_support *wowl;
64787043
64797044 wowl = kmemdup(&brcmf_wowlan_support, sizeof(brcmf_wowlan_support),
64807045 GFP_KERNEL);
64817046 if (!wowl) {
6482
- brcmf_err("only support basic wowlan features\n");
7047
+ bphy_err(drvr, "only support basic wowlan features\n");
64837048 wiphy->wowlan = &brcmf_wowlan_support;
64847049 return;
64857050 }
....@@ -6560,6 +7125,16 @@
65607125 NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_PSK);
65617126 wiphy_ext_feature_set(wiphy,
65627127 NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_1X);
7128
+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_SAE))
7129
+ wiphy_ext_feature_set(wiphy,
7130
+ NL80211_EXT_FEATURE_SAE_OFFLOAD);
7131
+ }
7132
+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_FWAUTH)) {
7133
+ wiphy_ext_feature_set(wiphy,
7134
+ NL80211_EXT_FEATURE_4WAY_HANDSHAKE_AP_PSK);
7135
+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_SAE))
7136
+ wiphy_ext_feature_set(wiphy,
7137
+ NL80211_EXT_FEATURE_SAE_OFFLOAD_AP);
65637138 }
65647139 wiphy->mgmt_stypes = brcmf_txrx_stypes;
65657140 wiphy->max_remain_on_channel_duration = 5000;
....@@ -6576,7 +7151,7 @@
65767151 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BANDLIST, &bandlist,
65777152 sizeof(bandlist));
65787153 if (err) {
6579
- brcmf_err("could not obtain band info: err=%d\n", err);
7154
+ bphy_err(drvr, "could not obtain band info: err=%d\n", err);
65807155 return err;
65817156 }
65827157 /* first entry in bandlist is number of bands */
....@@ -6618,6 +7193,11 @@
66187193 }
66197194 }
66207195
7196
+ if (wiphy->bands[NL80211_BAND_5GHZ] &&
7197
+ brcmf_feat_is_enabled(ifp, BRCMF_FEAT_DOT11H))
7198
+ wiphy_ext_feature_set(wiphy,
7199
+ NL80211_EXT_FEATURE_DFS_OFFLOAD);
7200
+
66217201 wiphy_read_of_freq_limits(wiphy);
66227202
66237203 return 0;
....@@ -6625,6 +7205,7 @@
66257205
66267206 static s32 brcmf_config_dongle(struct brcmf_cfg80211_info *cfg)
66277207 {
7208
+ struct brcmf_pub *drvr = cfg->pub;
66287209 struct net_device *ndev;
66297210 struct wireless_dev *wdev;
66307211 struct brcmf_if *ifp;
....@@ -6660,6 +7241,12 @@
66607241
66617242 brcmf_configure_arp_nd_offload(ifp, true);
66627243
7244
+ err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_FAKEFRAG, 1);
7245
+ if (err) {
7246
+ bphy_err(drvr, "failed to set frameburst mode\n");
7247
+ goto default_conf_out;
7248
+ }
7249
+
66637250 cfg->dongle_up = true;
66647251 default_conf_out:
66657252
....@@ -6683,7 +7270,7 @@
66837270 * from AP to save power
66847271 */
66857272 if (check_vif_up(ifp->vif)) {
6686
- brcmf_link_down(ifp->vif, WLAN_REASON_UNSPECIFIED);
7273
+ brcmf_link_down(ifp->vif, WLAN_REASON_UNSPECIFIED, true);
66877274
66887275 /* Make sure WPA_Supplicant receives all the event
66897276 generated due to DISASSOC call to the fw to keep
....@@ -6837,6 +7424,7 @@
68377424 {
68387425 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
68397426 struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
7427
+ struct brcmf_pub *drvr = cfg->pub;
68407428 struct brcmf_fil_country_le ccreq;
68417429 s32 err;
68427430 int i;
....@@ -6848,8 +7436,8 @@
68487436 /* ignore non-ISO3166 country codes */
68497437 for (i = 0; i < 2; i++)
68507438 if (req->alpha2[i] < 'A' || req->alpha2[i] > 'Z') {
6851
- brcmf_err("not an ISO3166 code (0x%02x 0x%02x)\n",
6852
- req->alpha2[0], req->alpha2[1]);
7439
+ bphy_err(drvr, "not an ISO3166 code (0x%02x 0x%02x)\n",
7440
+ req->alpha2[0], req->alpha2[1]);
68537441 return;
68547442 }
68557443
....@@ -6858,7 +7446,7 @@
68587446
68597447 err = brcmf_fil_iovar_data_get(ifp, "country", &ccreq, sizeof(ccreq));
68607448 if (err) {
6861
- brcmf_err("Country code iovar returned err = %d\n", err);
7449
+ bphy_err(drvr, "Country code iovar returned err = %d\n", err);
68627450 return;
68637451 }
68647452
....@@ -6868,7 +7456,7 @@
68687456
68697457 err = brcmf_fil_iovar_data_set(ifp, "country", &ccreq, sizeof(ccreq));
68707458 if (err) {
6871
- brcmf_err("Firmware rejected country setting\n");
7459
+ bphy_err(drvr, "Firmware rejected country setting\n");
68727460 return;
68737461 }
68747462 brcmf_setup_wiphybands(cfg);
....@@ -6914,13 +7502,13 @@
69147502 u16 *cap = NULL;
69157503
69167504 if (!ndev) {
6917
- brcmf_err("ndev is invalid\n");
7505
+ bphy_err(drvr, "ndev is invalid\n");
69187506 return NULL;
69197507 }
69207508
69217509 cfg = kzalloc(sizeof(*cfg), GFP_KERNEL);
69227510 if (!cfg) {
6923
- brcmf_err("Could not allocate wiphy device\n");
7511
+ bphy_err(drvr, "Could not allocate wiphy device\n");
69247512 return NULL;
69257513 }
69267514
....@@ -6941,7 +7529,7 @@
69417529
69427530 err = wl_init_priv(cfg);
69437531 if (err) {
6944
- brcmf_err("Failed to init iwm_priv (%d)\n", err);
7532
+ bphy_err(drvr, "Failed to init iwm_priv (%d)\n", err);
69457533 brcmf_free_vif(vif);
69467534 goto wiphy_out;
69477535 }
....@@ -6950,7 +7538,7 @@
69507538 /* determine d11 io type before wiphy setup */
69517539 err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_VERSION, &io_type);
69527540 if (err) {
6953
- brcmf_err("Failed to get D11 version (%d)\n", err);
7541
+ bphy_err(drvr, "Failed to get D11 version (%d)\n", err);
69547542 goto priv_out;
69557543 }
69567544 cfg->d11inf.io_type = (u8)io_type;
....@@ -6984,13 +7572,13 @@
69847572 #endif
69857573 err = wiphy_register(wiphy);
69867574 if (err < 0) {
6987
- brcmf_err("Could not register wiphy device (%d)\n", err);
7575
+ bphy_err(drvr, "Could not register wiphy device (%d)\n", err);
69887576 goto priv_out;
69897577 }
69907578
69917579 err = brcmf_setup_wiphybands(cfg);
69927580 if (err) {
6993
- brcmf_err("Setting wiphy bands failed (%d)\n", err);
7581
+ bphy_err(drvr, "Setting wiphy bands failed (%d)\n", err);
69947582 goto wiphy_unreg_out;
69957583 }
69967584
....@@ -7008,24 +7596,24 @@
70087596
70097597 err = brcmf_fweh_activate_events(ifp);
70107598 if (err) {
7011
- brcmf_err("FWEH activation failed (%d)\n", err);
7599
+ bphy_err(drvr, "FWEH activation failed (%d)\n", err);
70127600 goto wiphy_unreg_out;
70137601 }
70147602
70157603 err = brcmf_p2p_attach(cfg, p2pdev_forced);
70167604 if (err) {
7017
- brcmf_err("P2P initialisation failed (%d)\n", err);
7605
+ bphy_err(drvr, "P2P initialisation failed (%d)\n", err);
70187606 goto wiphy_unreg_out;
70197607 }
70207608 err = brcmf_btcoex_attach(cfg);
70217609 if (err) {
7022
- brcmf_err("BT-coex initialisation failed (%d)\n", err);
7610
+ bphy_err(drvr, "BT-coex initialisation failed (%d)\n", err);
70237611 brcmf_p2p_detach(&cfg->p2p);
70247612 goto wiphy_unreg_out;
70257613 }
70267614 err = brcmf_pno_attach(cfg);
70277615 if (err) {
7028
- brcmf_err("PNO initialisation failed (%d)\n", err);
7616
+ bphy_err(drvr, "PNO initialisation failed (%d)\n", err);
70297617 brcmf_btcoex_detach(cfg);
70307618 brcmf_p2p_detach(&cfg->p2p);
70317619 goto wiphy_unreg_out;
....@@ -7045,7 +7633,7 @@
70457633 /* (re-) activate FWEH event handling */
70467634 err = brcmf_fweh_activate_events(ifp);
70477635 if (err) {
7048
- brcmf_err("FWEH activation failed (%d)\n", err);
7636
+ bphy_err(drvr, "FWEH activation failed (%d)\n", err);
70497637 goto detach;
70507638 }
70517639
....@@ -7085,7 +7673,6 @@
70857673 brcmf_pno_detach(cfg);
70867674 brcmf_btcoex_detach(cfg);
70877675 wiphy_unregister(cfg->wiphy);
7088
- kfree(cfg->ops);
70897676 wl_deinit_priv(cfg);
70907677 brcmf_free_wiphy(cfg->wiphy);
70917678 kfree(cfg);