forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_iapsta.c
old mode 100644new mode 100755
....@@ -1,4 +1,3 @@
1
-/* SPDX-License-Identifier: GPL-2.0 */
21
32 #ifdef WL_EXT_IAPSTA
43 #include <net/rtnetlink.h>
....@@ -9,21 +8,10 @@
98 #include <dhd_config.h>
109 #ifdef WL_CFG80211
1110 #include <wl_cfg80211.h>
12
-#include <wl_cfgscan.h>
1311 #endif /* WL_CFG80211 */
1412 #ifdef WL_ESCAN
1513 #include <wl_escan.h>
1614 #endif /* WL_ESCAN */
17
-
18
-#ifdef BTC_WAR
19
-/* btc_war:
20
- * -1(don't apply btc)
21
- * 0(disable btc war): btc_mode=1; txchain=3; rxchain=3
22
- * 1(enable btc war): txchain=2; rxchain=2; btc_mode=5
23
- */
24
-int btc_war = -1;
25
-module_param(btc_war, int, 0644);
26
-#endif /* BTC_WAR */
2715
2816 #define IAPSTA_ERROR(name, arg1, args...) \
2917 do { \
....@@ -69,31 +57,18 @@
6957 #define CSA_FW_BIT (1<<0)
7058 #define CSA_DRV_BIT (1<<1)
7159
72
-#define WL_DUMP_BUF_LEN (127 * 1024)
73
-
7460 #define MAX_AP_LINK_WAIT_TIME 3000
7561 #define MAX_STA_LINK_WAIT_TIME 15000
7662 #define STA_LINKDOWN_TIMEOUT 10000
7763 #define STA_CONNECT_TIMEOUT 10500
78
-#define STA_CONNECT_FULL_CHAN_TIMEOUT 3000
7964 #define STA_CONNECT_RETRY_TIMEOUT 600
8065 #define STA_RECONNECT_RETRY_TIMEOUT 300
81
-#define STA_DISCONNECT_RECONNECT_TIMEOUT 30000
82
-#define STA_DISCONNECT_RECONNECT_MAX 3
83
-#define STA_4WAY_TIMEOUT 1000
84
-#ifdef EAPOL_RESEND_M4
85
-#define STA_KEY_INSTALL_INTERVAL 50
86
-#define STA_KEY_INSTALL_MAX (STA_4WAY_TIMEOUT/STA_KEY_INSTALL_INTERVAL)
87
-#else
88
-#define STA_KEY_INSTALL_INTERVAL 50
89
-#define STA_KEY_INSTALL_MAX 3
90
-#endif
9166 #define STA_EAPOL_TIMEOUT 100
9267 #define STA_EMPTY_SCAN_MAX 6
93
-#define AP_RESTART_TIMEOUT 1000
94
-#define AP_TXBCNFRM_TIMEOUT 10000
68
+#define AP_RESTART_TIMEOUT 1
69
+#define AP_TXBCNFRM_TIMEOUT 10
9570 #ifdef RXF0OVFL_REINIT_WAR
96
-#define RXF0OVFL_POLLING_TIMEOUT 1000
71
+#define RXF0OVFL_POLLING_TIMEOUT 1
9772 #define RXF0OVFL_THRESHOLD 100
9873 #endif /* RXF0OVFL_REINIT_WAR */
9974
....@@ -153,12 +128,6 @@
153128 ENC_AES,
154129 ENC_TKIPAES
155130 } encmode_t;
156
-
157
-typedef enum MAPSTA_MODE {
158
- MCHAN_APSTA_NOT_ALLOW = 0,
159
- MCHAN_APSTA_SBSC,
160
- MCHAN_APSTA_NO_RESTRICT
161
-} mapsta_mode_t;
162131
163132 #ifdef STA_MGMT
164133 typedef struct wl_sta_info {
....@@ -229,12 +198,6 @@
229198 uint conn_state;
230199 uint16 prev_channel;
231200 uint16 post_channel;
232
- struct osl_timespec sta_disc_ts;
233
- struct osl_timespec sta_conn_ts;
234
- bool ap_recon_sta;
235
- wait_queue_head_t ap_recon_sta_event;
236
- struct ether_addr ap_disc_sta_bssid;
237
- struct osl_timespec ap_disc_sta_ts;
238201 #ifdef TPUT_MONITOR
239202 struct wl_tput_info tput_info;
240203 #endif /* TPUT_MONITOR */
....@@ -256,10 +219,6 @@
256219 int eapol_resend_intvl;
257220 #endif /* EAPOL_DYNAMATIC_RESEND */
258221 #endif /* EAPOL_RESEND */
259
-#ifdef KEY_INSTALL_CHECK
260
- timer_list_compat_t key_install_timer;
261
- int key_install_cnt;
262
-#endif /* KEY_INSTALL_CHECK */
263222 int empty_scan;
264223 #ifdef RESTART_AP_WAR
265224 timer_list_compat_t restart_ap_timer;
....@@ -268,21 +227,15 @@
268227 timer_list_compat_t reset_ap_timer;
269228 uint32 txbcnfrm;
270229 #endif /* RESET_AP_WAR */
271
-#if defined(WL_EXT_RECONNECT) && defined(WL_CFG80211)
272
-#ifdef WL_EXT_DISCONNECT_RECONNECT
273
- struct osl_timespec sta_disc_conn_ts;
274
- int sta_disc_recon_cnt;
275
-#endif /* WL_EXT_DISCONNECT_RECONNECT */
276
-#endif /* WL_EXT_RECONNECT && WL_CFG80211 */
277230 } wl_if_info_t;
278
-
279
-u8 *g_ioctl_buf = NULL;
280231
281232 typedef struct wl_apsta_params {
282233 struct wl_if_info if_info[MAX_IF_NUM];
283234 #ifdef WLDWDS
284235 struct wl_dwds_info dwds_info[MAX_DWDS_IF_NUM];
285236 #endif /* WLDWDS */
237
+ struct dhd_pub *dhd;
238
+ int ioctl_ver;
286239 bool init;
287240 int rsdb;
288241 bool vsdb;
....@@ -301,6 +254,12 @@
301254 #endif /* WLMESH && WL_ESCAN */
302255 struct mutex in4way_sync;
303256 int sta_btc_mode;
257
+ struct osl_timespec sta_disc_ts;
258
+ struct osl_timespec sta_conn_ts;
259
+ bool ap_recon_sta;
260
+ wait_queue_head_t ap_recon_sta_event;
261
+ struct ether_addr ap_disc_sta_bssid;
262
+ struct osl_timespec ap_disc_sta_ts;
304263 #ifdef TPUT_MONITOR
305264 timer_list_compat_t monitor_timer;
306265 int32 tput_sum;
....@@ -341,8 +300,7 @@
341300 ISAM_RC_AP_RESTART = 4,
342301 ISAM_RC_AP_RESET = 5,
343302 ISAM_RC_EAPOL_RESEND = 6,
344
- ISAM_RC_KEY_INSTALL = 7,
345
- ISAM_RC_RXF0OVFL_REINIT = 8
303
+ ISAM_RC_RXF0OVFL_REINIT = 7
346304 };
347305
348306 #define wl_get_isam_status(cur_if, stat) \
....@@ -357,6 +315,9 @@
357315 static int wl_ext_enable_iface(struct net_device *dev, char *ifname,
358316 int wait_up, bool lock);
359317 static int wl_ext_disable_iface(struct net_device *dev, char *ifname);
318
+#if defined(WLMESH) && defined(WL_ESCAN)
319
+static int wl_mesh_escan_attach(dhd_pub_t *dhd, struct wl_if_info *cur_if);
320
+#endif /* WLMESH && WL_ESCAN */
360321
361322 static struct wl_if_info *
362323 wl_get_cur_if(struct net_device *dev)
....@@ -643,17 +604,17 @@
643604 }
644605
645606 static int
646
-wl_ext_set_emode(struct wl_if_info *cur_if)
607
+wl_ext_set_emode(struct wl_apsta_params *apsta_params,
608
+ struct wl_if_info *cur_if)
647609 {
648610 struct net_device *dev = cur_if->dev;
649
- struct dhd_pub *dhd = dhd_get_pub(dev);
650
- struct wl_apsta_params *apsta_params = dhd->iapsta_params;
611
+ int wsec=0;
651612 struct wl_wsec_key wsec_key;
652613 wsec_pmk_t psk;
653614 authmode_t amode = cur_if->amode;
654615 encmode_t emode = cur_if->emode;
655
- int wsec=0;
656616 char *key = cur_if->key;
617
+ struct dhd_pub *dhd = apsta_params->dhd;
657618
658619 memset(&wsec_key, 0, sizeof(wsec_key));
659620 memset(&psk, 0, sizeof(psk));
....@@ -749,14 +710,14 @@
749710 }
750711
751712 static u32
752
-wl_ext_get_chanspec(struct net_device *dev, struct wl_chan_info *chan_info)
713
+wl_ext_get_chanspec(struct wl_apsta_params *apsta_params,
714
+ struct net_device *dev, struct wl_chan_info *chan_info)
753715 {
754
- struct dhd_pub *dhd = dhd_get_pub(dev);
755716 u32 chanspec = 0;
756717
757718 if (wl_ext_associated(dev)) {
758719 if (wl_ext_iovar_getint(dev, "chanspec", (s32 *)&chanspec) == BCME_OK) {
759
- chanspec = wl_ext_chspec_driver_to_host(dhd, chanspec);
720
+ chanspec = wl_ext_chspec_driver_to_host(apsta_params->ioctl_ver, chanspec);
760721 if (chan_info) {
761722 chan_info->band = CHSPEC2WLC_BAND(chanspec);
762723 chan_info->chan = wf_chspec_ctlchan(chanspec);
....@@ -769,12 +730,13 @@
769730 }
770731
771732 static uint16
772
-wl_ext_get_chan(struct net_device *dev, struct wl_chan_info *chan_info)
733
+wl_ext_get_chan(struct wl_apsta_params *apsta_params,
734
+ struct net_device *dev, struct wl_chan_info *chan_info)
773735 {
774736 uint16 chan = 0, ctl_chan;
775737 u32 chanspec = 0;
776738
777
- chanspec = wl_ext_get_chanspec(dev, chan_info);
739
+ chanspec = wl_ext_get_chanspec(apsta_params, dev, chan_info);
778740 if (chanspec) {
779741 ctl_chan = wf_chspec_ctlchan(chanspec);
780742 chan = (u16)(ctl_chan & 0x00FF);
....@@ -783,26 +745,10 @@
783745 return chan;
784746 }
785747
786
-void
787
-wl_ext_get_chan_str(struct net_device *dev, char *chan_str, int total_len)
788
-{
789
- struct wl_chan_info chan_info;
790
- int bytes_written=0;
791
- u32 chanspec = 0;
792
-
793
- memset(chan_str, 0, total_len);
794
- chanspec = wl_ext_get_chanspec(dev, &chan_info);
795
- if (chanspec) {
796
- bytes_written += snprintf(chan_str+bytes_written, total_len, "%s-%d %sMHz",
797
- WLCBAND2STR(chan_info.band), chan_info.chan,
798
- wf_chspec_to_bw_str(chanspec));
799
- }
800
-}
801
-
802748 static chanspec_t
803
-wl_ext_chan_to_chanspec(struct net_device *dev, struct wl_chan_info *chan_info)
749
+wl_ext_chan_to_chanspec(struct wl_apsta_params *apsta_params,
750
+ struct net_device *dev, struct wl_chan_info *chan_info)
804751 {
805
- struct dhd_pub *dhd = dhd_get_pub(dev);
806752 chanspec_band_t chanspec_band;
807753 chanspec_t chspec = 0, fw_chspec = 0;
808754 u32 bw = WL_CHANSPEC_BW_20;
....@@ -844,7 +790,7 @@
844790 chanspec_band = wl_ext_wlcband_to_chanspec_band(chan_info->band);
845791 chspec = wf_create_chspec_from_primary(chan_info->chan, bw, chanspec_band);
846792 if (wf_chspec_valid(chspec)) {
847
- fw_chspec = wl_ext_chspec_host_to_driver(dhd, chspec);
793
+ fw_chspec = wl_ext_chspec_host_to_driver(apsta_params->ioctl_ver, chspec);
848794 if (fw_chspec == INVCHANSPEC) {
849795 IAPSTA_ERROR(dev->name, "failed to convert host chanspec to fw chanspec\n");
850796 fw_chspec = 0;
....@@ -901,88 +847,47 @@
901847 return bytes_written;
902848 }
903849
904
-void
905
-wl_ext_send_event_msg(struct net_device *dev, int event, int status,
906
- int reason)
850
+static void
851
+wl_ext_mod_timer(timer_list_compat_t *timer, uint sec, uint msec)
852
+{
853
+ uint timeout = sec * 1000 + msec;
854
+
855
+ IAPSTA_TRACE("wlan", "timeout=%d\n", timeout);
856
+
857
+ if (timer_pending(timer))
858
+ del_timer_sync(timer);
859
+
860
+ if (timeout)
861
+ mod_timer(timer, jiffies + msecs_to_jiffies(timeout));
862
+}
863
+
864
+static void
865
+wl_ext_send_event_msg(struct net_device *dev, int event, int status)
907866 {
908867 struct dhd_pub *dhd = dhd_get_pub(dev);
909868 struct wl_if_info *cur_if;
910869 wl_event_msg_t msg;
911870
912
- if (dhd && dhd->up) {
913
- cur_if = wl_get_cur_if(dev);
914
- if (!cur_if)
915
- return;
916
- bzero(&msg, sizeof(wl_event_msg_t));
917
- msg.ifidx = dhd_net2idx(dhd->info, dev);
918
- msg.event_type = hton32(event);
919
- msg.status = hton32(status);
920
- msg.reason = hton32(reason);
921
- memcpy(&msg.addr, &cur_if->bssid, ETHER_ADDR_LEN);
871
+ cur_if = wl_get_cur_if(dev);
872
+ if (!cur_if)
873
+ return;
874
+
875
+ bzero(&msg, sizeof(wl_event_msg_t));
876
+
877
+ msg.ifidx = dhd_net2idx(dhd->info, dev);
878
+ msg.event_type = hton32(event);
879
+ msg.status = hton32(status);
880
+ memcpy(&msg.addr, &cur_if->bssid, ETHER_ADDR_LEN);
881
+
922882 #ifdef WL_EVENT
923
- wl_ext_event_send(dhd->event_params, &msg, NULL);
924
-#endif /* WL_EVENT */
883
+ wl_ext_event_send(dhd->event_params, &msg, NULL);
884
+#endif
925885 #ifdef WL_CFG80211
886
+ if (dhd->up) {
926887 wl_cfg80211_event(dev, &msg, NULL);
927
-#endif /* WL_CFG80211 */
928888 }
889
+#endif /* defined(WL_CFG80211) */
929890 }
930
-
931
-#ifdef BTC_WAR
932
-bool
933
-wl_ext_iapsta_if_2g_enabled(struct net_device *net)
934
-{
935
- struct dhd_pub *dhd = dhd_get_pub(net);
936
- struct wl_apsta_params *apsta_params = dhd->iapsta_params;
937
- struct wl_if_info *tmp_if;
938
- struct wl_chan_info chan_info;
939
- bool enabled = FALSE;
940
- uint16 cur_chan;
941
- int i;
942
-
943
- for (i=0; i<MAX_IF_NUM; i++) {
944
- tmp_if = &apsta_params->if_info[i];
945
- if (tmp_if && wl_get_isam_status(tmp_if, IF_READY)) {
946
- cur_chan = wl_ext_get_chan(tmp_if->dev, &chan_info);
947
- if (cur_chan && chan_info.band == WLC_BAND_2G) {
948
- enabled = TRUE;
949
- break;
950
- }
951
- }
952
- }
953
-
954
- return enabled;
955
-}
956
-
957
-void
958
-wl_ext_btc_config(struct net_device *dev, bool enable)
959
-{
960
- struct dhd_pub *dhd = dhd_get_pub(dev);
961
- bool enab = FALSE;
962
-
963
- if (dhd->conf->chip == BCM4354_CHIP_ID || dhd->conf->chip == BCM4356_CHIP_ID ||
964
- dhd->conf->chip == BCM43752_CHIP_ID) {
965
- IAPSTA_INFO(dev->name, "btc_war=%d, enable=%d\n", btc_war, enable);
966
- if (btc_war >= 0) {
967
- if (enable && btc_war > 0) {
968
- if (wl_ext_iapsta_if_2g_enabled(dev))
969
- enab = TRUE;
970
- }
971
- if (enab) {
972
- IAPSTA_INFO(dev->name, "enable\n");
973
- wl_ext_iovar_setint(dev, "txchain", 2);
974
- wl_ext_iovar_setint(dev, "rxchain", 2);
975
- wl_ext_iovar_setint(dev, "btc_mode", 5);
976
- } else {
977
- IAPSTA_INFO(dev->name, "disable\n");
978
- wl_ext_iovar_setint(dev, "btc_mode", 1);
979
- wl_ext_iovar_setint(dev, "txchain", 3);
980
- wl_ext_iovar_setint(dev, "rxchain", 3);
981
- }
982
- }
983
- }
984
-}
985
-#endif /* BTC_WAR */
986891
987892 static void
988893 wl_ext_connect_timeout(unsigned long data)
....@@ -1003,7 +908,7 @@
1003908 cur_if->assoc_info.reassoc = 0;
1004909 #endif /* WL_EXT_RECONNECT && WL_CFG80211 */
1005910 IAPSTA_ERROR(dev->name, "timer expired\n");
1006
- wl_ext_send_event_msg(dev, WLC_E_SET_SSID, WLC_E_STATUS_NO_NETWORKS, WLC_E_STATUS_SUCCESS);
911
+ wl_ext_send_event_msg(dev, WLC_E_SET_SSID, WLC_E_STATUS_NO_NETWORKS);
1007912 }
1008913
1009914 #if defined(WL_CFG80211) || (defined(WLMESH) && defined(WL_ESCAN))
....@@ -1131,7 +1036,7 @@
11311036 }
11321037
11331038 #ifdef WL_ESCAN
1134
-#define WL_MESH_DELAY_SCAN_TMO 3000
1039
+#define WL_MESH_DELAY_SCAN_TMO 3
11351040 static void
11361041 wl_mesh_timer(unsigned long data)
11371042 {
....@@ -1223,10 +1128,9 @@
12231128 }
12241129
12251130 static int
1226
-wl_mesh_clear_mesh_info(struct wl_if_info *mesh_if, bool scan)
1131
+wl_mesh_clear_mesh_info(struct wl_apsta_params *apsta_params,
1132
+ struct wl_if_info *mesh_if, bool scan)
12271133 {
1228
- struct dhd_pub *dhd = dhd_get_pub(mesh_if->dev);
1229
- struct wl_apsta_params *apsta_params = dhd->iapsta_params;
12301134 struct wl_mesh_params *mesh_info = &apsta_params->mesh_info;
12311135 uchar mesh_oui[]={0x00, 0x22, 0xf4};
12321136 int ret;
....@@ -1236,9 +1140,9 @@
12361140 ret = wl_mesh_clear_vndr_ie(mesh_if->dev, mesh_oui);
12371141 memset(mesh_info, 0, sizeof(struct wl_mesh_params));
12381142 if (scan) {
1239
- mesh_info->scan_channel = wl_ext_get_chan(mesh_if->dev,
1143
+ mesh_info->scan_channel = wl_ext_get_chan(apsta_params, mesh_if->dev,
12401144 &mesh_if->chan_info);
1241
- wl_timer_mod(dhd, &mesh_if->delay_scan, 100);
1145
+ wl_ext_mod_timer(&mesh_if->delay_scan, 0, 100);
12421146 }
12431147
12441148 return ret;
....@@ -1317,7 +1221,8 @@
13171221 if (sta_if) {
13181222 wldev_ioctl(mesh_if->dev, WLC_GET_BSSID, &mesh_info->master_bssid,
13191223 ETHER_ADDR_LEN, 0);
1320
- mesh_info->master_channel = wl_ext_get_chan(mesh_if->dev, &mesh_if->chan_info);
1224
+ mesh_info->master_channel = wl_ext_get_chan(apsta_params, mesh_if->dev,
1225
+ &mesh_if->chan_info);
13211226 mesh_info->hop_cnt = 0;
13221227 memset(mesh_info->peer_bssid, 0, MAX_HOP_LIST*ETHER_ADDR_LEN);
13231228 if (!wl_mesh_update_vndr_ie(apsta_params, mesh_if))
....@@ -1393,7 +1298,8 @@
13931298 wl_ext_get_sec(mesh_if->dev, mesh_if->ifmode, sec, sizeof(sec), FALSE);
13941299 if (strnicmp(sec, "sae/sae", strlen("sae/sae")) == 0)
13951300 sae = TRUE;
1396
- cur_chan = wl_ext_get_chan(mesh_if->dev, &mesh_if->chan_info);
1301
+ cur_chan = wl_ext_get_chan(apsta_params, mesh_if->dev,
1302
+ &mesh_if->chan_info);
13971303 bss_found = wl_escan_mesh_peer(mesh_if->dev, mesh_if->escan, &cur_ssid, cur_chan,
13981304 sae, &peer_mesh_info);
13991305
....@@ -1414,105 +1320,67 @@
14141320 }
14151321
14161322 static void
1417
-wl_mesh_event_handler(struct wl_if_info *cur_if,
1418
- const wl_event_msg_t *e, void *data)
1323
+wl_mesh_event_handler(struct wl_apsta_params *apsta_params,
1324
+ struct wl_if_info *mesh_if, const wl_event_msg_t *e, void *data)
14191325 {
1420
- struct dhd_pub *dhd = dhd_get_pub(cur_if->dev);
1421
- struct wl_apsta_params *apsta_params = dhd->iapsta_params;
14221326 struct wl_mesh_params *mesh_info = &apsta_params->mesh_info;
14231327 uint32 event_type = ntoh32(e->event_type);
14241328 uint32 status = ntoh32(e->status);
14251329 uint32 reason = ntoh32(e->reason);
1426
- uint16 flags = ntoh16(e->flags);
1427
- struct wl_if_info *mesh_if = NULL, *tmp_if = NULL;
1428
- int ret, i;
1330
+ int ret;
14291331
1430
- if (cur_if->ifmode == IMESH_MODE)
1431
- mesh_if = cur_if;
1432
- else {
1433
- for (i=0; i<MAX_IF_NUM; i++) {
1434
- tmp_if = &apsta_params->if_info[i];
1435
- if (tmp_if->dev && tmp_if->ifmode == IMESH_MODE) {
1436
- mesh_if = tmp_if;
1437
- break;
1438
- }
1332
+ if (wl_get_isam_status(mesh_if, AP_CREATED) &&
1333
+ ((event_type == WLC_E_SET_SSID && status == WLC_E_STATUS_SUCCESS) ||
1334
+ (event_type == WLC_E_LINK && status == WLC_E_STATUS_SUCCESS &&
1335
+ reason == WLC_E_REASON_INITIAL_ASSOC))) {
1336
+ if (!wl_mesh_update_master_info(apsta_params, mesh_if)) {
1337
+ mesh_info->scan_channel = wl_ext_get_chan(apsta_params, &mesh_if->dev,
1338
+ mesh_if->chan_info);
1339
+ wl_ext_mod_timer(&mesh_if->delay_scan, WL_MESH_DELAY_SCAN_TMO, 0);
14391340 }
14401341 }
1441
-
1442
- if (cur_if->ifmode == ISTA_MODE || cur_if->ifmode == IGC_MODE) {
1443
- if (event_type == WLC_E_LINK) {
1444
- if (!(flags & WLC_EVENT_MSG_LINK)) {
1445
- if (mesh_if && apsta_params->macs)
1446
- wl_mesh_clear_mesh_info(mesh_if, TRUE);
1447
- } else {
1448
- if (mesh_if && apsta_params->macs)
1449
- wl_mesh_update_master_info(apsta_params, mesh_if);
1342
+ else if ((event_type == WLC_E_LINK && reason == WLC_E_LINK_BSSCFG_DIS) ||
1343
+ (event_type == WLC_E_LINK && status == WLC_E_STATUS_SUCCESS &&
1344
+ reason == WLC_E_REASON_DEAUTH)) {
1345
+ wl_mesh_clear_mesh_info(apsta_params, mesh_if, FALSE);
1346
+ }
1347
+ else if (wl_get_isam_status(mesh_if, AP_CREATED) &&
1348
+ (event_type == WLC_E_ASSOC_IND || event_type == WLC_E_REASSOC_IND) &&
1349
+ reason == DOT11_SC_SUCCESS) {
1350
+ mesh_info->scan_channel = wl_ext_get_chan(apsta_params, mesh_if->dev,
1351
+ &mesh_if->chan_info);
1352
+ wl_ext_mod_timer(&mesh_if->delay_scan, 0, 100);
1353
+ }
1354
+ else if (event_type == WLC_E_DISASSOC_IND || event_type == WLC_E_DEAUTH_IND ||
1355
+ (event_type == WLC_E_DEAUTH && reason != DOT11_RC_RESERVED)) {
1356
+ if (!memcmp(&mesh_info->peer_bssid, &e->addr, ETHER_ADDR_LEN))
1357
+ wl_mesh_clear_mesh_info(apsta_params, mesh_if, TRUE);
1358
+ }
1359
+ else if (wl_get_isam_status(mesh_if, AP_CREATED) &&
1360
+ event_type == WLC_E_RESERVED && reason == ISAM_RC_MESH_ACS) {
1361
+ if (!wl_mesh_update_master_info(apsta_params, mesh_if)) {
1362
+ wl_scan_info_t scan_info;
1363
+ memset(&scan_info, 0, sizeof(wl_scan_info_t));
1364
+ wl_ext_ioctl(mesh_if->dev, WLC_GET_SSID, &scan_info.ssid, sizeof(wlc_ssid_t), 0);
1365
+ if (mesh_info->scan_channel) {
1366
+ scan_info.channels.count = 1;
1367
+ scan_info.channels.channel[0] = mesh_info->scan_channel;
14501368 }
1451
- }
1452
- else if (event_type == WLC_E_SET_SSID && status != WLC_E_STATUS_SUCCESS) {
1453
- if (mesh_if && apsta_params->macs)
1454
- wl_mesh_clear_mesh_info(mesh_if, TRUE);
1455
- }
1456
- else if (event_type == WLC_E_DEAUTH || event_type == WLC_E_DEAUTH_IND ||
1457
- event_type == WLC_E_DISASSOC || event_type == WLC_E_DISASSOC_IND) {
1458
- if (mesh_if && apsta_params->macs)
1459
- wl_mesh_clear_mesh_info(mesh_if, TRUE);
1369
+ ret = wl_escan_set_scan(mesh_if->dev, &scan_info);
1370
+ if (ret)
1371
+ wl_ext_mod_timer(&mesh_if->delay_scan, WL_MESH_DELAY_SCAN_TMO, 0);
14601372 }
14611373 }
1462
- else if (cur_if->ifmode == IMESH_MODE && apsta_params->macs) {
1463
- if (wl_get_isam_status(mesh_if, AP_CREATED) &&
1464
- ((event_type == WLC_E_SET_SSID && status == WLC_E_STATUS_SUCCESS) ||
1465
- (event_type == WLC_E_LINK && status == WLC_E_STATUS_SUCCESS &&
1466
- reason == WLC_E_REASON_INITIAL_ASSOC))) {
1467
- if (!wl_mesh_update_master_info(apsta_params, mesh_if)) {
1468
- mesh_info->scan_channel = wl_ext_get_chan(&mesh_if->dev,
1469
- mesh_if->chan_info);
1470
- wl_timer_mod(dhd, &mesh_if->delay_scan, WL_MESH_DELAY_SCAN_TMO);
1471
- }
1472
- }
1473
- else if ((event_type == WLC_E_LINK && reason == WLC_E_LINK_BSSCFG_DIS) ||
1474
- (event_type == WLC_E_LINK && status == WLC_E_STATUS_SUCCESS &&
1475
- reason == WLC_E_REASON_DEAUTH)) {
1476
- wl_mesh_clear_mesh_info(mesh_if, FALSE);
1477
- }
1478
- else if (wl_get_isam_status(mesh_if, AP_CREATED) &&
1479
- (event_type == WLC_E_ASSOC_IND || event_type == WLC_E_REASSOC_IND) &&
1480
- reason == DOT11_SC_SUCCESS) {
1481
- mesh_info->scan_channel = wl_ext_get_chan(mesh_if->dev,
1482
- &mesh_if->chan_info);
1483
- wl_timer_mod(dhd, &mesh_if->delay_scan, 100);
1484
- }
1485
- else if (event_type == WLC_E_DISASSOC_IND || event_type == WLC_E_DEAUTH_IND ||
1486
- (event_type == WLC_E_DEAUTH && reason != DOT11_RC_RESERVED)) {
1487
- if (!memcmp(&mesh_info->peer_bssid, &e->addr, ETHER_ADDR_LEN))
1488
- wl_mesh_clear_mesh_info(mesh_if, TRUE);
1489
- }
1490
- else if (wl_get_isam_status(mesh_if, AP_CREATED) &&
1491
- event_type == WLC_E_RESERVED && reason == ISAM_RC_MESH_ACS) {
1492
- if (!wl_mesh_update_master_info(apsta_params, mesh_if)) {
1493
- wl_scan_info_t scan_info;
1494
- memset(&scan_info, 0, sizeof(wl_scan_info_t));
1495
- wl_ext_ioctl(mesh_if->dev, WLC_GET_SSID, &scan_info.ssid, sizeof(wlc_ssid_t), 0);
1496
- if (mesh_info->scan_channel) {
1497
- scan_info.channels.count = 1;
1498
- scan_info.channels.channel[0] = mesh_info->scan_channel;
1499
- }
1500
- ret = wl_escan_set_scan(mesh_if->dev, &scan_info);
1501
- if (ret)
1502
- wl_timer_mod(dhd, &mesh_if->delay_scan, WL_MESH_DELAY_SCAN_TMO);
1503
- }
1504
- }
1505
- else if (wl_get_isam_status(mesh_if, AP_CREATED) &&
1506
- ((event_type == WLC_E_ESCAN_RESULT && status == WLC_E_STATUS_SUCCESS) ||
1507
- (event_type == WLC_E_ESCAN_RESULT &&
1508
- (status == WLC_E_STATUS_ABORT || status == WLC_E_STATUS_NEWSCAN ||
1509
- status == WLC_E_STATUS_11HQUIET || status == WLC_E_STATUS_CS_ABORT ||
1510
- status == WLC_E_STATUS_NEWASSOC || status == WLC_E_STATUS_TIMEOUT)))) {
1511
- if (!wl_mesh_update_master_info(apsta_params, mesh_if)) {
1512
- if (!wl_mesh_update_mesh_info(apsta_params, mesh_if)) {
1513
- mesh_info->scan_channel = 0;
1514
- wl_timer_mod(dhd, &mesh_if->delay_scan, WL_MESH_DELAY_SCAN_TMO);
1515
- }
1374
+ else if (wl_get_isam_status(mesh_if, AP_CREATED) &&
1375
+ ((event_type == WLC_E_ESCAN_RESULT && status == WLC_E_STATUS_SUCCESS) ||
1376
+ (event_type == WLC_E_ESCAN_RESULT &&
1377
+ (status == WLC_E_STATUS_ABORT || status == WLC_E_STATUS_NEWSCAN ||
1378
+ status == WLC_E_STATUS_11HQUIET || status == WLC_E_STATUS_CS_ABORT ||
1379
+ status == WLC_E_STATUS_NEWASSOC || status == WLC_E_STATUS_TIMEOUT)))) {
1380
+ if (!wl_mesh_update_master_info(apsta_params, mesh_if)) {
1381
+ if (!wl_mesh_update_mesh_info(apsta_params, mesh_if)) {
1382
+ mesh_info->scan_channel = 0;
1383
+ wl_ext_mod_timer(&mesh_if->delay_scan, WL_MESH_DELAY_SCAN_TMO, 0);
15161384 }
15171385 }
15181386 }
....@@ -1522,7 +1390,9 @@
15221390 wl_mesh_escan_detach(dhd_pub_t *dhd, struct wl_if_info *mesh_if)
15231391 {
15241392 IAPSTA_TRACE(mesh_if->dev->name, "Enter\n");
1525
- wl_timer_deregister(mesh_if->dev, &mesh_if->delay_scan);
1393
+
1394
+ del_timer_sync(&mesh_if->delay_scan);
1395
+
15261396 if (mesh_if->escan) {
15271397 mesh_if->escan = NULL;
15281398 }
....@@ -1534,7 +1404,7 @@
15341404 IAPSTA_TRACE(mesh_if->dev->name, "Enter\n");
15351405
15361406 mesh_if->escan = dhd->escan;
1537
- wl_timer_register(mesh_if->dev, &mesh_if->delay_scan, wl_mesh_timer);
1407
+ init_timer_compat(&mesh_if->delay_scan, wl_mesh_timer, mesh_if->dev);
15381408
15391409 return 0;
15401410 }
....@@ -1709,10 +1579,6 @@
17091579 WL_MSG(cur_if->ifname, "[%c] skip DFS channel %d\n",
17101580 cur_if->prefix, chan_info->chan);
17111581 return 0;
1712
- } else if (wl_ext_passive_chan(cur_if->dev, chan_info)) {
1713
- WL_MSG(cur_if->ifname, "[%c] skip PASSIVE channel %d\n",
1714
- cur_if->prefix, chan_info->chan);
1715
- return 0;
17161582 } else if (!chan_info->chan) {
17171583 WL_MSG(cur_if->ifname, "[%c] no valid channel\n", cur_if->prefix);
17181584 return 0;
....@@ -1747,7 +1613,7 @@
17471613 }
17481614
17491615 wl_ext_ioctl(cur_if->dev, WLC_GET_SSID, &ssid, sizeof(ssid), 0);
1750
- chanspec = wl_ext_get_chanspec(cur_if->dev, chan_info);
1616
+ chanspec = wl_ext_get_chanspec(apsta_params, cur_if->dev, chan_info);
17511617 WL_MSG(cur_if->ifname, "[%c] enabled with SSID: \"%s\" on channel %s-%d(0x%x)\n",
17521618 cur_if->prefix, ssid.SSID, CHSPEC2BANDSTR(chanspec),
17531619 chan_info->chan, chanspec);
....@@ -1797,7 +1663,7 @@
17971663 if (cur_if != tmp_if && wl_get_isam_status(tmp_if, IF_READY) &&
17981664 tmp_if->prio > max_prio) {
17991665 memset(&chan_info, 0, sizeof(struct wl_chan_info));
1800
- wl_ext_get_chan(tmp_if->dev, &chan_info);
1666
+ wl_ext_get_chan(apsta_params, tmp_if->dev, &chan_info);
18011667 if (wl_ext_dfs_chan(&chan_info) && nodfs)
18021668 continue;
18031669 if (chan_info.chan && (cur_if->chan_info.band == chan_info.band)) {
....@@ -1824,7 +1690,7 @@
18241690 return 0;
18251691
18261692 memset(&chan_info, 0, sizeof(struct wl_chan_info));
1827
- target_chan = wl_ext_get_chan(target_if->dev, &chan_info);
1693
+ target_chan = wl_ext_get_chan(apsta_params, target_if->dev, &chan_info);
18281694 if (target_chan) {
18291695 target_band = chan_info.band;
18301696 IAPSTA_INFO(cur_if->ifname, "cur_chan=%s-%d, target_chan=%s-%d\n",
....@@ -1852,13 +1718,13 @@
18521718
18531719 if (apsta_params->rsdb) {
18541720 memset(&cur_chan_info, 0, sizeof(struct wl_chan_info));
1855
- wl_ext_get_chan(cur_if->dev, &cur_chan_info);
1721
+ wl_ext_get_chan(apsta_params, cur_if->dev, &cur_chan_info);
18561722 for (i=0; i<MAX_IF_NUM; i++) {
18571723 tmp_if = &apsta_params->if_info[i];
18581724 if (tmp_if != cur_if && wl_get_isam_status(tmp_if, IF_READY) &&
18591725 tmp_if->prio > cur_if->prio) {
18601726 memset(&tmp_chan_info, 0, sizeof(struct wl_chan_info));
1861
- wl_ext_get_chan(tmp_if->dev, &tmp_chan_info);
1727
+ wl_ext_get_chan(apsta_params, tmp_if->dev, &tmp_chan_info);
18621728 if (!tmp_chan_info.chan)
18631729 continue;
18641730 if (wl_ext_rsdb_band(cur_chan_info.band, tmp_chan_info.band) &&
....@@ -1891,7 +1757,8 @@
18911757 memset(&csa_arg, 0, sizeof(csa_arg));
18921758 csa_arg.mode = 1;
18931759 csa_arg.count = 3;
1894
- csa_arg.chspec = wl_ext_chan_to_chanspec(cur_if->dev, &cur_if->chan_info);
1760
+ csa_arg.chspec = wl_ext_chan_to_chanspec(apsta_params, cur_if->dev,
1761
+ &cur_if->chan_info);
18951762 core_conflict = wl_ext_rsdb_core_conflict(apsta_params, cur_if);
18961763 if (core_conflict) {
18971764 WL_MSG(cur_if->ifname, "[%c] Skip CSA due to rsdb core conflict\n",
....@@ -1940,7 +1807,6 @@
19401807 if (!auto_chan) {
19411808 auto_chan = wl_ext_autochannel(cur_if->dev, ACS_FW_BIT|ACS_DRV_BIT,
19421809 cur_chan_info->band);
1943
- auto_chan = wf_chspec_ctlchan(auto_chan);
19441810 }
19451811 if (auto_chan)
19461812 cur_chan_info->chan = auto_chan;
....@@ -1962,7 +1828,6 @@
19621828 if (!auto_chan) {
19631829 auto_chan = wl_ext_autochannel(cur_if->dev, ACS_FW_BIT|ACS_DRV_BIT,
19641830 cur_chan_info->band);
1965
- auto_chan = wf_chspec_ctlchan(auto_chan);
19661831 }
19671832 if (auto_chan) {
19681833 cur_chan_info->chan = auto_chan;
....@@ -1976,7 +1841,6 @@
19761841 } else {
19771842 auto_chan = wl_ext_autochannel(cur_if->dev, ACS_FW_BIT|ACS_DRV_BIT,
19781843 cur_chan_info->band);
1979
- auto_chan = wf_chspec_ctlchan(auto_chan);
19801844 if (auto_chan) {
19811845 cur_chan_info->chan = auto_chan;
19821846 }
....@@ -2015,7 +1879,6 @@
20151879 if (!auto_chan) {
20161880 auto_chan = wl_ext_autochannel(tgt_if->dev, ACS_FW_BIT|ACS_DRV_BIT,
20171881 tgt_chan_info->band);
2018
- auto_chan = wf_chspec_ctlchan(auto_chan);
20191882 }
20201883 if (auto_chan) {
20211884 tgt_chan_info->chan = auto_chan;
....@@ -2028,7 +1891,6 @@
20281891 if (!auto_chan) {
20291892 auto_chan = wl_ext_autochannel(tgt_if->dev, ACS_FW_BIT|ACS_DRV_BIT,
20301893 tgt_chan_info->band);
2031
- auto_chan = wf_chspec_ctlchan(auto_chan);
20321894 }
20331895 } else {
20341896 tgt_chan_info->chan = 0;
....@@ -2076,8 +1938,8 @@
20761938 if (target_if) {
20771939 memset(&cur_chan_info, 0, sizeof(struct wl_chan_info));
20781940 memset(&tgt_chan_info, 0, sizeof(struct wl_chan_info));
2079
- wl_ext_get_chan(cur_if->dev, &cur_chan_info);
2080
- wl_ext_get_chan(target_if->dev, &tgt_chan_info);
1941
+ wl_ext_get_chan(apsta_params, cur_if->dev, &cur_chan_info);
1942
+ wl_ext_get_chan(apsta_params, target_if->dev, &tgt_chan_info);
20811943 if (apsta_params->rsdb && cur_chan_info.chan &&
20821944 wl_ext_rsdb_band(cur_chan_info.band, tgt_chan_info.band)) {
20831945 WL_MSG(cur_if->ifname, "[%c] keep on current channel %s-%d\n",
....@@ -2239,50 +2101,6 @@
22392101 return connecting;
22402102 }
22412103
2242
-bool
2243
-wl_ext_sta_handshaking(struct net_device *dev)
2244
-{
2245
- struct wl_if_info *cur_if = NULL;
2246
- bool connecting = FALSE;
2247
- int state;
2248
-
2249
- cur_if = wl_get_cur_if(dev);
2250
- if (!cur_if)
2251
- return FALSE;
2252
-
2253
- if (cur_if->ifmode != ISTA_MODE && cur_if->ifmode != IGC_MODE)
2254
- return FALSE;
2255
-
2256
- state = cur_if->conn_state;
2257
- if (state >= CONN_STATE_4WAY_M1 && state < CONN_STATE_CONNECTED) {
2258
- connecting = TRUE;
2259
- IAPSTA_TRACE(dev->name, "conn_state %d\n", state);
2260
- }
2261
-
2262
- return connecting;
2263
-}
2264
-
2265
-#ifdef DHD_LOSSLESS_ROAMING
2266
-int
2267
-wl_ext_any_sta_handshaking(struct dhd_pub *dhd)
2268
-{
2269
- struct wl_apsta_params *apsta_params = dhd->iapsta_params;
2270
- struct wl_if_info *cur_if;
2271
- int state = 0, i;
2272
-
2273
- for (i=0; i<MAX_IF_NUM; i++) {
2274
- cur_if = &apsta_params->if_info[i];
2275
- if (cur_if->dev && cur_if->ifmode == ISTA_MODE) {
2276
- state = cur_if->conn_state;
2277
- if (state >= CONN_STATE_4WAY_M1 && state < CONN_STATE_CONNECTED) {
2278
- return state;
2279
- }
2280
- }
2281
- }
2282
- return 0;
2283
-}
2284
-#endif /* DHD_LOSSLESS_ROAMING */
2285
-
22862104 #ifdef PROPTX_MAXCOUNT
22872105 int
22882106 wl_ext_get_wlfc_maxcount(struct dhd_pub *dhd, int ifidx)
....@@ -2325,7 +2143,7 @@
23252143 tmp_if = &apsta_params->if_info[i];
23262144 if (tmp_if->dev) {
23272145 memset(&chan_info, 0, sizeof(struct wl_chan_info));
2328
- wl_ext_get_chan(tmp_if->dev, &chan_info);
2146
+ wl_ext_get_chan(apsta_params, tmp_if->dev, &chan_info);
23292147 if (chan_info.band == WLC_BAND_5G || chan_info.band == WLC_BAND_6G) {
23302148 tmp_if->transit_maxcount = dhd->conf->proptx_maxcnt_5g;
23312149 ret = dhd_wlfc_update_maxcount(dhd, tmp_if->ifidx,
....@@ -2341,7 +2159,7 @@
23412159 for (i=0; i<MAX_IF_NUM; i++) {
23422160 tmp_if = &apsta_params->if_info[i];
23432161 if (tmp_if->dev) {
2344
- wl_ext_get_chan(tmp_if->dev, &chan_info);
2162
+ wl_ext_get_chan(apsta_params, tmp_if->dev, &chan_info);
23452163 if ((chan_info.chan == 0) || (chan_info.band == WLC_BAND_2G)) {
23462164 if (chan_info.chan == 0) {
23472165 tmp_if->transit_maxcount = WL_TXSTATUS_FREERUNCTR_MASK;
....@@ -2374,7 +2192,7 @@
23742192 if (!cur_if->dev || !wl_ext_master_if(cur_if))
23752193 continue;
23762194 memset(&chan_info, 0, sizeof(struct wl_chan_info));
2377
- wl_ext_get_chan(cur_if->dev, &chan_info);
2195
+ wl_ext_get_chan(apsta_params, cur_if->dev, &chan_info);
23782196 if (chan_info.chan && wl_ext_dfs_chan(&chan_info)) {
23792197 return cur_if;
23802198 }
....@@ -2398,7 +2216,7 @@
23982216 if (!cur_if->dev || !wl_ext_master_if(cur_if))
23992217 continue;
24002218 memset(&chan_info, 0, sizeof(struct wl_chan_info));
2401
- wl_ext_get_chan(cur_if->dev, &chan_info);
2219
+ wl_ext_get_chan(apsta_params, cur_if->dev, &chan_info);
24022220 if (chan_info.chan) {
24032221 cur_if->prev_channel = chan_info.chan;
24042222 cur_if->post_channel = post_channel;
....@@ -2421,8 +2239,6 @@
24212239 cur_if->chan_info.chan = cur_if->post_channel;
24222240 else
24232241 cur_if->chan_info.chan = cur_if->prev_channel;
2424
- if (wl_ext_associated(cur_if->dev))
2425
- wl_ext_if_down(apsta_params, cur_if);
24262242 wl_ext_if_up(apsta_params, cur_if, TRUE, 0);
24272243 cur_if->prev_channel = 0;
24282244 cur_if->post_channel = 0;
....@@ -2469,7 +2285,7 @@
24692285 tmp_if = &apsta_params->if_info[i];
24702286 if (tmp_if && tmp_if->ifmode == ifmode &&
24712287 wl_get_isam_status(tmp_if, IF_READY)) {
2472
- if (wl_ext_get_chan(tmp_if->dev, &tmp_if->chan_info) == channel) {
2288
+ if (wl_ext_get_chan(apsta_params, tmp_if->dev, &tmp_if->chan_info) == channel) {
24732289 WL_MSG(tmp_if->ifname, "re-enable channel %d\n", channel);
24742290 if (ifmode == IAP_MODE) {
24752291 wl_ext_if_down(apsta_params, tmp_if);
....@@ -2500,7 +2316,6 @@
25002316 if (wl_ext_master_if(cur_if) && apsta_params->acs) {
25012317 chan_info->chan = wl_ext_autochannel(cur_if->dev, apsta_params->acs,
25022318 chan_info->band);
2503
- chan_info->chan = wf_chspec_ctlchan(chan_info->chan);
25042319 }
25052320 chan_info->chan = wl_ext_move_cur_channel(apsta_params, cur_if);
25062321 if (chan_info->chan) {
....@@ -2518,7 +2333,7 @@
25182333 }
25192334 }
25202335 if (cur_if->ifmode == ISTA_MODE) {
2521
- if (conf->war & SET_CHAN_INCONN && chan_info->chan) {
2336
+ if (conf->war & SET_CHAN_INCONN) {
25222337 chanspec_t fw_chspec;
25232338 IAPSTA_INFO(dev->name, "set channel %d\n", chan_info->chan);
25242339 wl_ext_set_chanspec(cur_if->dev, chan_info, &fw_chspec);
....@@ -2576,9 +2391,6 @@
25762391 cur_if->prio = PRIO_STA;
25772392 cur_if->vsdb = TRUE;
25782393 cur_if->prefix = 'S';
2579
-#ifdef WL_STATIC_IF
2580
- dhd_conf_preinit_ioctls_sta(dhd, ifidx);
2581
-#endif /* WL_STATIC_IF */
25822394 } else if (wl_iftype == WL_IF_TYPE_AP && cur_if->ifmode != IMESH_MODE) {
25832395 cur_if->ifmode = IAP_MODE;
25842396 cur_if->prio = PRIO_AP;
....@@ -2683,84 +2495,7 @@
26832495 return;
26842496 }
26852497 IAPSTA_ERROR(dev->name, "timer expired\n");
2686
- wl_ext_send_event_msg(dev, WLC_E_SET_SSID, WLC_E_STATUS_NO_NETWORKS, WLC_E_STATUS_SUCCESS);
2687
-}
2688
-
2689
-#ifdef WL_EXT_DISCONNECT_RECONNECT
2690
-static bool
2691
-wl_ext_disc_recon_retry(struct wl_apsta_params *apsta_params, struct wl_if_info *cur_if)
2692
-{
2693
- int sta_disc_recon_cnt = cur_if->sta_disc_recon_cnt;
2694
- struct osl_timespec *sta_disc_conn_ts = &cur_if->sta_disc_conn_ts;
2695
- struct osl_timespec cur_ts;
2696
- uint32 diff_ms = 0;
2697
- bool retry = FALSE;
2698
-
2699
- if (sta_disc_recon_cnt == 0)
2700
- osl_do_gettimeofday(sta_disc_conn_ts);
2701
-
2702
- osl_do_gettimeofday(&cur_ts);
2703
- diff_ms = osl_do_gettimediff(&cur_ts, sta_disc_conn_ts)/1000;
2704
-
2705
- IAPSTA_INFO(cur_if->ifname, "sta_disc_recon_cnt=%d, diff_ms = %dms\n",
2706
- sta_disc_recon_cnt, diff_ms);
2707
- if (sta_disc_recon_cnt >= STA_DISCONNECT_RECONNECT_MAX) {
2708
- if (diff_ms >= STA_DISCONNECT_RECONNECT_TIMEOUT) {
2709
- osl_do_gettimeofday(sta_disc_conn_ts);
2710
- cur_if->sta_disc_recon_cnt = 0;
2711
- retry = TRUE;
2712
- } else {
2713
- retry = FALSE;
2714
- }
2715
- } else {
2716
- retry = TRUE;
2717
- }
2718
-
2719
- if (retry)
2720
- cur_if->sta_disc_recon_cnt++;
2721
-
2722
- return retry;
2723
-}
2724
-#endif /* WL_EXT_DISCONNECT_RECONNECT */
2725
-
2726
-static void
2727
-wl_ext_update_assoc_info(struct net_device *dev, bool reassoc)
2728
-{
2729
-#ifndef WL_REASSOC_BCAST
2730
- dhd_pub_t *dhd = dhd_get_pub(dev);
2731
- struct wl_apsta_params *apsta_params = dhd->iapsta_params;
2732
- struct wl_chan_info chan_info;
2733
-#endif
2734
- struct bcm_cfg80211 *cfg = wl_get_cfg(dev);
2735
- wlcfg_assoc_info_t *assoc_info;
2736
- struct wl_if_info *cur_if;
2737
-
2738
- cur_if = wl_get_cur_if(dev);
2739
- if (cur_if) {
2740
- assoc_info = &cur_if->assoc_info;
2741
- assoc_info->reassoc = reassoc;
2742
- assoc_info->bssid_hint = false;
2743
-#ifdef WL_REASSOC_BCAST
2744
- assoc_info->chan_cnt = 0;
2745
- assoc_info->chanspecs[0] = 0;
2746
- memcpy(&assoc_info->bssid, &ether_bcast, ETHER_ADDR_LEN);
2747
-#else
2748
- assoc_info->chanspecs[0] = wl_ext_get_chanspec(dev, &chan_info);
2749
- if (assoc_info->chanspecs[0] && reassoc) {
2750
- assoc_info->chan_cnt = 1;
2751
- wldev_ioctl(dev, WLC_GET_BSSID, &cur_if->bssid, ETHER_ADDR_LEN, 0);
2752
- memcpy(&assoc_info->bssid, &cur_if->bssid, ETHER_ADDR_LEN);
2753
- } else {
2754
- assoc_info->chan_cnt = 0;
2755
- memcpy(&assoc_info->bssid, &ether_bcast, ETHER_ADDR_LEN);
2756
- }
2757
-#endif /* WL_REASSOC_BCAST */
2758
- if (!ETHER_ISBCAST(assoc_info->bssid))
2759
- assoc_info->targeted_join = true;
2760
- else
2761
- assoc_info->targeted_join = false;
2762
- wl_get_assoc_channels(cfg, dev, assoc_info);
2763
- }
2498
+ wl_ext_send_event_msg(dev, WLC_E_SET_SSID, WLC_E_STATUS_NO_NETWORKS);
27642499 }
27652500
27662501 static int
....@@ -2770,122 +2505,45 @@
27702505 struct wl_apsta_params *apsta_params = dhd->iapsta_params;
27712506 struct wl_if_info *cur_if;
27722507 struct bcm_cfg80211 *cfg = wl_get_cfg(dev);
2773
- struct osl_timespec cur_ts, *sta_conn_ts;
2774
- wlcfg_assoc_info_t *assoc_info;
2508
+ struct osl_timespec cur_ts, *sta_conn_ts = &apsta_params->sta_conn_ts;
27752509 uint32 diff_ms = 0;
27762510 int max_wait_time = 0, ret = 0;
2777
- bool connecting, handshaking, associated;
2778
- uint32 etype = ntoh32(e->event_type);
2779
- uint32 status = ntoh32(e->status);
2780
-
2781
- if (wl_get_drv_status(cfg, DISCONNECTING, dev)) {
2782
- WL_MSG(dev->name, "skip connect retry due to disconnecting\n");
2783
- return BCME_BADADDR;
2784
- }
2511
+ bool connecting = FALSE;
27852512
27862513 cur_if = wl_get_cur_if(dev);
27872514 if (!cur_if)
27882515 return ret;
2789
- sta_conn_ts = &cur_if->sta_conn_ts;
2790
- connecting = wl_ext_sta_connecting(dev);
2791
- handshaking = wl_ext_sta_handshaking(dev);
27922516
27932517 mutex_unlock(&apsta_params->in4way_sync);
27942518 mutex_lock(&cfg->connect_sync);
2519
+ connecting = wl_ext_sta_connecting(dev);
27952520
27962521 osl_do_gettimeofday(&cur_ts);
27972522 diff_ms = osl_do_gettimediff(&cur_ts, sta_conn_ts)/1000;
2798
- associated = wl_ext_associated(dev);
2799
- assoc_info = &cur_if->assoc_info;
28002523
28012524 if (connecting && diff_ms < STA_CONNECT_TIMEOUT &&
28022525 !wl_get_drv_status(cfg, DISCONNECTING, dev)) {
2526
+ uint32 etype = ntoh32(e->event_type);
2527
+ uint32 status = ntoh32(e->status);
28032528 if (etype == WLC_E_SET_SSID && (status == WLC_E_STATUS_NO_NETWORKS ||
28042529 status == WLC_E_STATUS_NO_ACK)) {
2805
- wl_timer_mod(dhd, &cur_if->reconnect_timer, 0);
2806
- if (assoc_info->reassoc && associated && !handshaking) {
2807
- /* There are two cases will come in to retry reassoc:
2808
- * 1) reconnect from wpa_supplicant
2809
- * 2) fw roam
2810
- */
2811
- if (associated)
2812
- bzero(&cfg->last_roamed_addr, ETHER_ADDR_LEN);
2530
+ wl_ext_mod_timer(&cur_if->reconnect_timer, 0, 0);
2531
+ if (cur_if->assoc_info.reassoc) {
28132532 WL_MSG(dev->name, "retry reassoc\n");
2814
- if (wl_handle_reassoc(cfg, dev, assoc_info))
2815
- goto exit;
2816
- if (assoc_info->chan_cnt == 0)
2817
- max_wait_time = STA_CONNECT_FULL_CHAN_TIMEOUT;
2818
- else
2819
- max_wait_time = STA_RECONNECT_RETRY_TIMEOUT +
2820
- (WL_BCAST_SCAN_JOIN_ACTIVE_DWELL_TIME_MS * assoc_info->chan_cnt);
2821
- max_wait_time = min(max_wait_time, STA_CONNECT_FULL_CHAN_TIMEOUT);
2822
- }
2823
- else {
2824
- /* There is one case will come in to retry join:
2825
- * 1) connect from wpa_supplicant
2826
- */
2827
- WL_MSG(dev->name, "retry join\n");
2828
- if (associated) {
2829
- bzero(&cfg->last_roamed_addr, ETHER_ADDR_LEN);
2830
- wl_cfg80211_disassoc(dev, WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT);
2533
+ wl_handle_reassoc(cfg, dev, &cur_if->assoc_info);
2534
+ max_wait_time = STA_RECONNECT_RETRY_TIMEOUT;
2535
+ } else {
2536
+ if (!wl_ext_associated(dev)) {
2537
+ WL_MSG(dev->name, "retry join\n");
2538
+ wl_cfg80211_disassoc(dev, WLAN_REASON_DEAUTH_LEAVING);
2539
+ wl_handle_join(cfg, dev, &cur_if->assoc_info);
2540
+ max_wait_time = STA_CONNECT_RETRY_TIMEOUT;
28312541 }
2832
- if (wl_handle_join(cfg, dev, assoc_info))
2833
- goto exit;
2834
- if (assoc_info->chan_cnt == 0)
2835
- max_wait_time = STA_CONNECT_FULL_CHAN_TIMEOUT;
2836
- else
2837
- max_wait_time = STA_CONNECT_RETRY_TIMEOUT +
2838
- (WL_BCAST_SCAN_JOIN_ACTIVE_DWELL_TIME_MS * assoc_info->chan_cnt);
2839
- max_wait_time = min(max_wait_time, STA_CONNECT_FULL_CHAN_TIMEOUT);
28402542 }
2841
- IAPSTA_INFO(dev->name, "reconnect %dms later\n", max_wait_time);
2842
- wl_timer_mod(dhd, &cur_if->reconnect_timer, max_wait_time);
2543
+ wl_ext_mod_timer(&cur_if->reconnect_timer, 0, max_wait_time);
28432544 }
2844
- ret = BCME_ERROR;
2545
+ ret = -EAGAIN;
28452546 }
2846
-#ifdef WL_EXT_DISCONNECT_RECONNECT
2847
- else if (cur_if->conn_state >= CONN_STATE_CONNECTED &&
2848
- !wl_get_drv_status(cfg, DISCONNECTING, dev) &&
2849
- wl_get_drv_status(cfg, CONNECTED, dev)) {
2850
- if (etype == WLC_E_DISASSOC_IND || etype == WLC_E_DEAUTH_IND) {
2851
- /* There is one case will come in to retry join:
2852
- * 1) receive disconnect from AP after connected
2853
- */
2854
- if (wl_ext_disc_recon_retry(apsta_params, cur_if)) {
2855
- int wpa_auth = 0;
2856
- WL_MSG(dev->name, "retry join cnt %d\n", cur_if->sta_disc_recon_cnt);
2857
- bzero(&cfg->last_roamed_addr, ETHER_ADDR_LEN);
2858
- wl_ext_update_assoc_info(dev, FALSE);
2859
-#ifdef DHD_LOSSLESS_ROAMING
2860
- wl_ext_send_event_msg(dev, WLC_E_ROAM_PREP, WLC_E_STATUS_SUCCESS, WLC_E_REASON_DEAUTH);
2861
-#endif
2862
- if (wl_handle_join(cfg, dev, assoc_info))
2863
- goto exit;
2864
- wl_timer_mod(dhd, &cur_if->connect_timer, STA_CONNECT_TIMEOUT);
2865
- osl_do_gettimeofday(sta_conn_ts);
2866
- wl_ext_update_conn_state(dhd, cur_if->ifidx, CONN_STATE_CONNECTING);
2867
- wl_ext_iovar_getint(dev, "wpa_auth", &wpa_auth);
2868
- if (!(wpa_auth & (WPA3_AUTH_SAE_PSK|0x20))) {
2869
- if (assoc_info->chan_cnt == 0)
2870
- max_wait_time = STA_CONNECT_FULL_CHAN_TIMEOUT;
2871
- else
2872
- max_wait_time = STA_CONNECT_RETRY_TIMEOUT +
2873
- (WL_BCAST_SCAN_JOIN_ACTIVE_DWELL_TIME_MS * assoc_info->chan_cnt);
2874
- max_wait_time = min(max_wait_time, STA_CONNECT_FULL_CHAN_TIMEOUT);
2875
- IAPSTA_INFO(dev->name, "reconnect %dms later\n", max_wait_time);
2876
- wl_timer_mod(dhd, &cur_if->reconnect_timer, max_wait_time);
2877
- }
2878
- ret = BCME_ERROR;
2879
- }
2880
- else {
2881
- WL_MSG(dev->name, "out of retry cnt %d within %dms\n",
2882
- cur_if->sta_disc_recon_cnt, STA_DISCONNECT_RECONNECT_TIMEOUT);
2883
- }
2884
- }
2885
- }
2886
-#endif /* WL_EXT_DISCONNECT_RECONNECT */
2887
-
2888
-exit:
28892547 mutex_unlock(&cfg->connect_sync);
28902548 mutex_lock(&apsta_params->in4way_sync);
28912549
....@@ -2895,7 +2553,6 @@
28952553 static void
28962554 wl_ext_set_connect_retry(struct net_device *dev, void *context)
28972555 {
2898
- struct dhd_pub *dhd = dhd_get_pub(dev);
28992556 wlcfg_assoc_info_t *assoc_info = (wlcfg_assoc_info_t *)context;
29002557 struct wl_if_info *cur_if;
29012558 int max_wait_time;
....@@ -2905,20 +2562,18 @@
29052562 if (!cur_if)
29062563 return;
29072564
2908
- wl_timer_mod(dhd, &cur_if->reconnect_timer, 0);
2565
+ wl_ext_mod_timer(&cur_if->reconnect_timer, 0, 0);
29092566 memset(&cur_if->assoc_info, 0, sizeof(wlcfg_assoc_info_t));
29102567 wl_ext_iovar_getint(dev, "wpa_auth", &wpa_auth);
29112568 if (!(wpa_auth & (WPA3_AUTH_SAE_PSK|0x20) && assoc_info)) {
29122569 memcpy(&cur_if->bssid, assoc_info->bssid, ETHER_ADDR_LEN);
29132570 memcpy(&cur_if->assoc_info, assoc_info, sizeof(wlcfg_assoc_info_t));
2914
- if (assoc_info->chan_cnt == 0)
2915
- max_wait_time = STA_CONNECT_FULL_CHAN_TIMEOUT;
2916
- else if (assoc_info->reassoc)
2571
+ if (assoc_info->reassoc)
29172572 max_wait_time = STA_RECONNECT_RETRY_TIMEOUT;
29182573 else
29192574 max_wait_time = STA_CONNECT_RETRY_TIMEOUT;
29202575 IAPSTA_INFO(dev->name, "reconnect %dms later\n", max_wait_time);
2921
- wl_timer_mod(dhd, &cur_if->reconnect_timer, max_wait_time);
2576
+ wl_ext_mod_timer(&cur_if->reconnect_timer, 0, max_wait_time);
29222577 }
29232578 }
29242579 #endif /* WL_EXT_RECONNECT */
....@@ -3296,7 +2951,7 @@
32962951 #ifdef BCMDBUS
32972952 if (!rx)
32982953 #endif /* BCMDBUS */
3299
- wl_timer_mod(dhd, &cur_if->eapol_timer, 0);
2954
+ wl_ext_mod_timer(&cur_if->eapol_timer, 0, 0);
33002955
33012956 if (cur_if->pend_eapol_pkt) {
33022957 PKTCFREE(dhd->osh, cur_if->pend_eapol_pkt, TRUE);
....@@ -3355,7 +3010,7 @@
33553010 #else
33563011 interval = STA_EAPOL_TIMEOUT;
33573012 #endif /* EAPOL_DYNAMATIC_RESEND */
3358
- wl_timer_mod(dhd, &cur_if->eapol_timer, interval);
3013
+ wl_ext_mod_timer(&cur_if->eapol_timer, 0, interval);
33593014 IAPSTA_TRACE(cur_if->dev->name, "backup eapol pkt\n");
33603015 }
33613016 spin_unlock_irqrestore(&apsta_params->eapol_lock, flags);
....@@ -3389,7 +3044,7 @@
33893044 cur_if->eapol_max_intvl, STA_EAPOL_TIMEOUT,
33903045 cur_if->eapol_cnt);
33913046 #else
3392
- IAPSTA_INFO(dev->name, "resend eapol pkt %dms\n", STA_EAPOL_TIMEOUT);
3047
+ IAPSTA_INFO(dev->name, "resend eapol pkt %d\n", STA_EAPOL_TIMEOUT);
33933048 #endif /* EAPOL_DYNAMATIC_RESEND */
33943049 pending = TRUE;
33953050 }
....@@ -3425,106 +3080,11 @@
34253080 }
34263081 #endif /* EAPOL_RESEND */
34273082
3428
-#ifdef KEY_INSTALL_CHECK
3429
-static void
3430
-wl_ext_key_install_timeout(unsigned long data)
3431
-{
3432
- struct net_device *dev = (struct net_device *)data;
3433
- struct dhd_pub *dhd;
3434
- wl_event_msg_t msg;
3435
-
3436
- if (!dev) {
3437
- IAPSTA_ERROR("wlan", "dev is not ready\n");
3438
- return;
3439
- }
3440
-
3441
- dhd = dhd_get_pub(dev);
3442
-
3443
- bzero(&msg, sizeof(wl_event_msg_t));
3444
- IAPSTA_TRACE(dev->name, "timer expired\n");
3445
-
3446
- msg.ifidx = dhd_net2idx(dhd->info, dev);
3447
- msg.event_type = hton32(WLC_E_RESERVED);
3448
- msg.reason = hton32(ISAM_RC_KEY_INSTALL);
3449
- wl_ext_event_send(dhd->event_params, &msg, NULL);
3450
-}
3451
-
3452
-static void
3453
-wl_ext_key_install_handler(struct wl_if_info *cur_if,
3454
- const wl_event_msg_t *e, void *data)
3455
-{
3456
- struct net_device *dev = cur_if->dev;
3457
- struct dhd_pub *dhd = dhd_get_pub(dev);
3458
- struct bcm_cfg80211 *cfg = wl_get_cfg(dev);
3459
- uint32 etype = ntoh32(e->event_type);
3460
- uint32 reason = ntoh32(e->reason);
3461
- int err, key_installed = 0;
3462
-
3463
- if (etype == WLC_E_RESERVED && reason == ISAM_RC_KEY_INSTALL) {
3464
- if (cur_if->conn_state >= CONN_STATE_4WAY_M4 &&
3465
- !wl_get_drv_status(cfg, DISCONNECTING, dev) &&
3466
- wl_get_drv_status(cfg, CONNECTED, dev)) {
3467
- err = wldev_iovar_getint(dev, "buf_key_b4_m4_installed", &key_installed);
3468
- if (!err && !key_installed) {
3469
- cur_if->key_install_cnt++;
3470
- if (cur_if->key_install_cnt > STA_KEY_INSTALL_MAX) {
3471
- IAPSTA_ERROR(dev->name, "key not installed, send disconnect\n");
3472
-#ifdef EAPOL_RESEND
3473
- wl_ext_release_eapol_txpkt(dhd, cur_if->ifidx, FALSE);
3474
-#endif /* EAPOL_RESEND */
3475
- wl_ext_update_conn_state(dhd, cur_if->ifidx, CONN_STATE_CONNECTED);
3476
- wl_ext_ioctl(cur_if->dev, WLC_DISASSOC, NULL, 0, 1);
3477
- wl_timer_mod(dhd, &cur_if->key_install_timer, 0);
3478
- cur_if->key_install_cnt = 0;
3479
- } else {
3480
- IAPSTA_INFO(dev->name, "check key installed %dms later, cnt=%d\n",
3481
- STA_KEY_INSTALL_INTERVAL, cur_if->key_install_cnt);
3482
- wl_timer_mod(dhd, &cur_if->key_install_timer, STA_KEY_INSTALL_INTERVAL);
3483
- }
3484
- } else {
3485
-#ifdef EAPOL_RESEND
3486
- wl_ext_release_eapol_txpkt(dhd, cur_if->ifidx, FALSE);
3487
-#endif /* EAPOL_RESEND */
3488
- IAPSTA_INFO(dev->name, "key installed\n");
3489
- wl_timer_mod(dhd, &cur_if->connect_timer, 0);
3490
- wl_ext_update_conn_state(dhd, cur_if->ifidx, CONN_STATE_CONNECTED);
3491
- cur_if->key_install_cnt = 0;
3492
- }
3493
- }
3494
- }
3495
- return;
3496
-}
3497
-
3498
-static int
3499
-wl_key_installed(struct wl_if_info *cur_if)
3500
-{
3501
- struct net_device *dev = cur_if->dev;
3502
- dhd_pub_t *dhd = dhd_get_pub(dev);
3503
- int err, key_installed = 0;
3504
-
3505
- err = wldev_iovar_getint(dev, "buf_key_b4_m4_installed", &key_installed);
3506
- if (err) {
3507
- IAPSTA_INFO(dev->name, "not supported %d\n", err);
3508
- key_installed = 1;
3509
- } else if (key_installed)
3510
- IAPSTA_INFO(dev->name, "key installed\n");
3511
-
3512
- if (key_installed)
3513
- wl_timer_mod(dhd, &cur_if->key_install_timer, 0);
3514
- else {
3515
- IAPSTA_INFO(dev->name, "check key installed %dms later\n", STA_KEY_INSTALL_INTERVAL);
3516
- wl_timer_mod(dhd, &cur_if->key_install_timer, STA_KEY_INSTALL_INTERVAL);
3517
- }
3518
-
3519
- return key_installed;
3520
-}
3521
-#endif /* KEY_INSTALL_CHECK */
3522
-
35233083 #if defined(WL_CFG80211) && defined(SCAN_SUPPRESS)
35243084 static void
35253085 wl_ext_light_scan_prep(struct net_device *dev, void *scan_params, bool scan_v2)
35263086 {
3527
- wl_scan_params_v1_t *params = NULL;
3087
+ wl_scan_params_t *params = NULL;
35283088 wl_scan_params_v2_t *params_v2 = NULL;
35293089
35303090 if (!scan_params) {
....@@ -3536,7 +3096,7 @@
35363096 if (scan_v2) {
35373097 params_v2 = (wl_scan_params_v2_t *)scan_params;
35383098 } else {
3539
- params = (wl_scan_params_v1_t *)scan_params;
3099
+ params = (wl_scan_params_t *)scan_params;
35403100 }
35413101
35423102 if (params_v2) {
....@@ -3570,7 +3130,7 @@
35703130 tmp_if = &apsta_params->if_info[i];
35713131 if (tmp_if->dev && (tmp_if->tput_info.tput_tx + tmp_if->tput_info.tput_rx) > tput_sum) {
35723132 memset(chan_info, 0, sizeof(struct wl_chan_info));
3573
- wl_ext_get_chan(tmp_if->dev, chan_info);
3133
+ wl_ext_get_chan(apsta_params, tmp_if->dev, chan_info);
35743134 if (chan_info->chan) {
35753135 max_tput_if = tmp_if;
35763136 tput_sum = tmp_if->tput_info.tput_tx + tmp_if->tput_info.tput_rx;
....@@ -3709,6 +3269,7 @@
37093269 }
37103270 }
37113271 }
3272
+
37123273 }
37133274
37143275 static void
....@@ -3716,7 +3277,7 @@
37163277 enum wl_ext_status status)
37173278 {
37183279 struct net_device *dev = cur_if->dev;
3719
- struct osl_timespec cur_ts, *sta_disc_ts = &cur_if->sta_disc_ts;
3280
+ struct osl_timespec cur_ts, *sta_disc_ts = &apsta_params->sta_disc_ts;
37203281 int max_wait_time = 200, max_wait_cnt = 20;
37213282 int cur_conn_state = cur_if->conn_state;
37223283 uint32 diff_ms = 0;
....@@ -3766,7 +3327,8 @@
37663327
37673328 if (suspend) {
37683329 if (insuspend & AP_DOWN_IN_SUSPEND) {
3769
- cur_if->chan_info.chan = wl_ext_get_chan(cur_if->dev, &cur_if->chan_info);
3330
+ cur_if->chan_info.chan = wl_ext_get_chan(apsta_params, cur_if->dev,
3331
+ &cur_if->chan_info);
37703332 if (cur_if->chan_info.chan)
37713333 wl_ext_if_down(apsta_params, cur_if);
37723334 }
....@@ -3789,7 +3351,7 @@
37893351
37903352 #ifdef TPUT_MONITOR
37913353 if (suspend)
3792
- wl_timer_mod(dhd, &apsta_params->monitor_timer, 0);
3354
+ wl_ext_mod_timer(&apsta_params->monitor_timer, 0, 0);
37933355 #endif /* TPUT_MONITOR */
37943356
37953357 for (i=0; i<MAX_IF_NUM; i++) {
....@@ -3808,7 +3370,7 @@
38083370
38093371 #ifdef TPUT_MONITOR
38103372 if (!suspend)
3811
- wl_timer_mod(dhd, &apsta_params->monitor_timer, dhd->conf->tput_monitor_ms);
3373
+ wl_ext_mod_timer(&apsta_params->monitor_timer, 0, dhd->conf->tput_monitor_ms);
38123374 #endif /* TPUT_MONITOR */
38133375
38143376 return 0;
....@@ -3821,11 +3383,11 @@
38213383 struct wl_apsta_params *apsta_params = dhd->iapsta_params;
38223384 struct dhd_conf *conf = dhd->conf;
38233385 struct net_device *dev = cur_if->dev;
3824
- struct osl_timespec cur_ts, *sta_disc_ts = &cur_if->sta_disc_ts;
3825
- struct osl_timespec *sta_conn_ts = &cur_if->sta_conn_ts;
3386
+ struct osl_timespec cur_ts, *sta_disc_ts = &apsta_params->sta_disc_ts;
3387
+ struct osl_timespec *sta_conn_ts = &apsta_params->sta_conn_ts;
38263388 uint32 diff_ms = 0;
3827
- int ret = 0, suppressed = 0, wpa_auth = 0, max_wait_time = 0, key_installed = 1;
3828
- uint cur_conn_state, conn_state;
3389
+ int ret = 0, cur_conn_state;
3390
+ int suppressed = 0, wpa_auth = 0;
38293391 bool connecting = FALSE;
38303392 wl_event_msg_t *e = (wl_event_msg_t *)context;
38313393 #ifdef WL_CFG80211
....@@ -3876,8 +3438,7 @@
38763438 osl_do_gettimeofday(&cur_ts);
38773439 diff_ms = osl_do_gettimediff(&cur_ts, sta_conn_ts)/1000;
38783440 if (connecting && diff_ms <= STA_CONNECT_TIMEOUT) {
3879
- IAPSTA_ERROR(dev->name, "scan during connecting... %d\n",
3880
- cur_conn_state);
3441
+ IAPSTA_ERROR(dev->name, "connecting... %d\n", cur_conn_state);
38813442 ret = -EBUSY;
38823443 break;
38833444 }
....@@ -3891,15 +3452,24 @@
38913452 if (wl_get_drv_status(cfg, CONNECTING, dev) ||
38923453 (connecting && diff_ms <= STA_CONNECT_TIMEOUT) ||
38933454 (cur_if->empty_scan >= STA_EMPTY_SCAN_MAX)) {
3455
+ unsigned long flags = 0;
38943456 cur_if->empty_scan = 0;
3895
- WL_MSG(dev->name, "FAKE SCAN\n");
3896
- ret = -EBUSY;
3457
+ spin_lock_irqsave(&dhd->up_lock, flags);
3458
+ if (dhd->up) {
3459
+ wl_event_msg_t msg;
3460
+ bzero(&msg, sizeof(wl_event_msg_t));
3461
+ msg.event_type = hton32(WLC_E_ESCAN_RESULT);
3462
+ msg.status = hton32(WLC_E_STATUS_SUCCESS);
3463
+ WL_MSG(dev->name, "FAKE SCAN\n");
3464
+ wl_cfg80211_event(dev, &msg, NULL);
3465
+ ret = -EBUSY;
3466
+ }
3467
+ spin_unlock_irqrestore(&dhd->up_lock, flags);
38973468 }
38983469 }
38993470 break;
39003471 case WL_EXT_STATUS_SCAN_COMPLETE:
3901
- if ((conf->war & FW_REINIT_EMPTY_SCAN) &&
3902
- cfg->bss_list->count == 0 && !p2p_scan(cfg)) {
3472
+ if ((conf->war & FW_REINIT_EMPTY_SCAN) && cfg->bss_list->count == 0) {
39033473 bool assoc;
39043474 osl_do_gettimeofday(&cur_ts);
39053475 diff_ms = osl_do_gettimediff(&cur_ts, sta_disc_ts)/1000;
....@@ -3924,26 +3494,18 @@
39243494 }
39253495 break;
39263496 #endif /* WL_CFG80211 */
3927
- case WL_EXT_STATUS_PRE_DISCONNECTING:
3497
+ case WL_EXT_STATUS_DISCONNECTING:
39283498 #ifdef EAPOL_RESEND
39293499 wl_ext_release_eapol_txpkt(dhd, cur_if->ifidx, FALSE);
39303500 #endif /* EAPOL_RESEND */
3931
-#ifdef KEY_INSTALL_CHECK
3932
- wl_timer_mod(dhd, &cur_if->key_install_timer, 0);
3933
-#endif /* KEY_INSTALL_CHECK */
3934
- wl_timer_mod(dhd, &cur_if->connect_timer, 0);
3501
+ wl_ext_mod_timer(&cur_if->connect_timer, 0, 0);
39353502 #if defined(WL_EXT_RECONNECT) && defined(WL_CFG80211)
3936
- wl_timer_mod(dhd, &cur_if->reconnect_timer, 0);
3503
+ wl_ext_mod_timer(&cur_if->reconnect_timer, 0, 0);
39373504 memset(&cur_if->assoc_info, 0, sizeof(wlcfg_assoc_info_t));
3938
-#ifdef WL_EXT_DISCONNECT_RECONNECT
3939
- cur_if->sta_disc_recon_cnt = 0;
3940
-#endif /* WL_EXT_DISCONNECT_RECONNECT */
39413505 #endif /* WL_EXT_RECONNECT && WL_CFG80211 */
39423506 #ifdef SCAN_SUPPRESS
39433507 apsta_params->scan_busy_cnt = 0;
39443508 #endif /* SCAN_SUPPRESS */
3945
- break;
3946
- case WL_EXT_STATUS_DISCONNECTING:
39473509 if (connecting) {
39483510 IAPSTA_ERROR(dev->name, "connect failed at %d\n", cur_conn_state);
39493511 wl_ext_update_conn_state(dhd, cur_if->ifidx, CONN_STATE_IDLE);
....@@ -3951,9 +3513,6 @@
39513513 if (action & STA_NO_BTC_IN4WAY) {
39523514 wl_set_btc_in4way(apsta_params, cur_if, status, FALSE);
39533515 }
3954
-#ifdef BTC_WAR
3955
- wl_ext_btc_config(cur_if->dev, FALSE);
3956
-#endif /* BTC_WAR */
39573516 if (action & STA_WAIT_DISCONNECTED) {
39583517 wl_wait_disconnect(apsta_params, cur_if, status);
39593518 wake_up_interruptible(&conf->event_complete);
....@@ -3964,11 +3523,8 @@
39643523 if (action & STA_REASSOC_RETRY) {
39653524 wl_ext_set_connect_retry(dev, context);
39663525 }
3967
-#ifdef WL_EXT_DISCONNECT_RECONNECT
3968
- cur_if->sta_disc_recon_cnt = 0;
3969
-#endif /* WL_EXT_DISCONNECT_RECONNECT */
39703526 #endif /* WL_EXT_RECONNECT && WL_CFG80211 */
3971
- wl_timer_mod(dhd, &cur_if->connect_timer, STA_CONNECT_TIMEOUT);
3527
+ wl_ext_mod_timer(&cur_if->connect_timer, 0, STA_CONNECT_TIMEOUT);
39723528 osl_do_gettimeofday(sta_conn_ts);
39733529 wl_ext_update_conn_state(dhd, cur_if->ifidx, CONN_STATE_CONNECTING);
39743530 if (action & STA_NO_BTC_IN4WAY) {
....@@ -3978,18 +3534,12 @@
39783534 case WL_EXT_STATUS_CONNECTED:
39793535 wl_ext_iovar_getint(dev, "wpa_auth", &wpa_auth);
39803536 if ((wpa_auth < WPA_AUTH_UNSPECIFIED) || (wpa_auth & WPA2_AUTH_FT)) {
3981
- wl_timer_mod(dhd, &cur_if->connect_timer, 0);
3537
+ wl_ext_mod_timer(&cur_if->connect_timer, 0, 0);
39823538 wl_ext_update_conn_state(dhd, cur_if->ifidx, CONN_STATE_CONNECTED);
3983
-#ifdef BTC_WAR
3984
- wl_ext_btc_config(cur_if->dev, TRUE);
3985
-#endif /* BTC_WAR */
3986
- max_wait_time = 0;
3987
- } else {
3988
- max_wait_time = STA_4WAY_TIMEOUT;
39893539 }
39903540 #if defined(WL_EXT_RECONNECT) && defined(WL_CFG80211)
3991
- wl_ext_update_assoc_info(dev, TRUE);
3992
- wl_timer_mod(dhd, &cur_if->reconnect_timer, max_wait_time);
3541
+ wl_ext_mod_timer(&cur_if->reconnect_timer, 0, 0);
3542
+ memset(&cur_if->assoc_info, 0, sizeof(wlcfg_assoc_info_t));
39933543 #endif /* WL_EXT_RECONNECT && WL_CFG80211 */
39943544 if (cur_if->ifmode == ISTA_MODE) {
39953545 dhd_conf_set_wme(dhd, cur_if->ifidx, 0);
....@@ -3997,31 +3547,6 @@
39973547 }
39983548 else if (cur_if->ifmode == IGC_MODE) {
39993549 dhd_conf_set_mchan_bw(dhd, WL_P2P_IF_CLIENT, -1);
4000
- }
4001
- break;
4002
- case WL_EXT_STATUS_ROAMED:
4003
- wl_ext_iovar_getint(dev, "wpa_auth", &wpa_auth);
4004
- if ((wpa_auth >= WPA_AUTH_UNSPECIFIED) && !(wpa_auth & WPA2_AUTH_FT)) {
4005
- wl_timer_mod(dhd, &cur_if->connect_timer, STA_CONNECT_TIMEOUT);
4006
- osl_do_gettimeofday(sta_conn_ts);
4007
- wl_ext_update_conn_state(dhd, cur_if->ifidx, CONN_STATE_CONNECTING);
4008
-#ifdef BTC_WAR
4009
- wl_ext_btc_config(cur_if->dev, TRUE);
4010
-#endif /* BTC_WAR */
4011
- max_wait_time = STA_4WAY_TIMEOUT;
4012
- } else {
4013
- max_wait_time = 0;
4014
- }
4015
-#if defined(WL_EXT_RECONNECT) && defined(WL_CFG80211)
4016
- wl_ext_update_assoc_info(dev, TRUE);
4017
- wl_timer_mod(dhd, &cur_if->reconnect_timer, max_wait_time);
4018
-#endif /* WL_EXT_RECONNECT && WL_CFG80211 */
4019
-#ifdef KEY_INSTALL_CHECK
4020
- wl_timer_mod(dhd, &cur_if->key_install_timer, 0);
4021
-#endif /* KEY_INSTALL_CHECK */
4022
- if (cur_if->ifmode == ISTA_MODE) {
4023
- dhd_conf_set_wme(dhd, cur_if->ifidx, 0);
4024
- wake_up_interruptible(&conf->event_complete);
40253550 }
40263551 break;
40273552 case WL_EXT_STATUS_RECONNECT:
....@@ -4038,15 +3563,9 @@
40383563 #ifdef EAPOL_RESEND
40393564 wl_ext_release_eapol_txpkt(dhd, cur_if->ifidx, FALSE);
40403565 #endif /* EAPOL_RESEND */
4041
-#ifdef KEY_INSTALL_CHECK
4042
- wl_timer_mod(dhd, &cur_if->key_install_timer, 0);
4043
-#endif /* KEY_INSTALL_CHECK */
40443566 #if defined(WL_EXT_RECONNECT) && defined(WL_CFG80211)
4045
- wl_timer_mod(dhd, &cur_if->reconnect_timer, 0);
3567
+ wl_ext_mod_timer(&cur_if->reconnect_timer, 0, 0);
40463568 memset(&cur_if->assoc_info, 0, sizeof(wlcfg_assoc_info_t));
4047
-#ifdef WL_EXT_DISCONNECT_RECONNECT
4048
- cur_if->sta_disc_recon_cnt = 0;
4049
-#endif /* WL_EXT_DISCONNECT_RECONNECT */
40503569 #endif /* WL_EXT_RECONNECT && WL_CFG80211 */
40513570 #ifdef SCAN_SUPPRESS
40523571 apsta_params->scan_busy_cnt = 0;
....@@ -4055,7 +3574,7 @@
40553574 !(ntoh16(e->flags) & WLC_EVENT_MSG_LINK)) {
40563575 apsta_params->linkdown_reason = ntoh32(e->reason);
40573576 }
4058
- wl_timer_mod(dhd, &cur_if->connect_timer, 0);
3577
+ wl_ext_mod_timer(&cur_if->connect_timer, 0, 0);
40593578 if (connecting) {
40603579 IAPSTA_ERROR(dev->name, "connect failed at %d\n", cur_conn_state);
40613580 }
....@@ -4063,37 +3582,23 @@
40633582 if (action & STA_NO_BTC_IN4WAY) {
40643583 wl_set_btc_in4way(apsta_params, cur_if, status, FALSE);
40653584 }
4066
-#ifdef BTC_WAR
4067
- wl_ext_btc_config(cur_if->dev, FALSE);
4068
-#endif /* BTC_WAR */
40693585 osl_do_gettimeofday(sta_disc_ts);
40703586 wake_up_interruptible(&conf->event_complete);
40713587 break;
40723588 case WL_EXT_STATUS_ADD_KEY:
4073
- conn_state = CONN_STATE_ADD_KEY;
4074
- wl_timer_mod(dhd, &cur_if->connect_timer, 0);
4075
-#if defined(WL_EXT_RECONNECT) && defined(WL_CFG80211)
4076
- wl_timer_mod(dhd, &cur_if->reconnect_timer, 0);
4077
-#endif /* WL_EXT_RECONNECT && WL_CFG80211 */
4078
-#ifdef KEY_INSTALL_CHECK
4079
- key_installed = wl_key_installed(cur_if);
4080
-#endif /* KEY_INSTALL_CHECK */
4081
- if (key_installed)
4082
- conn_state = CONN_STATE_CONNECTED;
4083
- wl_ext_update_conn_state(dhd, cur_if->ifidx, conn_state);
4084
- IAPSTA_INFO(dev->name, "WPA 4-WAY complete %d => %d\n",
4085
- cur_conn_state, conn_state);
3589
+ wl_ext_mod_timer(&cur_if->connect_timer, 0, 0);
3590
+ wl_ext_update_conn_state(dhd, cur_if->ifidx, CONN_STATE_CONNECTED);
40863591 #ifdef EAPOL_RESEND
4087
- if (key_installed)
4088
- wl_ext_release_eapol_txpkt(dhd, cur_if->ifidx, FALSE);
3592
+ wl_ext_release_eapol_txpkt(dhd, cur_if->ifidx, FALSE);
40893593 #endif /* EAPOL_RESEND */
3594
+#if defined(WL_EXT_RECONNECT) && defined(WL_CFG80211)
3595
+ wl_ext_mod_timer(&cur_if->reconnect_timer, 0, 0);
3596
+#endif /* WL_EXT_RECONNECT && WL_CFG80211 */
40903597 if (action & STA_NO_BTC_IN4WAY) {
40913598 wl_set_btc_in4way(apsta_params, cur_if, status, FALSE);
40923599 }
4093
-#ifdef BTC_WAR
4094
- wl_ext_btc_config(cur_if->dev, TRUE);
4095
-#endif /* BTC_WAR */
40963600 wake_up_interruptible(&conf->event_complete);
3601
+ IAPSTA_INFO(dev->name, "WPA 4-WAY complete %d\n", cur_conn_state);
40973602 break;
40983603 default:
40993604 IAPSTA_INFO(dev->name, "Unknown action=0x%x, status=%d\n", action, status);
....@@ -4109,8 +3614,8 @@
41093614 {
41103615 struct wl_apsta_params *apsta_params = dhd->iapsta_params;
41113616 struct net_device *dev = cur_if->dev;
4112
- struct osl_timespec cur_ts, *ap_disc_sta_ts = &cur_if->ap_disc_sta_ts;
4113
- u8 *ap_disc_sta_bssid = (u8*)&cur_if->ap_disc_sta_bssid;
3617
+ struct osl_timespec cur_ts, *ap_disc_sta_ts = &apsta_params->ap_disc_sta_ts;
3618
+ u8 *ap_disc_sta_bssid = (u8*)&apsta_params->ap_disc_sta_bssid;
41143619 uint32 diff_ms = 0, timeout, max_wait_time = 300;
41153620 int ret = 0, suppressed = 0;
41163621 u8* mac_addr = context;
....@@ -4131,12 +3636,12 @@
41313636 break;
41323637 case WL_EXT_STATUS_AP_ENABLING:
41333638 #ifdef RESTART_AP_WAR
4134
- wl_timer_mod(dhd, &cur_if->restart_ap_timer, AP_RESTART_TIMEOUT);
3639
+ wl_ext_mod_timer(&cur_if->restart_ap_timer, AP_RESTART_TIMEOUT, 0);
41353640 #endif /* RESTART_AP_WAR */
41363641 break;
41373642 case WL_EXT_STATUS_AP_ENABLED:
41383643 #ifdef RESTART_AP_WAR
4139
- wl_timer_mod(dhd, &cur_if->restart_ap_timer, 0);
3644
+ wl_ext_mod_timer(&cur_if->restart_ap_timer, 0, 0);
41403645 #endif /* RESTART_AP_WAR */
41413646 if (cur_if->ifmode == IAP_MODE)
41423647 dhd_conf_set_wme(dhd, cur_if->ifidx, 1);
....@@ -4145,7 +3650,7 @@
41453650 break;
41463651 case WL_EXT_STATUS_AP_DISABLING:
41473652 #ifdef RESTART_AP_WAR
4148
- wl_timer_mod(dhd, &cur_if->restart_ap_timer, 0);
3653
+ wl_ext_mod_timer(&cur_if->restart_ap_timer, 0, 0);
41493654 #endif /* RESTART_AP_WAR */
41503655 break;
41513656 case WL_EXT_STATUS_DELETE_STA:
....@@ -4163,13 +3668,13 @@
41633668 }
41643669 if (wait) {
41653670 IAPSTA_INFO(dev->name, "status=%d, ap_recon_sta=%d, waiting %dms ...\n",
4166
- status, cur_if->ap_recon_sta, max_wait_time);
3671
+ status, apsta_params->ap_recon_sta, max_wait_time);
41673672 mutex_unlock(&apsta_params->in4way_sync);
4168
- timeout = wait_event_interruptible_timeout(cur_if->ap_recon_sta_event,
4169
- cur_if->ap_recon_sta, msecs_to_jiffies(max_wait_time));
3673
+ timeout = wait_event_interruptible_timeout(apsta_params->ap_recon_sta_event,
3674
+ apsta_params->ap_recon_sta, msecs_to_jiffies(max_wait_time));
41703675 mutex_lock(&apsta_params->in4way_sync);
41713676 IAPSTA_INFO(dev->name, "status=%d, ap_recon_sta=%d, timeout=%d\n",
4172
- status, cur_if->ap_recon_sta, timeout);
3677
+ status, apsta_params->ap_recon_sta, timeout);
41733678 if (timeout > 0) {
41743679 IAPSTA_INFO(dev->name, "skip delete STA %pM\n", mac_addr);
41753680 ret = -1;
....@@ -4177,8 +3682,8 @@
41773682 }
41783683 } else {
41793684 IAPSTA_INFO(dev->name, "status=%d, ap_recon_sta=%d => 0\n",
4180
- status, cur_if->ap_recon_sta);
4181
- cur_if->ap_recon_sta = FALSE;
3685
+ status, apsta_params->ap_recon_sta);
3686
+ apsta_params->ap_recon_sta = FALSE;
41823687 if (cur_if->ifmode == IGO_MODE)
41833688 wl_ext_update_conn_state(dhd, cur_if->ifidx, CONN_STATE_IDLE);
41843689 }
....@@ -4187,10 +3692,10 @@
41873692 case WL_EXT_STATUS_STA_DISCONNECTED:
41883693 if (action & AP_WAIT_STA_RECONNECT) {
41893694 IAPSTA_INFO(dev->name, "latest disc STA %pM ap_recon_sta=%d\n",
4190
- ap_disc_sta_bssid, cur_if->ap_recon_sta);
3695
+ ap_disc_sta_bssid, apsta_params->ap_recon_sta);
41913696 osl_do_gettimeofday(ap_disc_sta_ts);
41923697 memcpy(ap_disc_sta_bssid, mac_addr, ETHER_ADDR_LEN);
4193
- cur_if->ap_recon_sta = FALSE;
3698
+ apsta_params->ap_recon_sta = FALSE;
41943699 }
41953700 break;
41963701 case WL_EXT_STATUS_STA_CONNECTED:
....@@ -4200,11 +3705,11 @@
42003705 if (diff_ms < max_wait_time &&
42013706 !memcmp(ap_disc_sta_bssid, mac_addr, ETHER_ADDR_LEN)) {
42023707 IAPSTA_INFO(dev->name, "status=%d, ap_recon_sta=%d => 1\n",
4203
- status, cur_if->ap_recon_sta);
4204
- cur_if->ap_recon_sta = TRUE;
4205
- wake_up_interruptible(&cur_if->ap_recon_sta_event);
3708
+ status, apsta_params->ap_recon_sta);
3709
+ apsta_params->ap_recon_sta = TRUE;
3710
+ wake_up_interruptible(&apsta_params->ap_recon_sta_event);
42063711 } else {
4207
- cur_if->ap_recon_sta = FALSE;
3712
+ apsta_params->ap_recon_sta = FALSE;
42083713 }
42093714 }
42103715 break;
....@@ -4302,8 +3807,7 @@
43023807 }
43033808 }
43043809 } else {
4305
- IAPSTA_ERROR(dev->name, "Unknown auth_alg=%d or auth_seq=%d\n",
4306
- auth_alg, auth_seq);
3810
+ WL_ERR(("Unknown auth_alg=%d or auth_seq=%d\n", auth_alg, auth_seq));
43073811 }
43083812
43093813 return;
....@@ -4383,150 +3887,6 @@
43833887 return maxassoc;
43843888 }
43853889
4386
-static int
4387
-dev_wlc_ioctl(struct net_device *dev, int cmd, void *arg, int len)
4388
-{
4389
- struct dhd_pub *dhd = dhd_get_pub(dev);
4390
- dhd_ioctl_t ioc;
4391
- int8 index;
4392
- int ret;
4393
-
4394
- memset(&ioc, 0, sizeof(ioc));
4395
- ioc.cmd = cmd;
4396
- ioc.buf = arg;
4397
- ioc.len = len;
4398
-
4399
- index = dhd_net2idx(dhd->info, dev);
4400
- if (index == DHD_BAD_IF) {
4401
- IAPSTA_ERROR(dev->name, "Bad ifidx from dev\n");
4402
- return -ENODEV;
4403
- }
4404
- ret = dhd_ioctl_process(dhd, index, &ioc, arg);
4405
-
4406
- return ret;
4407
-}
4408
-
4409
-static void
4410
-wl_ampdu_dump(struct net_device *dev)
4411
-{
4412
- char *ioctl_buf = g_ioctl_buf, *buf = NULL;
4413
- char *tx_pch_start, *tx_pch_end, *rx_pch_start, *rx_pch_end;
4414
- int ret = 0, max_len, tx_len, rx_len;
4415
-
4416
- if (!(android_msg_level & ANDROID_AMPDU_LEVEL))
4417
- return;
4418
-
4419
- memset(ioctl_buf, 0, WL_DUMP_BUF_LEN);
4420
- ret = bcm_mkiovar("dump", "ampdu", strlen("ampdu"), ioctl_buf, WL_DUMP_BUF_LEN);
4421
- if (ret == 0) {
4422
- goto exit;
4423
- }
4424
- ret = dev_wlc_ioctl(dev, WLC_GET_VAR, (void *)ioctl_buf, WL_DUMP_BUF_LEN);
4425
- if (ret) {
4426
- goto exit;
4427
- }
4428
-
4429
- buf = kmalloc(WLC_IOCTL_MEDLEN, GFP_KERNEL);
4430
- if (buf == NULL) {
4431
- IAPSTA_ERROR(dev->name, "Failed to allocate buffer of %d bytes\n", WLC_IOCTL_MEDLEN);
4432
- goto exit;
4433
- }
4434
- memset(buf, 0, WLC_IOCTL_MEDLEN);
4435
- ret = bcm_mkiovar("dump_clear", "ampdu", strlen("ampdu"), buf, WLC_IOCTL_MEDLEN);
4436
- if (ret == 0) {
4437
- goto exit;
4438
- }
4439
- ret = dev_wlc_ioctl(dev, WLC_SET_VAR, (void *)buf, WLC_IOCTL_MEDLEN);
4440
- if (ret) {
4441
- goto exit;
4442
- }
4443
-
4444
- tx_pch_start = strstr(ioctl_buf, "TX MCS");
4445
- tx_pch_end = strstr(ioctl_buf, "HEMU");
4446
- rx_pch_start = strstr(ioctl_buf, "RX MCS");
4447
- rx_pch_end = strstr(ioctl_buf, "RX MCS SGI");
4448
- max_len = (tx_pch_end-tx_pch_start) + (rx_pch_end-rx_pch_start);
4449
- if (max_len > (WLC_IOCTL_MEDLEN-1))
4450
- goto exit;
4451
-
4452
- tx_len = tx_pch_end - tx_pch_start;
4453
- rx_len = rx_pch_end - rx_pch_start;
4454
-
4455
- memset(buf, 0, WLC_IOCTL_MEDLEN);
4456
- memcpy(buf, tx_pch_start, tx_len);
4457
- memcpy(buf+tx_len, rx_pch_start, rx_len);
4458
- WL_MSG(dev->name,"\n%s\n", buf);
4459
-
4460
-exit:
4461
- if (buf)
4462
- kfree(buf);
4463
-}
4464
-
4465
-static void
4466
-wl_btc_dump(struct net_device *dev)
4467
-{
4468
- struct dhd_pub *dhd = dhd_get_pub(dev);
4469
- int ret, val;
4470
-
4471
- if (!(android_msg_level & ANDROID_BTC_LEVEL))
4472
- return;
4473
-
4474
- ret = dhd_conf_reg2args(dhd, "btc_params", FALSE, 15, &val);
4475
- if (!ret)
4476
- WL_MSG(dev->name,"btc_params15=%d\n", val);
4477
-}
4478
-
4479
-static void
4480
-wl_tvpm_dump(struct net_device *dev)
4481
-{
4482
- wl_tvpm_req_t* tvpm_req = NULL;
4483
- size_t reqlen = sizeof(wl_tvpm_req_t) + sizeof(wl_tvpm_status_t);
4484
- uint8 *outbuf = g_ioctl_buf;
4485
- size_t outlen = WLC_IOCTL_MEDLEN;
4486
- wl_tvpm_status_t* status;
4487
- int ret, phy_temp = 0;
4488
- bool tvpm = FALSE, sense = FALSE;
4489
-
4490
- if (!(android_msg_level & ANDROID_TVPM_LEVEL))
4491
- return;
4492
-
4493
- tvpm_req = kmalloc(reqlen, GFP_KERNEL);
4494
- if (tvpm_req == NULL) {
4495
- IAPSTA_ERROR(dev->name, "MALLOC failed\n");
4496
- goto exit;
4497
- }
4498
- memset(tvpm_req, 0, reqlen);
4499
-
4500
- tvpm_req->version = TVPM_REQ_VERSION_1;
4501
- tvpm_req->length = reqlen;
4502
- tvpm_req->req_type = WL_TVPM_REQ_STATUS;
4503
- ret = wldev_iovar_getbuf(dev, "tvpm", tvpm_req, reqlen, outbuf, outlen, NULL);
4504
- status = (wl_tvpm_status_t*)outbuf;
4505
- if (!ret && status->enable) {
4506
- tvpm = TRUE;
4507
- } else {
4508
- ret = wldev_iovar_getbuf(dev, "phy_tempsense", &phy_temp, sizeof(phy_temp),
4509
- outbuf, outlen, NULL);
4510
- if (!ret) {
4511
- phy_temp = dtoh32(*(int*)outbuf);
4512
- sense = TRUE;
4513
- }
4514
- }
4515
-
4516
- if (tvpm) {
4517
- WL_MSG(dev->name,"temp=%3d, duty=%3d, pwrbko=%d, chains=%d\n",
4518
- status->temp, status->tx_dutycycle, status->tx_power_backoff,
4519
- status->num_active_chains);
4520
- }
4521
- else if (sense) {
4522
- WL_MSG(dev->name,"phy_temp=%3d\n", phy_temp);
4523
- }
4524
-
4525
-exit:
4526
- if (tvpm_req)
4527
- kfree(tvpm_req);
4528
-}
4529
-
45303890 static void
45313891 wl_phy_rssi_ant(struct net_device *dev, struct ether_addr *mac,
45323892 char *rssi_buf, int len)
....@@ -4552,8 +3912,6 @@
45523912 wldev_ioctl(dev, WLC_GET_RSSI, &scb_val, sizeof(scb_val_t), 0);
45533913 rssi_ant_p->count = 1;
45543914 rssi_ant_p->rssi_ant[0] = dtoh32(scb_val.val);
4555
- } else {
4556
- rssi_ant_p->count = 0;
45573915 }
45583916 }
45593917 for (i=0; i<rssi_ant_p->count && rssi_ant_p->rssi_ant[i]; i++) {
....@@ -4579,12 +3937,17 @@
45793937 static void
45803938 wl_sta_info_dump(struct net_device *dev, struct ether_addr *mac)
45813939 {
4582
- void *buf = g_ioctl_buf;
3940
+ void *buf = NULL;
45833941 sta_info_v4_t *sta = NULL;
45843942 char rssi_buf[16];
45853943 int ret;
45863944 s32 rate = 0;
45873945
3946
+ buf = kmalloc(WLC_IOCTL_MEDLEN, GFP_KERNEL);
3947
+ if (buf == NULL) {
3948
+ IAPSTA_ERROR(dev->name, "MALLOC failed\n");
3949
+ goto exit;
3950
+ }
45883951 memset(rssi_buf, 0, sizeof(rssi_buf));
45893952 wl_phy_rssi_ant(dev, mac, rssi_buf, sizeof(rssi_buf));
45903953 ret = wldev_iovar_getbuf(dev, "sta_info", (const void*)mac,
....@@ -4592,27 +3955,22 @@
45923955 if (ret == 0) {
45933956 sta = (sta_info_v4_t *)buf;
45943957 }
4595
- if (sta == NULL || (sta->ver != WL_STA_VER_4 && sta->ver != WL_STA_VER_5 &&
4596
- sta->ver != WL_STA_VER_6)) {
3958
+ if (sta == NULL || (sta->ver != WL_STA_VER_4 && sta->ver != WL_STA_VER_5)) {
45973959 wldev_ioctl_get(dev, WLC_GET_RATE, &rate, sizeof(rate));
45983960 rate = dtoh32(rate);
45993961 WL_MSG(dev->name,
46003962 "mac=%pM, rssi=%s, tx_rate:%4d%2s\n",
46013963 mac, rssi_buf, rate/2, (rate & 1) ? ".5" : "");
46023964 } else {
4603
- if (dtoh32(sta->rx_rate) != -1) {
4604
- WL_MSG(dev->name,
4605
- "mac=%pM, rssi=%s, tx_rate:%4d.%d, rx_rate:%4d.%d\n",
4606
- mac, rssi_buf,
4607
- dtoh32(sta->tx_rate)/1000, ((dtoh32(sta->tx_rate)/100)%10),
4608
- dtoh32(sta->rx_rate)/1000, ((dtoh32(sta->rx_rate)/100)%10));
4609
- } else {
4610
- WL_MSG(dev->name,
4611
- "mac=%pM, rssi=%s, tx_rate:%4d.%d, rx_rate:%4d\n",
4612
- mac, rssi_buf,
4613
- dtoh32(sta->tx_rate)/1000, ((dtoh32(sta->tx_rate)/100)%10),
4614
- dtoh32(sta->rx_rate));
4615
- }
3965
+ WL_MSG(dev->name,
3966
+ "mac=%pM, rssi=%s, tx_rate:%4d.%d, rx_rate:%4d.%d\n", mac, rssi_buf,
3967
+ dtoh32(sta->tx_rate)/1000, ((dtoh32(sta->tx_rate)/100)%10),
3968
+ dtoh32(sta->rx_rate)/1000, ((dtoh32(sta->rx_rate)/100)%10));
3969
+ }
3970
+
3971
+exit:
3972
+ if (buf) {
3973
+ kfree(buf);
46163974 }
46173975 }
46183976
....@@ -4705,11 +4063,10 @@
47054063 }
47064064
47074065 static void
4708
-wl_tput_monitor_handler(struct wl_if_info *cur_if,
4709
- const wl_event_msg_t *e, void *data)
4066
+wl_tput_monitor_handler(struct wl_apsta_params *apsta_params,
4067
+ struct wl_if_info *cur_if, const wl_event_msg_t *e, void *data)
47104068 {
4711
- struct dhd_pub *dhd = dhd_get_pub(cur_if->dev);
4712
- struct wl_apsta_params *apsta_params = dhd->iapsta_params;
4069
+ struct dhd_pub *dhd = apsta_params->dhd;
47134070 wl_tput_info_t *tput_info;
47144071 struct wl_if_info *tmp_if;
47154072 #ifdef WLDWDS
....@@ -4730,7 +4087,7 @@
47304087 tmp_if = &apsta_params->if_info[i];
47314088 if (tmp_if->dev &&
47324089 (tmp_if->ifmode == ISTA_MODE || tmp_if->ifmode == IGC_MODE) &&
4733
- wl_get_isam_status(tmp_if, STA_CONNECTED)) {
4090
+ wl_ext_associated(tmp_if->dev)) {
47344091 wl_tput_monitor(dhd, tmp_if->ifidx, &tmp_if->tput_info);
47354092 monitor_if[i] = TRUE;
47364093 }
....@@ -4766,12 +4123,8 @@
47664123 monitor = TRUE;
47674124 }
47684125 }
4769
- if (monitor) {
4770
- wl_btc_dump(cur_if->dev);
4771
- wl_tvpm_dump(cur_if->dev);
4772
- wl_ampdu_dump(cur_if->dev);
4773
- wl_timer_mod(dhd, &apsta_params->monitor_timer, timeout);
4774
- }
4126
+ if (monitor)
4127
+ wl_ext_mod_timer(&apsta_params->monitor_timer, 0, timeout);
47754128 #ifdef BCMSDIO
47764129 if (apsta_params->tput_sum >= dhd->conf->doflow_tput_thresh && dhd_doflow) {
47774130 dhd_doflow = FALSE;
....@@ -4787,9 +4140,9 @@
47874140 else if (cur_if->ifmode == ISTA_MODE || cur_if->ifmode == IGC_MODE) {
47884141 if (etype == WLC_E_LINK) {
47894142 if (flags & WLC_EVENT_MSG_LINK) {
4790
- wl_timer_mod(dhd, &apsta_params->monitor_timer, timeout);
4143
+ wl_ext_mod_timer(&apsta_params->monitor_timer, 0, timeout);
47914144 } else if (!wl_ext_iapsta_other_if_enabled(cur_if->dev)) {
4792
- wl_timer_mod(dhd, &apsta_params->monitor_timer, 0);
4145
+ wl_ext_mod_timer(&apsta_params->monitor_timer, 0, 0);
47934146 }
47944147 }
47954148 }
....@@ -4797,22 +4150,33 @@
47974150 if ((etype == WLC_E_SET_SSID && status == WLC_E_STATUS_SUCCESS) ||
47984151 (etype == WLC_E_LINK && status == WLC_E_STATUS_SUCCESS &&
47994152 reason == WLC_E_REASON_INITIAL_ASSOC)) {
4800
- wl_timer_mod(dhd, &apsta_params->monitor_timer, timeout);
4153
+ wl_ext_mod_timer(&apsta_params->monitor_timer, 0, timeout);
48014154 } else if ((etype == WLC_E_LINK && reason == WLC_E_LINK_BSSCFG_DIS) ||
48024155 (etype == WLC_E_LINK && status == WLC_E_STATUS_SUCCESS &&
48034156 reason == WLC_E_REASON_DEAUTH)) {
48044157 if (!wl_ext_iapsta_other_if_enabled(cur_if->dev)) {
4805
- wl_timer_mod(dhd, &apsta_params->monitor_timer, 0);
4158
+ wl_ext_mod_timer(&apsta_params->monitor_timer, 0, 0);
48064159 }
48074160 } else if ((etype == WLC_E_ASSOC_IND || etype == WLC_E_REASSOC_IND) &&
48084161 reason == DOT11_SC_SUCCESS) {
4809
- wl_timer_mod(dhd, &apsta_params->monitor_timer, timeout);
4162
+ wl_ext_mod_timer(&apsta_params->monitor_timer, 0, timeout);
48104163 }
48114164 }
48124165 }
48134166 #endif /* TPUT_MONITOR */
48144167
48154168 #ifdef ACS_MONITOR
4169
+static void
4170
+wl_ext_mod_timer_pending(timer_list_compat_t *timer, uint sec, uint msec)
4171
+{
4172
+ uint timeout = sec * 1000 + msec;
4173
+
4174
+ if (timeout && !timer_pending(timer)) {
4175
+ IAPSTA_TRACE("wlan", "timeout=%d\n", timeout);
4176
+ mod_timer(timer, jiffies + msecs_to_jiffies(timeout));
4177
+ }
4178
+}
4179
+
48164180 static bool
48174181 wl_ext_max_prio_if(struct wl_apsta_params *apsta_params,
48184182 struct wl_if_info *cur_if)
....@@ -4867,7 +4231,7 @@
48674231 if (apsta_params->acs & ACS_DRV_BIT) {
48684232 mutex_lock(&apsta_params->usr_sync);
48694233 memset(&chan_info, 0, sizeof(struct wl_chan_info));
4870
- wl_ext_get_chan(cur_if->dev, &chan_info);
4234
+ wl_ext_get_chan(apsta_params, cur_if->dev, &chan_info);
48714235 if (chan_info.chan) {
48724236 if (chan_info.band == WLC_BAND_5G)
48734237 cur_if->chan_info.chan = cur_if->escan->best_5g_ch;
....@@ -4876,7 +4240,7 @@
48764240 wl_ext_move_cur_channel(apsta_params, cur_if);
48774241 if (!wl_ext_same_chan(&cur_if->chan_info, &chan_info)) {
48784242 WL_MSG(cur_if->dev->name, "move channel %s-%d => %s-%d\n",
4879
- WLCBAND2STR(chan_info.band), chan_info.chan,
4243
+ WLCBAND2STR(chan_info->band), chan_info.chan,
48804244 WLCBAND2STR(cur_if->chan_info.band), cur_if->chan_info.chan);
48814245 wl_ext_if_down(apsta_params, cur_if);
48824246 wl_ext_move_other_channel(apsta_params, cur_if);
....@@ -4925,34 +4289,34 @@
49254289 (etype == WLC_E_LINK && status == WLC_E_STATUS_SUCCESS &&
49264290 reason == WLC_E_REASON_INITIAL_ASSOC)) {
49274291 // Link up
4928
- wl_timer_mod(dhd, &cur_if->acs_timer, acs_tmo*1000);
4292
+ wl_ext_mod_timer_pending(&cur_if->acs_timer, acs_tmo, 0);
49294293 }
49304294 else if ((etype == WLC_E_LINK && reason == WLC_E_LINK_BSSCFG_DIS) ||
49314295 (etype == WLC_E_LINK && status == WLC_E_STATUS_SUCCESS &&
49324296 reason == WLC_E_REASON_DEAUTH)) {
49334297 // Link down
4934
- wl_timer_mod(dhd, &cur_if->acs_timer, 0);
4298
+ wl_ext_mod_timer(&cur_if->acs_timer, 0, 0);
49354299 cur_if->escan->autochannel = 0;
49364300 }
49374301 else if ((etype == WLC_E_ASSOC_IND || etype == WLC_E_REASSOC_IND) &&
49384302 reason == DOT11_SC_SUCCESS) {
49394303 // external STA connected
4940
- wl_timer_mod(dhd, &cur_if->acs_timer, 0);
4304
+ wl_ext_mod_timer(&cur_if->acs_timer, 0, 0);
49414305 }
49424306 else if (etype == WLC_E_DISASSOC_IND ||
49434307 etype == WLC_E_DEAUTH_IND ||
49444308 (etype == WLC_E_DEAUTH && reason != DOT11_RC_RESERVED)) {
49454309 // external STA disconnected
4946
- wl_timer_mod(dhd, &cur_if->acs_timer, acs_tmo*1000);
4310
+ wl_ext_mod_timer_pending(&cur_if->acs_timer, acs_tmo, 0);
49474311 }
49484312 else if (etype == WLC_E_RESERVED && reason == ISAM_RC_AP_ACS) {
49494313 // acs_tmo expired
49504314 if (!wl_ext_assoclist_num(cur_if->dev) &&
49514315 !wl_ext_max_prio_if(apsta_params, cur_if)) {
49524316 wl_ext_acs_scan(apsta_params, cur_if);
4953
- wl_timer_mod(dhd, &cur_if->acs_timer, acs_tmo*1000);
4317
+ wl_ext_mod_timer(&cur_if->acs_timer, acs_tmo, 0);
49544318 } else {
4955
- wl_timer_mod(dhd, &cur_if->acs_timer, 0);
4319
+ wl_ext_mod_timer(&cur_if->acs_timer, 0, 0);
49564320 }
49574321 }
49584322 else if (((etype == WLC_E_ESCAN_RESULT && status == WLC_E_STATUS_SUCCESS) ||
....@@ -4966,7 +4330,7 @@
49664330 !wl_ext_max_prio_if(apsta_params, cur_if)) {
49674331 wl_ext_acs(apsta_params, cur_if);
49684332 } else {
4969
- wl_timer_mod(dhd, &cur_if->acs_timer, 0);
4333
+ wl_ext_mod_timer(&cur_if->acs_timer, 0, 0);
49704334 }
49714335 }
49724336 }
....@@ -4976,7 +4340,7 @@
49764340 wl_acs_detach(struct wl_if_info *cur_if)
49774341 {
49784342 IAPSTA_TRACE(cur_if->dev->name, "Enter\n");
4979
- wl_timer_deregister(cur_if->dev, &cur_if->acs_timer);
4343
+ del_timer_sync(&cur_if->acs_timer);
49804344 if (cur_if->escan) {
49814345 cur_if->escan = NULL;
49824346 }
....@@ -4987,7 +4351,7 @@
49874351 {
49884352 IAPSTA_TRACE(cur_if->dev->name, "Enter\n");
49894353 cur_if->escan = dhd->escan;
4990
- wl_timer_register(cur_if->dev, &cur_if->acs_timer, wl_acs_timer);
4354
+ init_timer_compat(&cur_if->acs_timer, wl_acs_timer, cur_if->dev);
49914355 }
49924356 #endif /* ACS_MONITOR */
49934357
....@@ -5030,7 +4394,7 @@
50304394 WL_MSG(cur_if->ifname, "restart AP\n");
50314395 wl_ext_if_down(apsta_params, cur_if);
50324396 wl_ext_if_up(apsta_params, cur_if, FALSE, 1);
5033
- wl_timer_mod(dhd, &cur_if->restart_ap_timer, AP_RESTART_TIMEOUT);
4397
+ wl_ext_mod_timer(&cur_if->restart_ap_timer, AP_RESTART_TIMEOUT, 0);
50344398 } else {
50354399 WL_MSG(cur_if->ifname, "skip restart AP\n");
50364400 }
....@@ -5119,12 +4483,20 @@
51194483 {
51204484 struct dhd_pub *dhd = dhd_get_pub(cur_if->dev);
51214485 struct wl_apsta_params *apsta_params = dhd->iapsta_params;
5122
- char *iovar_buf = g_ioctl_buf;
4486
+ char *iovar_buf = NULL;
51234487 uint32 corerev = 0;
51244488 wl_cnt_info_t *cntinfo;
51254489 uint16 ver;
51264490 int ret = 0;
51274491
4492
+ iovar_buf = kmalloc(WLC_IOCTL_MEDLEN, GFP_KERNEL);
4493
+ if (!iovar_buf) {
4494
+ IAPSTA_ERROR(cur_if->ifname, "no memory\n");
4495
+ ret = BCME_NOMEM;
4496
+ goto exit;
4497
+ }
4498
+
4499
+ memset(iovar_buf, 0, WLC_IOCTL_MEDLEN);
51284500 ret = wldev_iovar_getbuf(cur_if->dev, "counters", NULL, 0,
51294501 iovar_buf, WLC_IOCTL_MEDLEN, NULL);
51304502 if (unlikely(ret)) {
....@@ -5137,10 +4509,10 @@
51374509 cntinfo->datalen = dtoh16(cntinfo->datalen);
51384510 ver = cntinfo->version;
51394511 CHK_CNTBUF_DATALEN(iovar_buf, WLC_IOCTL_MEDLEN);
5140
- if (ver > WL_CNT_VERSION_XTLV) {
4512
+ if (ver > WL_CNT_T_VERSION) {
51414513 IAPSTA_ERROR(cur_if->ifname,
51424514 "Incorrect version of counters struct: expected %d; got %d\n",
5143
- WL_CNT_VERSION_XTLV, ver);
4515
+ WL_CNT_T_VERSION, ver);
51444516 goto exit;
51454517 }
51464518
....@@ -5168,6 +4540,9 @@
51684540 }
51694541
51704542 exit:
4543
+ if (iovar_buf)
4544
+ kfree(iovar_buf);
4545
+
51714546 return ret;
51724547 }
51734548 #endif /* RESET_AP_WAR | RXF0OVFL_REINIT_WAR */
....@@ -5214,7 +4589,7 @@
52144589 reason == WLC_E_REASON_INITIAL_ASSOC)) {
52154590 // Link up
52164591 wl_ext_counters_update(cur_if, ISAM_RC_AP_RESET);
5217
- wl_timer_mod(dhd, &cur_if->reset_ap_timer, AP_TXBCNFRM_TIMEOUT);
4592
+ wl_ext_mod_timer(&cur_if->reset_ap_timer, AP_TXBCNFRM_TIMEOUT, 0);
52184593 }
52194594 else if (etype == WLC_E_RESERVED && reason == ISAM_RC_AP_RESET) {
52204595 txbcnfrm = cur_if->txbcnfrm;
....@@ -5227,7 +4602,7 @@
52274602 wl_ext_if_up(apsta_params, cur_if, FALSE, 500);
52284603 }
52294604 done:
5230
- wl_timer_mod(dhd, &cur_if->reset_ap_timer, AP_TXBCNFRM_TIMEOUT);
4605
+ wl_ext_mod_timer(&cur_if->reset_ap_timer, AP_TXBCNFRM_TIMEOUT, 0);
52314606 }
52324607 }
52334608 return;
....@@ -5275,7 +4650,7 @@
52754650 (etype == WLC_E_LINK) && (flags & WLC_EVENT_MSG_LINK)) {
52764651 // Link up
52774652 wl_ext_counters_update(cur_if, ISAM_RC_RXF0OVFL_REINIT);
5278
- wl_timer_mod(dhd, &apsta_params->rxf0ovfl_timer, RXF0OVFL_POLLING_TIMEOUT);
4653
+ wl_ext_mod_timer(&apsta_params->rxf0ovfl_timer, RXF0OVFL_POLLING_TIMEOUT, 0);
52794654 }
52804655 else if ((cur_if->ifmode == IAP_MODE) &&
52814656 ((etype == WLC_E_SET_SSID && status == WLC_E_STATUS_SUCCESS) ||
....@@ -5283,7 +4658,7 @@
52834658 reason == WLC_E_REASON_INITIAL_ASSOC))) {
52844659 // Link up
52854660 wl_ext_counters_update(cur_if, ISAM_RC_RXF0OVFL_REINIT);
5286
- wl_timer_mod(dhd, &apsta_params->rxf0ovfl_timer, RXF0OVFL_POLLING_TIMEOUT);
4661
+ wl_ext_mod_timer(&apsta_params->rxf0ovfl_timer, RXF0OVFL_POLLING_TIMEOUT, 0);
52874662 }
52884663 else if ((etype == WLC_E_RESERVED) && (reason == ISAM_RC_RXF0OVFL_REINIT) &&
52894664 (wl_ext_iapsta_other_if_enabled(cur_if->dev))) {
....@@ -5312,7 +4687,7 @@
53124687 wl_ext_ioctl(cur_if->dev, WLC_INIT, NULL, 0, 1);
53134688 }
53144689 done:
5315
- wl_timer_mod(dhd, &apsta_params->rxf0ovfl_timer, RXF0OVFL_POLLING_TIMEOUT);
4690
+ wl_ext_mod_timer(&apsta_params->rxf0ovfl_timer, RXF0OVFL_POLLING_TIMEOUT, 0);
53164691 }
53174692
53184693 return;
....@@ -5320,15 +4695,36 @@
53204695 #endif /* RXF0OVFL_REINIT_WAR */
53214696
53224697 void
5323
-wl_ext_iapsta_link(struct wl_if_info *cur_if,
4698
+wl_ext_iapsta_event(struct net_device *dev, void *argu,
53244699 const wl_event_msg_t *e, void *data)
53254700 {
5326
- struct dhd_pub *dhd = dhd_get_pub(cur_if->dev);
5327
- struct wl_apsta_params *apsta_params = dhd->iapsta_params;
4701
+ struct wl_apsta_params *apsta_params = (struct wl_apsta_params *)argu;
4702
+ struct wl_if_info *cur_if = NULL;
4703
+#if defined(WLMESH) && defined(WL_ESCAN)
4704
+ struct wl_if_info *tmp_if = NULL;
4705
+ struct wl_if_info *mesh_if = NULL;
4706
+ int i;
4707
+#endif /* WLMESH && WL_ESCAN */
53284708 uint32 event_type = ntoh32(e->event_type);
53294709 uint32 status = ntoh32(e->status);
53304710 uint32 reason = ntoh32(e->reason);
53314711 uint16 flags = ntoh16(e->flags);
4712
+
4713
+ cur_if = wl_get_cur_if(dev);
4714
+
4715
+#if defined(WLMESH) && defined(WL_ESCAN)
4716
+ for (i=0; i<MAX_IF_NUM; i++) {
4717
+ tmp_if = &apsta_params->if_info[i];
4718
+ if (tmp_if->dev && tmp_if->ifmode == IMESH_MODE) {
4719
+ mesh_if = tmp_if;
4720
+ break;
4721
+ }
4722
+ }
4723
+#endif /* WLMESH && WL_ESCAN */
4724
+ if (!cur_if || !cur_if->dev) {
4725
+ IAPSTA_DBG(dev->name, "ifidx %d is not ready\n", e->ifidx);
4726
+ return;
4727
+ }
53324728
53334729 if (cur_if->ifmode == ISTA_MODE || cur_if->ifmode == IGC_MODE) {
53344730 if (event_type == WLC_E_LINK) {
....@@ -5341,6 +4737,10 @@
53414737 wl_ext_net_setcarrier(cur_if, FALSE, FALSE);
53424738 #endif /* SET_CARRIER */
53434739 wl_clr_isam_status(cur_if, STA_CONNECTED);
4740
+#if defined(WLMESH) && defined(WL_ESCAN)
4741
+ if (mesh_if && apsta_params->macs)
4742
+ wl_mesh_clear_mesh_info(apsta_params, mesh_if, TRUE);
4743
+#endif /* WLMESH && WL_ESCAN */
53444744 } else {
53454745 WL_MSG(cur_if->ifname, "[%c] Link UP with %pM\n",
53464746 cur_if->prefix, &e->addr);
....@@ -5348,11 +4748,15 @@
53484748 wl_ext_net_setcarrier(cur_if, TRUE, FALSE);
53494749 #endif /* SET_CARRIER */
53504750 wl_set_isam_status(cur_if, STA_CONNECTED);
4751
+#if defined(WLMESH) && defined(WL_ESCAN)
4752
+ if (mesh_if && apsta_params->macs)
4753
+ wl_mesh_update_master_info(apsta_params, mesh_if);
4754
+#endif /* WLMESH && WL_ESCAN */
53514755 }
53524756 wl_clr_isam_status(cur_if, STA_CONNECTING);
53534757 wake_up_interruptible(&apsta_params->netif_change_event);
53544758 #ifdef PROPTX_MAXCOUNT
5355
- wl_ext_update_wlfc_maxcount(dhd);
4759
+ wl_ext_update_wlfc_maxcount(apsta_params->dhd);
53564760 #endif /* PROPTX_MAXCOUNT */
53574761 }
53584762 else if (event_type == WLC_E_SET_SSID && status != WLC_E_STATUS_SUCCESS) {
....@@ -5361,8 +4765,12 @@
53614765 event_type, reason, status);
53624766 wl_clr_isam_status(cur_if, STA_CONNECTING);
53634767 wake_up_interruptible(&apsta_params->netif_change_event);
4768
+#if defined(WLMESH) && defined(WL_ESCAN)
4769
+ if (mesh_if && apsta_params->macs)
4770
+ wl_mesh_clear_mesh_info(apsta_params, mesh_if, TRUE);
4771
+#endif /* WLMESH && WL_ESCAN */
53644772 #ifdef PROPTX_MAXCOUNT
5365
- wl_ext_update_wlfc_maxcount(dhd);
4773
+ wl_ext_update_wlfc_maxcount(apsta_params->dhd);
53664774 #endif /* PROPTX_MAXCOUNT */
53674775 }
53684776 else if (event_type == WLC_E_DEAUTH || event_type == WLC_E_DEAUTH_IND ||
....@@ -5373,6 +4781,10 @@
53734781 #ifdef SET_CARRIER
53744782 wl_ext_net_setcarrier(cur_if, FALSE, FALSE);
53754783 #endif /* SET_CARRIER */
4784
+#if defined(WLMESH) && defined(WL_ESCAN)
4785
+ if (mesh_if && apsta_params->macs)
4786
+ wl_mesh_clear_mesh_info(apsta_params, mesh_if, TRUE);
4787
+#endif /* WLMESH && WL_ESCAN */
53764788 }
53774789 }
53784790 else if (cur_if->ifmode == IAP_MODE || cur_if->ifmode == IGO_MODE ||
....@@ -5394,7 +4806,7 @@
53944806 wl_ext_net_setcarrier(cur_if, TRUE, FALSE);
53954807 #endif /* SET_CARRIER */
53964808 #ifdef PROPTX_MAXCOUNT
5397
- wl_ext_update_wlfc_maxcount(dhd);
4809
+ wl_ext_update_wlfc_maxcount(apsta_params->dhd);
53984810 #endif /* PROPTX_MAXCOUNT */
53994811 }
54004812 else if ((event_type == WLC_E_LINK && reason == WLC_E_LINK_BSSCFG_DIS) ||
....@@ -5407,7 +4819,7 @@
54074819 wl_ext_net_setcarrier(cur_if, FALSE, FALSE);
54084820 #endif /* SET_CARRIER */
54094821 #ifdef PROPTX_MAXCOUNT
5410
- wl_ext_update_wlfc_maxcount(dhd);
4822
+ wl_ext_update_wlfc_maxcount(apsta_params->dhd);
54114823 #endif /* PROPTX_MAXCOUNT */
54124824 }
54134825 else if ((event_type == WLC_E_ASSOC_IND || event_type == WLC_E_REASSOC_IND) &&
....@@ -5425,34 +4837,17 @@
54254837 event_type, reason);
54264838 wl_ext_isam_status(cur_if->dev, NULL, 0);
54274839 }
5428
- }
5429
-}
5430
-
5431
-void
5432
-wl_ext_iapsta_event(struct net_device *dev, void *argu,
5433
- const wl_event_msg_t *e, void *data)
5434
-{
5435
-#ifdef ACS_MONITOR
5436
- struct wl_apsta_params *apsta_params = (struct wl_apsta_params *)argu;
5437
-#endif /* ACS_MONITOR */
5438
- struct dhd_pub *dhd = dhd_get_pub(dev);
5439
- struct wl_if_info *cur_if = NULL;
5440
-
5441
- cur_if = wl_get_cur_if(dev);
5442
- if (!cur_if || !cur_if->dev) {
5443
- IAPSTA_DBG(dev->name, "ifidx %d is not ready\n", e->ifidx);
5444
- return;
4840
+#if defined(WLMESH) && defined(WL_ESCAN)
4841
+ if (cur_if->ifmode == IMESH_MODE && apsta_params->macs)
4842
+ wl_mesh_event_handler(apsta_params, cur_if, e, data);
4843
+#endif /* WLMESH && WL_ESCAN */
54454844 }
54464845
5447
- wl_ext_iapsta_link(cur_if, e, data);
54484846 #ifdef TPUT_MONITOR
5449
- if (dhd->conf->tput_monitor_ms)
5450
- wl_tput_monitor_handler(cur_if, e, data);
4847
+ if (apsta_params->dhd->conf->tput_monitor_ms)
4848
+ wl_tput_monitor_handler(apsta_params, cur_if, e, data);
54514849 #endif /* TPUT_MONITOR */
54524850
5453
-#if defined(WLMESH) && defined(WL_ESCAN)
5454
- wl_mesh_event_handler(cur_if, e, data);
5455
-#endif /* WLMESH && WL_ESCAN */
54564851 #ifdef ACS_MONITOR
54574852 if ((apsta_params->acs & ACS_DRV_BIT) && apsta_params->acs_tmo)
54584853 wl_acs_handler(cur_if, e, data);
....@@ -5460,9 +4855,6 @@
54604855 #ifdef EAPOL_RESEND
54614856 wl_resend_eapol_handler(cur_if, e, data);
54624857 #endif /* EAPOL_RESEND */
5463
-#ifdef KEY_INSTALL_CHECK
5464
- wl_ext_key_install_handler(cur_if, e, data);
5465
-#endif /* KEY_INSTALL_CHECK */
54664858 #ifdef RESTART_AP_WAR
54674859 wl_ext_restart_ap_handler(cur_if, e, data);
54684860 #endif /* RESTART_AP_WAR */
....@@ -5714,6 +5106,10 @@
57145106 cur_if->vsdb = FALSE;
57155107 cur_if->prefix = 'M';
57165108 snprintf(cur_if->ssid, DOT11_MAX_SSID_LEN, "ttt_mesh");
5109
+#ifdef WL_ESCAN
5110
+ if (i == 0 && apsta_params->macs)
5111
+ wl_mesh_escan_attach(dhd, cur_if);
5112
+#endif /* WL_ESCAN */
57175113 #endif /* WLMESH */
57185114 }
57195115 }
....@@ -5821,6 +5217,7 @@
58215217 }
58225218 #endif /* WLMESH */
58235219
5220
+ wl_ext_get_ioctl_ver(dev, &apsta_params->ioctl_ver);
58245221 apsta_params->init = TRUE;
58255222
58265223 WL_MSG(dev->name, "apstamode=%d\n", apstamode);
....@@ -5978,7 +5375,6 @@
59785375 (chan_5g && cur_if->chan_info.band == WLC_BAND_5G)) {
59795376 cur_if->chan_info.chan = wl_ext_autochannel(cur_if->dev, apsta_params->acs,
59805377 cur_if->chan_info.band);
5981
- cur_if->chan_info.chan = wf_chspec_ctlchan(cur_if->chan_info.chan);
59825378 } else {
59835379 IAPSTA_ERROR(ifname, "invalid channel\n");
59845380 ret = -1;
....@@ -5995,7 +5391,7 @@
59955391 }
59965392
59975393 memset(&chan_info, 0, sizeof(struct wl_chan_info));
5998
- wl_ext_get_chan(cur_if->dev, &chan_info);
5394
+ wl_ext_get_chan(apsta_params, cur_if->dev, &chan_info);
59995395 if (chan_info.chan) {
60005396 IAPSTA_INFO(cur_if->ifname, "Associated\n");
60015397 if (!wl_ext_same_chan(&cur_if->chan_info, &chan_info)) {
....@@ -6040,7 +5436,7 @@
60405436 }
60415437
60425438 wl_ext_set_amode(cur_if);
6043
- wl_ext_set_emode(cur_if);
5439
+ wl_ext_set_emode(apsta_params, cur_if);
60445440
60455441 if (cur_if->ifmode == ISTA_MODE) {
60465442 conn_info.bssidx = cur_if->bssidx;
....@@ -6171,6 +5567,8 @@
61715567 wl_ext_isam_dev_status(struct net_device *dev, ifmode_t ifmode, char prefix,
61725568 char *dump_buf, int dump_len)
61735569 {
5570
+ struct dhd_pub *dhd = dhd_get_pub(dev);
5571
+ struct wl_apsta_params *apsta_params = dhd->iapsta_params;
61745572 struct wl_chan_info chan_info;
61755573 wlc_ssid_t ssid = { 0, {0} };
61765574 struct ether_addr bssid;
....@@ -6187,8 +5585,9 @@
61875585 if (wl_ext_associated(dev)) {
61885586 wl_ext_ioctl(dev, WLC_GET_SSID, &ssid, sizeof(ssid), 0);
61895587 wldev_ioctl(dev, WLC_GET_BSSID, &bssid, sizeof(bssid), 0);
6190
- wldev_ioctl(dev, WLC_GET_RSSI, &scb_val, sizeof(scb_val_t), 0);
6191
- chanspec = wl_ext_get_chanspec(dev, &chan_info);
5588
+ wldev_ioctl(dev, WLC_GET_RSSI, &scb_val,
5589
+ sizeof(scb_val_t), 0);
5590
+ chanspec = wl_ext_get_chanspec(apsta_params, dev, &chan_info);
61925591 wl_ext_get_sec(dev, ifmode, sec, sizeof(sec), FALSE);
61935592 dump_written += snprintf(dump_buf+dump_written, dump_len,
61945593 "\n" DHD_LOG_PREFIXS "[%s-%c]: bssid=%pM, chan=%s-%-3d(0x%x %sMHz), "
....@@ -6309,7 +5708,7 @@
63095708 if (apsta_params->acs_tmo != acs_tmo) {
63105709 apsta_params->acs_tmo = acs_tmo;
63115710 WL_MSG(dev->name, "acs_timer reset to %d\n", acs_tmo);
6312
- wl_timer_mod(dhd, &cur_if->acs_timer, 0);
5711
+ wl_ext_mod_timer(&cur_if->acs_timer, acs_tmo, 0);
63135712 }
63145713 ret = 0;
63155714 } else {
....@@ -6626,6 +6025,7 @@
66266025 }
66276026 // fix me: how to check it's ISTAAP_MODE or IDUALAP_MODE?
66286027
6028
+ wl_ext_get_ioctl_ver(dev, &apsta_params->ioctl_ver);
66296029 WL_MSG(dev->name, "apstamode=%d\n", apsta_params->apstamode);
66306030
66316031 for (i=0; i<MAX_IF_NUM; i++) {
....@@ -6696,28 +6096,6 @@
66966096 }
66976097
66986098 static void
6699
-wl_ext_iapsta_get_mapsta_mode(struct net_device *net)
6700
-{
6701
- struct dhd_pub *dhd = dhd_get_pub(net);
6702
- struct wl_apsta_params *apsta_params = dhd->iapsta_params;
6703
- int ret, mapsta_mode;
6704
-
6705
- ret = wldev_iovar_getint(net, "mapsta_mode", &mapsta_mode);
6706
- if (ret) {
6707
- IAPSTA_INFO(net->name, "not supported %d\n", ret);
6708
- mapsta_mode = MCHAN_APSTA_NOT_ALLOW;
6709
- }
6710
-
6711
- if (mapsta_mode == MCHAN_APSTA_SBSC)
6712
- apsta_params->rsdb = 1;
6713
- else if (mapsta_mode == MCHAN_APSTA_NO_RESTRICT)
6714
- apsta_params->vsdb = TRUE;
6715
-
6716
- IAPSTA_INFO(net->name, "mapsta_mode=%d(rsdb=%d, vsdb=%d)\n",
6717
- mapsta_mode, apsta_params->rsdb, apsta_params->vsdb);
6718
-}
6719
-
6720
-static void
67216099 wl_ext_iapsta_postinit(struct net_device *net, struct wl_if_info *cur_if)
67226100 {
67236101 struct dhd_pub *dhd = dhd_get_pub(net);
....@@ -6728,17 +6106,12 @@
67286106 if (cur_if->ifidx == 0) {
67296107 apsta_params->rsdb = wl_ext_iapsta_get_rsdb(net, dhd);
67306108 apsta_params->vsdb = FALSE;
6731
- wl_ext_iapsta_get_mapsta_mode(net);
67326109 apsta_params->csa = 0;
67336110 apsta_params->acs = 0;
67346111 apsta_params->radar = wl_ext_radar_detect(net);
67356112 if (dhd->conf->fw_type == FW_TYPE_MESH) {
67366113 apsta_params->csa |= (CSA_FW_BIT | CSA_DRV_BIT);
67376114 }
6738
- cur_if->ifmode = ISTA_MODE;
6739
- cur_if->prio = PRIO_STA;
6740
- cur_if->vsdb = TRUE;
6741
- cur_if->prefix = 'S';
67426115 if (dhd->conf->vndr_ie_assocreq && strlen(dhd->conf->vndr_ie_assocreq))
67436116 wl_ext_add_del_ie(net, VNDR_IE_ASSOCREQ_FLAG, dhd->conf->vndr_ie_assocreq, "add");
67446117 } else {
....@@ -6898,32 +6271,6 @@
68986271 }
68996272 #endif /* WLDWDS */
69006273
6901
-static void
6902
-wl_ext_iapsta_init_priv(struct net_device *net)
6903
-{
6904
- struct dhd_pub *dhd = dhd_get_pub(net);
6905
- struct wl_apsta_params *apsta_params = dhd->iapsta_params;
6906
-
6907
- init_waitqueue_head(&apsta_params->netif_change_event);
6908
- mutex_init(&apsta_params->usr_sync);
6909
- mutex_init(&apsta_params->in4way_sync);
6910
-#ifdef STA_MGMT
6911
- INIT_LIST_HEAD(&apsta_params->sta_list);
6912
-#endif /* STA_MGMT */
6913
-#ifdef EAPOL_RESEND
6914
- spin_lock_init(&apsta_params->eapol_lock);
6915
-#endif /* EAPOL_RESEND */
6916
-}
6917
-
6918
-static void
6919
-wl_ext_iapsta_deinit_priv(struct net_device *net)
6920
-{
6921
- struct dhd_pub *dhd = dhd_get_pub(net);
6922
- struct wl_apsta_params *apsta_params = dhd->iapsta_params;
6923
-
6924
- memset(apsta_params, 0, sizeof(struct wl_apsta_params));
6925
-}
6926
-
69276274 int
69286275 wl_ext_iapsta_attach_netdev(struct net_device *net, int ifidx, uint8 bssidx)
69296276 {
....@@ -6935,52 +6282,87 @@
69356282 IAPSTA_TRACE(net->name, "ifidx=%d, bssidx=%d\n", ifidx, bssidx);
69366283 cur_if = &apsta_params->if_info[ifidx];
69376284 }
6938
-
69396285 if (ifidx == 0) {
6940
- wl_ext_iapsta_init_priv(net);
6941
- strcpy(cur_if->ifname, net->name);
6942
-#ifdef TPUT_MONITOR
6943
- wl_timer_register(net, &apsta_params->monitor_timer, wl_tput_monitor_timer);
6944
-#endif /* TPUT_MONITOR */
6945
-#ifdef RXF0OVFL_REINIT_WAR
6946
- wl_timer_register(net, &apsta_params->rxf0ovfl_timer, wl_ext_rxf0ovfl_reinit_timeout);
6947
-#endif /* RXF0OVFL_REINIT_WAR */
6948
- }
6949
-
6950
- if (ifidx == 0 || (cur_if && wl_get_isam_status(cur_if, IF_ADDING))) {
6286
+ memset(apsta_params, 0, sizeof(struct wl_apsta_params));
6287
+ apsta_params->dhd = dhd;
69516288 cur_if->dev = net;
69526289 cur_if->ifidx = ifidx;
69536290 cur_if->bssidx = bssidx;
6291
+ cur_if->ifmode = ISTA_MODE;
6292
+ cur_if->prio = PRIO_STA;
6293
+ cur_if->vsdb = TRUE;
6294
+ cur_if->prefix = 'S';
6295
+ wl_ext_event_register(net, dhd, WLC_E_LAST, wl_ext_iapsta_event,
6296
+ apsta_params, PRIO_EVENT_IAPSTA);
6297
+ strcpy(cur_if->ifname, net->name);
6298
+ init_waitqueue_head(&apsta_params->netif_change_event);
6299
+ init_waitqueue_head(&apsta_params->ap_recon_sta_event);
6300
+ mutex_init(&apsta_params->usr_sync);
6301
+ mutex_init(&apsta_params->in4way_sync);
69546302 mutex_init(&cur_if->pm_sync);
6303
+#ifdef STA_MGMT
6304
+ INIT_LIST_HEAD(&apsta_params->sta_list);
6305
+#endif /* STA_MGMT */
6306
+#ifdef TPUT_MONITOR
6307
+ init_timer_compat(&apsta_params->monitor_timer, wl_tput_monitor_timer, net);
6308
+#endif /* TPUT_MONITOR */
6309
+#ifdef ACS_MONITOR
6310
+ wl_acs_attach(dhd, cur_if);
6311
+#endif /* ACS_MONITOR */
69556312 INIT_DELAYED_WORK(&cur_if->pm_enable_work, wl_ext_pm_work_handler);
6956
- init_waitqueue_head(&cur_if->ap_recon_sta_event);
6313
+#ifdef SET_CARRIER
6314
+ wl_ext_net_setcarrier(cur_if, FALSE, TRUE);
6315
+#endif /* SET_CARRIER */
6316
+ init_timer_compat(&cur_if->connect_timer, wl_ext_connect_timeout, net);
6317
+#if defined(WL_EXT_RECONNECT) && defined(WL_CFG80211)
6318
+ init_timer_compat(&cur_if->reconnect_timer, wl_ext_reconnect_timeout, net);
6319
+#endif /* WL_EXT_RECONNECT && WL_CFG80211 */
6320
+#ifdef RESTART_AP_WAR
6321
+ init_timer_compat(&cur_if->restart_ap_timer, wl_ext_restart_ap_timeout, net);
6322
+#endif /* RESTART_AP_WAR */
6323
+#ifdef RESET_AP_WAR
6324
+ init_timer_compat(&cur_if->reset_ap_timer, wl_ext_reset_ap_timeout, net);
6325
+#endif /* RESET_AP_WAR */
6326
+#ifdef RXF0OVFL_REINIT_WAR
6327
+ init_timer_compat(&apsta_params->rxf0ovfl_timer, wl_ext_rxf0ovfl_reinit_timeout, net);
6328
+#endif /* RXF0OVFL_REINIT_WAR */
6329
+#ifdef EAPOL_RESEND
6330
+ spin_lock_init(&apsta_params->eapol_lock);
6331
+ init_timer_compat(&cur_if->eapol_timer, wl_eapol_timer, net);
6332
+#endif /* EAPOL_RESEND */
6333
+ }
6334
+ else if (cur_if && wl_get_isam_status(cur_if, IF_ADDING)) {
6335
+ cur_if->dev = net;
6336
+ cur_if->ifidx = ifidx;
6337
+ cur_if->bssidx = bssidx;
69576338 wl_ext_event_register(net, dhd, WLC_E_LAST, wl_ext_iapsta_event,
69586339 apsta_params, PRIO_EVENT_IAPSTA);
69596340 #if defined(WLMESH) && defined(WL_ESCAN)
6960
- wl_mesh_escan_attach(dhd, cur_if);
6341
+ if (cur_if->ifmode == IMESH_MODE && apsta_params->macs) {
6342
+ wl_mesh_escan_attach(dhd, cur_if);
6343
+ }
69616344 #endif /* WLMESH && WL_ESCAN */
69626345 #ifdef ACS_MONITOR
69636346 wl_acs_attach(dhd, cur_if);
69646347 #endif /* ACS_MONITOR */
6348
+ mutex_init(&cur_if->pm_sync);
6349
+ INIT_DELAYED_WORK(&cur_if->pm_enable_work, wl_ext_pm_work_handler);
69656350 #ifdef SET_CARRIER
69666351 wl_ext_net_setcarrier(cur_if, FALSE, TRUE);
69676352 #endif /* SET_CARRIER */
6968
- wl_timer_register(net, &cur_if->connect_timer, wl_ext_connect_timeout);
6969
-#if defined(WL_EXT_RECONNECT) && defined(WL_CFG80211)
6970
- wl_timer_register(net, &cur_if->reconnect_timer, wl_ext_reconnect_timeout);
6971
-#endif /* WL_EXT_RECONNECT && WL_CFG80211 */
6353
+ init_timer_compat(&cur_if->connect_timer, wl_ext_connect_timeout, net);
69726354 #ifdef RESTART_AP_WAR
6973
- wl_timer_register(net, &cur_if->restart_ap_timer, wl_ext_restart_ap_timeout);
6355
+ init_timer_compat(&cur_if->restart_ap_timer, wl_ext_restart_ap_timeout, net);
69746356 #endif /* RESTART_AP_WAR */
69756357 #ifdef RESET_AP_WAR
6976
- wl_timer_register(net, &cur_if->reset_ap_timer, wl_ext_reset_ap_timeout);
6358
+ init_timer_compat(&cur_if->reset_ap_timer, wl_ext_reset_ap_timeout, net);
69776359 #endif /* RESET_AP_WAR */
6360
+#if defined(WL_EXT_RECONNECT) && defined(WL_CFG80211)
6361
+ init_timer_compat(&cur_if->reconnect_timer, wl_ext_reconnect_timeout, net);
6362
+#endif /* WL_EXT_RECONNECT && WL_CFG80211 */
69786363 #ifdef EAPOL_RESEND
6979
- wl_timer_register(net, &cur_if->eapol_timer, wl_eapol_timer);
6364
+ init_timer_compat(&cur_if->eapol_timer, wl_eapol_timer, net);
69806365 #endif /* EAPOL_RESEND */
6981
-#ifdef KEY_INSTALL_CHECK
6982
- wl_timer_register(net, &cur_if->key_install_timer, wl_ext_key_install_timeout);
6983
-#endif /* KEY_INSTALL_CHECK */
69846366 }
69856367
69866368 return 0;
....@@ -7001,23 +6383,58 @@
70016383 cur_if = &apsta_params->if_info[ifidx];
70026384 }
70036385
7004
- if (ifidx == 0 || (cur_if && (wl_get_isam_status(cur_if, IF_READY) ||
7005
- wl_get_isam_status(cur_if, IF_ADDING)))) {
6386
+ if (ifidx == 0) {
70066387 #ifdef EAPOL_RESEND
70076388 wl_ext_release_eapol_txpkt(dhd, ifidx, FALSE);
70086389 #endif /* EAPOL_RESEND */
7009
-#ifdef KEY_INSTALL_CHECK
7010
- wl_timer_deregister(net, &cur_if->key_install_timer);
7011
-#endif /* KEY_INSTALL_CHECK */
7012
- wl_timer_deregister(net, &cur_if->connect_timer);
6390
+ wl_ext_mod_timer(&cur_if->connect_timer, 0, 0);
70136391 #if defined(WL_EXT_RECONNECT) && defined(WL_CFG80211)
7014
- wl_timer_deregister(net, &cur_if->reconnect_timer);
6392
+ wl_ext_mod_timer(&cur_if->reconnect_timer, 0, 0);
70156393 #endif /* WL_EXT_RECONNECT && WL_CFG80211 */
70166394 #ifdef RESTART_AP_WAR
7017
- wl_timer_deregister(net, &cur_if->restart_ap_timer);
6395
+ wl_ext_mod_timer(&cur_if->restart_ap_timer, 0, 0);
70186396 #endif /* RESTART_AP_WAR */
70196397 #ifdef RESET_AP_WAR
7020
- wl_timer_deregister(net, &cur_if->reset_ap_timer);
6398
+ wl_ext_mod_timer(&cur_if->reset_ap_timer, 0, 0);
6399
+#endif /* RESET_AP_WAR */
6400
+#ifdef RXF0OVFL_REINIT_WAR
6401
+ wl_ext_mod_timer(&apsta_params->rxf0ovfl_timer, 0, 0);
6402
+#endif /* RXF0OVFL_REINIT_WAR */
6403
+#ifdef SET_CARRIER
6404
+ wl_ext_net_setcarrier(cur_if, FALSE, FALSE);
6405
+#endif /* SET_CARRIER */
6406
+ wl_ext_add_remove_pm_enable_work(net, FALSE);
6407
+#ifdef ACS_MONITOR
6408
+ wl_acs_detach(cur_if);
6409
+#endif /* ACS_MONITOR */
6410
+#ifdef TPUT_MONITOR
6411
+ wl_ext_mod_timer(&apsta_params->monitor_timer, 0, 0);
6412
+#endif /* TPUT_MONITOR */
6413
+#if defined(WLMESH) && defined(WL_ESCAN)
6414
+ if (cur_if->ifmode == IMESH_MODE && apsta_params->macs) {
6415
+ wl_mesh_escan_detach(dhd, cur_if);
6416
+ }
6417
+#endif /* WLMESH && WL_ESCAN */
6418
+ wl_ext_event_deregister(net, dhd, WLC_E_LAST, wl_ext_iapsta_event);
6419
+#ifdef STA_MGMT
6420
+ wl_ext_flush_sta_list(net, ifidx);
6421
+#endif /* STA_MGMT */
6422
+ memset(apsta_params, 0, sizeof(struct wl_apsta_params));
6423
+ }
6424
+ else if (cur_if && (wl_get_isam_status(cur_if, IF_READY) ||
6425
+ wl_get_isam_status(cur_if, IF_ADDING))) {
6426
+#ifdef EAPOL_RESEND
6427
+ wl_ext_release_eapol_txpkt(dhd, ifidx, FALSE);
6428
+#endif /* EAPOL_RESEND */
6429
+ wl_ext_mod_timer(&cur_if->connect_timer, 0, 0);
6430
+#if defined(WL_EXT_RECONNECT) && defined(WL_CFG80211)
6431
+ wl_ext_mod_timer(&cur_if->reconnect_timer, 0, 0);
6432
+#endif /* WL_EXT_RECONNECT && WL_CFG80211 */
6433
+#ifdef RESTART_AP_WAR
6434
+ wl_ext_mod_timer(&cur_if->restart_ap_timer, 0, 0);
6435
+#endif /* RESTART_AP_WAR */
6436
+#ifdef RESET_AP_WAR
6437
+ wl_ext_mod_timer(&cur_if->reset_ap_timer, 0, 0);
70216438 #endif /* RESET_AP_WAR */
70226439 #ifdef SET_CARRIER
70236440 wl_ext_net_setcarrier(cur_if, FALSE, FALSE);
....@@ -7027,7 +6444,9 @@
70276444 wl_acs_detach(cur_if);
70286445 #endif /* ACS_MONITOR */
70296446 #if defined(WLMESH) && defined(WL_ESCAN)
7030
- wl_mesh_escan_detach(dhd, cur_if);
6447
+ if (cur_if->ifmode == IMESH_MODE && apsta_params->macs) {
6448
+ wl_mesh_escan_detach(dhd, cur_if);
6449
+ }
70316450 #endif /* WLMESH && WL_ESCAN */
70326451 wl_ext_event_deregister(net, dhd, WLC_E_LAST, wl_ext_iapsta_event);
70336452 #ifdef STA_MGMT
....@@ -7036,15 +6455,23 @@
70366455 memset(cur_if, 0, sizeof(struct wl_if_info));
70376456 }
70386457
7039
- if (ifidx == 0) {
7040
-#ifdef RXF0OVFL_REINIT_WAR
7041
- wl_timer_deregister(net, &apsta_params->rxf0ovfl_timer);
7042
-#endif /* RXF0OVFL_REINIT_WAR */
7043
-#ifdef TPUT_MONITOR
7044
- wl_timer_deregister(net, &apsta_params->monitor_timer);
7045
-#endif /* TPUT_MONITOR */
7046
- wl_ext_iapsta_deinit_priv(net);
6458
+ return 0;
6459
+}
6460
+
6461
+int
6462
+wl_ext_iapsta_attach(struct net_device *net)
6463
+{
6464
+ struct dhd_pub *dhd = dhd_get_pub(net);
6465
+ struct wl_apsta_params *iapsta_params;
6466
+
6467
+ IAPSTA_TRACE(net->name, "Enter\n");
6468
+
6469
+ iapsta_params = kzalloc(sizeof(struct wl_apsta_params), GFP_KERNEL);
6470
+ if (unlikely(!iapsta_params)) {
6471
+ IAPSTA_ERROR("wlan", "Could not allocate apsta_params\n");
6472
+ return -ENOMEM;
70476473 }
6474
+ dhd->iapsta_params = (void *)iapsta_params;
70486475
70496476 return 0;
70506477 }
....@@ -7056,47 +6483,9 @@
70566483
70576484 IAPSTA_TRACE(net->name, "Enter\n");
70586485
7059
- if (g_ioctl_buf) {
7060
- kfree(g_ioctl_buf);
7061
- g_ioctl_buf = NULL;
7062
- }
7063
-
70646486 if (dhd->iapsta_params) {
7065
- wl_ext_iapsta_deinit_priv(net);
70666487 kfree(dhd->iapsta_params);
70676488 dhd->iapsta_params = NULL;
70686489 }
7069
-}
7070
-
7071
-int
7072
-wl_ext_iapsta_attach(struct net_device *net)
7073
-{
7074
- struct dhd_pub *dhd = dhd_get_pub(net);
7075
- struct wl_apsta_params *iapsta_params;
7076
- int ret = 0;
7077
-
7078
- IAPSTA_TRACE(net->name, "Enter\n");
7079
-
7080
- iapsta_params = kzalloc(sizeof(struct wl_apsta_params), GFP_KERNEL);
7081
- if (unlikely(!iapsta_params)) {
7082
- IAPSTA_ERROR(net->name, "Can not allocate apsta_params\n");
7083
- ret = -ENOMEM;
7084
- goto exit;
7085
- }
7086
- dhd->iapsta_params = (void *)iapsta_params;
7087
-
7088
- if (!g_ioctl_buf) {
7089
- g_ioctl_buf = kmalloc(WL_DUMP_BUF_LEN, GFP_KERNEL);
7090
- if (unlikely(!g_ioctl_buf)) {
7091
- IAPSTA_ERROR(net->name, "Can not allocate g_ioctl_buf\n");
7092
- ret = -ENOMEM;
7093
- goto exit;
7094
- }
7095
- }
7096
-
7097
-exit:
7098
- if (ret)
7099
- wl_ext_iapsta_dettach(net);
7100
- return ret;
71016490 }
71026491 #endif /* WL_EXT_IAPSTA */