hc
2024-05-10 cde9070d9970eef1f7ec2360586c802a16230ad8
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
....@@ -223,12 +198,6 @@
223198 uint conn_state;
224199 uint16 prev_channel;
225200 uint16 post_channel;
226
- struct osl_timespec sta_disc_ts;
227
- struct osl_timespec sta_conn_ts;
228
- bool ap_recon_sta;
229
- wait_queue_head_t ap_recon_sta_event;
230
- struct ether_addr ap_disc_sta_bssid;
231
- struct osl_timespec ap_disc_sta_ts;
232201 #ifdef TPUT_MONITOR
233202 struct wl_tput_info tput_info;
234203 #endif /* TPUT_MONITOR */
....@@ -250,10 +219,6 @@
250219 int eapol_resend_intvl;
251220 #endif /* EAPOL_DYNAMATIC_RESEND */
252221 #endif /* EAPOL_RESEND */
253
-#ifdef KEY_INSTALL_CHECK
254
- timer_list_compat_t key_install_timer;
255
- int key_install_cnt;
256
-#endif /* KEY_INSTALL_CHECK */
257222 int empty_scan;
258223 #ifdef RESTART_AP_WAR
259224 timer_list_compat_t restart_ap_timer;
....@@ -262,12 +227,6 @@
262227 timer_list_compat_t reset_ap_timer;
263228 uint32 txbcnfrm;
264229 #endif /* RESET_AP_WAR */
265
-#if defined(WL_EXT_RECONNECT) && defined(WL_CFG80211)
266
-#ifdef WL_EXT_DISCONNECT_RECONNECT
267
- struct osl_timespec sta_disc_conn_ts;
268
- int sta_disc_recon_cnt;
269
-#endif /* WL_EXT_DISCONNECT_RECONNECT */
270
-#endif /* WL_EXT_RECONNECT && WL_CFG80211 */
271230 } wl_if_info_t;
272231
273232 typedef struct wl_apsta_params {
....@@ -275,7 +234,8 @@
275234 #ifdef WLDWDS
276235 struct wl_dwds_info dwds_info[MAX_DWDS_IF_NUM];
277236 #endif /* WLDWDS */
278
- u8 *ioctl_buf;
237
+ struct dhd_pub *dhd;
238
+ int ioctl_ver;
279239 bool init;
280240 int rsdb;
281241 bool vsdb;
....@@ -294,6 +254,12 @@
294254 #endif /* WLMESH && WL_ESCAN */
295255 struct mutex in4way_sync;
296256 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;
297263 #ifdef TPUT_MONITOR
298264 timer_list_compat_t monitor_timer;
299265 int32 tput_sum;
....@@ -334,8 +300,7 @@
334300 ISAM_RC_AP_RESTART = 4,
335301 ISAM_RC_AP_RESET = 5,
336302 ISAM_RC_EAPOL_RESEND = 6,
337
- ISAM_RC_KEY_INSTALL = 7,
338
- ISAM_RC_RXF0OVFL_REINIT = 8
303
+ ISAM_RC_RXF0OVFL_REINIT = 7
339304 };
340305
341306 #define wl_get_isam_status(cur_if, stat) \
....@@ -350,6 +315,9 @@
350315 static int wl_ext_enable_iface(struct net_device *dev, char *ifname,
351316 int wait_up, bool lock);
352317 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 */
353321
354322 static struct wl_if_info *
355323 wl_get_cur_if(struct net_device *dev)
....@@ -636,17 +604,17 @@
636604 }
637605
638606 static int
639
-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)
640609 {
641610 struct net_device *dev = cur_if->dev;
642
- struct dhd_pub *dhd = dhd_get_pub(dev);
643
- struct wl_apsta_params *apsta_params = dhd->iapsta_params;
611
+ int wsec=0;
644612 struct wl_wsec_key wsec_key;
645613 wsec_pmk_t psk;
646614 authmode_t amode = cur_if->amode;
647615 encmode_t emode = cur_if->emode;
648
- int wsec=0;
649616 char *key = cur_if->key;
617
+ struct dhd_pub *dhd = apsta_params->dhd;
650618
651619 memset(&wsec_key, 0, sizeof(wsec_key));
652620 memset(&psk, 0, sizeof(psk));
....@@ -742,14 +710,14 @@
742710 }
743711
744712 static u32
745
-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)
746715 {
747
- struct dhd_pub *dhd = dhd_get_pub(dev);
748716 u32 chanspec = 0;
749717
750718 if (wl_ext_associated(dev)) {
751719 if (wl_ext_iovar_getint(dev, "chanspec", (s32 *)&chanspec) == BCME_OK) {
752
- chanspec = wl_ext_chspec_driver_to_host(dhd, chanspec);
720
+ chanspec = wl_ext_chspec_driver_to_host(apsta_params->ioctl_ver, chanspec);
753721 if (chan_info) {
754722 chan_info->band = CHSPEC2WLC_BAND(chanspec);
755723 chan_info->chan = wf_chspec_ctlchan(chanspec);
....@@ -762,12 +730,13 @@
762730 }
763731
764732 static uint16
765
-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)
766735 {
767736 uint16 chan = 0, ctl_chan;
768737 u32 chanspec = 0;
769738
770
- chanspec = wl_ext_get_chanspec(dev, chan_info);
739
+ chanspec = wl_ext_get_chanspec(apsta_params, dev, chan_info);
771740 if (chanspec) {
772741 ctl_chan = wf_chspec_ctlchan(chanspec);
773742 chan = (u16)(ctl_chan & 0x00FF);
....@@ -776,26 +745,10 @@
776745 return chan;
777746 }
778747
779
-void
780
-wl_ext_get_chan_str(struct net_device *dev, char *chan_str, int total_len)
781
-{
782
- struct wl_chan_info chan_info;
783
- int bytes_written=0;
784
- u32 chanspec = 0;
785
-
786
- memset(chan_str, 0, total_len);
787
- chanspec = wl_ext_get_chanspec(dev, &chan_info);
788
- if (chanspec) {
789
- bytes_written += snprintf(chan_str+bytes_written, total_len, "%s-%d %sMHz",
790
- WLCBAND2STR(chan_info.band), chan_info.chan,
791
- wf_chspec_to_bw_str(chanspec));
792
- }
793
-}
794
-
795748 static chanspec_t
796
-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)
797751 {
798
- struct dhd_pub *dhd = dhd_get_pub(dev);
799752 chanspec_band_t chanspec_band;
800753 chanspec_t chspec = 0, fw_chspec = 0;
801754 u32 bw = WL_CHANSPEC_BW_20;
....@@ -837,7 +790,7 @@
837790 chanspec_band = wl_ext_wlcband_to_chanspec_band(chan_info->band);
838791 chspec = wf_create_chspec_from_primary(chan_info->chan, bw, chanspec_band);
839792 if (wf_chspec_valid(chspec)) {
840
- fw_chspec = wl_ext_chspec_host_to_driver(dhd, chspec);
793
+ fw_chspec = wl_ext_chspec_host_to_driver(apsta_params->ioctl_ver, chspec);
841794 if (fw_chspec == INVCHANSPEC) {
842795 IAPSTA_ERROR(dev->name, "failed to convert host chanspec to fw chanspec\n");
843796 fw_chspec = 0;
....@@ -894,88 +847,47 @@
894847 return bytes_written;
895848 }
896849
897
-void
898
-wl_ext_send_event_msg(struct net_device *dev, int event, int status,
899
- 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)
900866 {
901867 struct dhd_pub *dhd = dhd_get_pub(dev);
902868 struct wl_if_info *cur_if;
903869 wl_event_msg_t msg;
904870
905
- if (dhd && dhd->up) {
906
- cur_if = wl_get_cur_if(dev);
907
- if (!cur_if)
908
- return;
909
- bzero(&msg, sizeof(wl_event_msg_t));
910
- msg.ifidx = dhd_net2idx(dhd->info, dev);
911
- msg.event_type = hton32(event);
912
- msg.status = hton32(status);
913
- msg.reason = hton32(reason);
914
- 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
+
915882 #ifdef WL_EVENT
916
- wl_ext_event_send(dhd->event_params, &msg, NULL);
917
-#endif /* WL_EVENT */
883
+ wl_ext_event_send(dhd->event_params, &msg, NULL);
884
+#endif
918885 #ifdef WL_CFG80211
886
+ if (dhd->up) {
919887 wl_cfg80211_event(dev, &msg, NULL);
920
-#endif /* WL_CFG80211 */
921888 }
889
+#endif /* defined(WL_CFG80211) */
922890 }
923
-
924
-#ifdef BTC_WAR
925
-bool
926
-wl_ext_iapsta_if_2g_enabled(struct net_device *net)
927
-{
928
- struct dhd_pub *dhd = dhd_get_pub(net);
929
- struct wl_apsta_params *apsta_params = dhd->iapsta_params;
930
- struct wl_if_info *tmp_if;
931
- struct wl_chan_info chan_info;
932
- bool enabled = FALSE;
933
- uint16 cur_chan;
934
- int i;
935
-
936
- for (i=0; i<MAX_IF_NUM; i++) {
937
- tmp_if = &apsta_params->if_info[i];
938
- if (tmp_if && wl_get_isam_status(tmp_if, IF_READY)) {
939
- cur_chan = wl_ext_get_chan(tmp_if->dev, &chan_info);
940
- if (cur_chan && chan_info.band == WLC_BAND_2G) {
941
- enabled = TRUE;
942
- break;
943
- }
944
- }
945
- }
946
-
947
- return enabled;
948
-}
949
-
950
-void
951
-wl_ext_btc_config(struct net_device *dev, bool enable)
952
-{
953
- struct dhd_pub *dhd = dhd_get_pub(dev);
954
- bool enab = FALSE;
955
-
956
- if (dhd->conf->chip == BCM4354_CHIP_ID || dhd->conf->chip == BCM4356_CHIP_ID ||
957
- dhd->conf->chip == BCM43752_CHIP_ID) {
958
- IAPSTA_INFO(dev->name, "btc_war=%d, enable=%d\n", btc_war, enable);
959
- if (btc_war >= 0) {
960
- if (enable && btc_war > 0) {
961
- if (wl_ext_iapsta_if_2g_enabled(dev))
962
- enab = TRUE;
963
- }
964
- if (enab) {
965
- IAPSTA_INFO(dev->name, "enable\n");
966
- wl_ext_iovar_setint(dev, "txchain", 2);
967
- wl_ext_iovar_setint(dev, "rxchain", 2);
968
- wl_ext_iovar_setint(dev, "btc_mode", 5);
969
- } else {
970
- IAPSTA_INFO(dev->name, "disable\n");
971
- wl_ext_iovar_setint(dev, "btc_mode", 1);
972
- wl_ext_iovar_setint(dev, "txchain", 3);
973
- wl_ext_iovar_setint(dev, "rxchain", 3);
974
- }
975
- }
976
- }
977
-}
978
-#endif /* BTC_WAR */
979891
980892 static void
981893 wl_ext_connect_timeout(unsigned long data)
....@@ -996,7 +908,7 @@
996908 cur_if->assoc_info.reassoc = 0;
997909 #endif /* WL_EXT_RECONNECT && WL_CFG80211 */
998910 IAPSTA_ERROR(dev->name, "timer expired\n");
999
- 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);
1000912 }
1001913
1002914 #if defined(WL_CFG80211) || (defined(WLMESH) && defined(WL_ESCAN))
....@@ -1124,7 +1036,7 @@
11241036 }
11251037
11261038 #ifdef WL_ESCAN
1127
-#define WL_MESH_DELAY_SCAN_TMO 3000
1039
+#define WL_MESH_DELAY_SCAN_TMO 3
11281040 static void
11291041 wl_mesh_timer(unsigned long data)
11301042 {
....@@ -1216,10 +1128,9 @@
12161128 }
12171129
12181130 static int
1219
-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)
12201133 {
1221
- struct dhd_pub *dhd = dhd_get_pub(mesh_if->dev);
1222
- struct wl_apsta_params *apsta_params = dhd->iapsta_params;
12231134 struct wl_mesh_params *mesh_info = &apsta_params->mesh_info;
12241135 uchar mesh_oui[]={0x00, 0x22, 0xf4};
12251136 int ret;
....@@ -1229,9 +1140,9 @@
12291140 ret = wl_mesh_clear_vndr_ie(mesh_if->dev, mesh_oui);
12301141 memset(mesh_info, 0, sizeof(struct wl_mesh_params));
12311142 if (scan) {
1232
- 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,
12331144 &mesh_if->chan_info);
1234
- wl_timer_mod(dhd, &mesh_if->delay_scan, 100);
1145
+ wl_ext_mod_timer(&mesh_if->delay_scan, 0, 100);
12351146 }
12361147
12371148 return ret;
....@@ -1310,7 +1221,8 @@
13101221 if (sta_if) {
13111222 wldev_ioctl(mesh_if->dev, WLC_GET_BSSID, &mesh_info->master_bssid,
13121223 ETHER_ADDR_LEN, 0);
1313
- 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);
13141226 mesh_info->hop_cnt = 0;
13151227 memset(mesh_info->peer_bssid, 0, MAX_HOP_LIST*ETHER_ADDR_LEN);
13161228 if (!wl_mesh_update_vndr_ie(apsta_params, mesh_if))
....@@ -1386,7 +1298,8 @@
13861298 wl_ext_get_sec(mesh_if->dev, mesh_if->ifmode, sec, sizeof(sec), FALSE);
13871299 if (strnicmp(sec, "sae/sae", strlen("sae/sae")) == 0)
13881300 sae = TRUE;
1389
- 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);
13901303 bss_found = wl_escan_mesh_peer(mesh_if->dev, mesh_if->escan, &cur_ssid, cur_chan,
13911304 sae, &peer_mesh_info);
13921305
....@@ -1407,105 +1320,67 @@
14071320 }
14081321
14091322 static void
1410
-wl_mesh_event_handler(struct wl_if_info *cur_if,
1411
- 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)
14121325 {
1413
- struct dhd_pub *dhd = dhd_get_pub(cur_if->dev);
1414
- struct wl_apsta_params *apsta_params = dhd->iapsta_params;
14151326 struct wl_mesh_params *mesh_info = &apsta_params->mesh_info;
14161327 uint32 event_type = ntoh32(e->event_type);
14171328 uint32 status = ntoh32(e->status);
14181329 uint32 reason = ntoh32(e->reason);
1419
- uint16 flags = ntoh16(e->flags);
1420
- struct wl_if_info *mesh_if = NULL, *tmp_if = NULL;
1421
- int ret, i;
1330
+ int ret;
14221331
1423
- if (cur_if->ifmode == IMESH_MODE)
1424
- mesh_if = cur_if;
1425
- else {
1426
- for (i=0; i<MAX_IF_NUM; i++) {
1427
- tmp_if = &apsta_params->if_info[i];
1428
- if (tmp_if->dev && tmp_if->ifmode == IMESH_MODE) {
1429
- mesh_if = tmp_if;
1430
- break;
1431
- }
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);
14321340 }
14331341 }
1434
-
1435
- if (cur_if->ifmode == ISTA_MODE || cur_if->ifmode == IGC_MODE) {
1436
- if (event_type == WLC_E_LINK) {
1437
- if (!(flags & WLC_EVENT_MSG_LINK)) {
1438
- if (mesh_if && apsta_params->macs)
1439
- wl_mesh_clear_mesh_info(mesh_if, TRUE);
1440
- } else {
1441
- if (mesh_if && apsta_params->macs)
1442
- 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;
14431368 }
1444
- }
1445
- else if (event_type == WLC_E_SET_SSID && status != WLC_E_STATUS_SUCCESS) {
1446
- if (mesh_if && apsta_params->macs)
1447
- wl_mesh_clear_mesh_info(mesh_if, TRUE);
1448
- }
1449
- else if (event_type == WLC_E_DEAUTH || event_type == WLC_E_DEAUTH_IND ||
1450
- event_type == WLC_E_DISASSOC || event_type == WLC_E_DISASSOC_IND) {
1451
- if (mesh_if && apsta_params->macs)
1452
- 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);
14531372 }
14541373 }
1455
- else if (cur_if->ifmode == IMESH_MODE && apsta_params->macs) {
1456
- if (wl_get_isam_status(mesh_if, AP_CREATED) &&
1457
- ((event_type == WLC_E_SET_SSID && status == WLC_E_STATUS_SUCCESS) ||
1458
- (event_type == WLC_E_LINK && status == WLC_E_STATUS_SUCCESS &&
1459
- reason == WLC_E_REASON_INITIAL_ASSOC))) {
1460
- if (!wl_mesh_update_master_info(apsta_params, mesh_if)) {
1461
- mesh_info->scan_channel = wl_ext_get_chan(&mesh_if->dev,
1462
- mesh_if->chan_info);
1463
- wl_timer_mod(dhd, &mesh_if->delay_scan, WL_MESH_DELAY_SCAN_TMO);
1464
- }
1465
- }
1466
- else if ((event_type == WLC_E_LINK && reason == WLC_E_LINK_BSSCFG_DIS) ||
1467
- (event_type == WLC_E_LINK && status == WLC_E_STATUS_SUCCESS &&
1468
- reason == WLC_E_REASON_DEAUTH)) {
1469
- wl_mesh_clear_mesh_info(mesh_if, FALSE);
1470
- }
1471
- else if (wl_get_isam_status(mesh_if, AP_CREATED) &&
1472
- (event_type == WLC_E_ASSOC_IND || event_type == WLC_E_REASSOC_IND) &&
1473
- reason == DOT11_SC_SUCCESS) {
1474
- mesh_info->scan_channel = wl_ext_get_chan(mesh_if->dev,
1475
- &mesh_if->chan_info);
1476
- wl_timer_mod(dhd, &mesh_if->delay_scan, 100);
1477
- }
1478
- else if (event_type == WLC_E_DISASSOC_IND || event_type == WLC_E_DEAUTH_IND ||
1479
- (event_type == WLC_E_DEAUTH && reason != DOT11_RC_RESERVED)) {
1480
- if (!memcmp(&mesh_info->peer_bssid, &e->addr, ETHER_ADDR_LEN))
1481
- wl_mesh_clear_mesh_info(mesh_if, TRUE);
1482
- }
1483
- else if (wl_get_isam_status(mesh_if, AP_CREATED) &&
1484
- event_type == WLC_E_RESERVED && reason == ISAM_RC_MESH_ACS) {
1485
- if (!wl_mesh_update_master_info(apsta_params, mesh_if)) {
1486
- wl_scan_info_t scan_info;
1487
- memset(&scan_info, 0, sizeof(wl_scan_info_t));
1488
- wl_ext_ioctl(mesh_if->dev, WLC_GET_SSID, &scan_info.ssid, sizeof(wlc_ssid_t), 0);
1489
- if (mesh_info->scan_channel) {
1490
- scan_info.channels.count = 1;
1491
- scan_info.channels.channel[0] = mesh_info->scan_channel;
1492
- }
1493
- ret = wl_escan_set_scan(mesh_if->dev, &scan_info);
1494
- if (ret)
1495
- wl_timer_mod(dhd, &mesh_if->delay_scan, WL_MESH_DELAY_SCAN_TMO);
1496
- }
1497
- }
1498
- else if (wl_get_isam_status(mesh_if, AP_CREATED) &&
1499
- ((event_type == WLC_E_ESCAN_RESULT && status == WLC_E_STATUS_SUCCESS) ||
1500
- (event_type == WLC_E_ESCAN_RESULT &&
1501
- (status == WLC_E_STATUS_ABORT || status == WLC_E_STATUS_NEWSCAN ||
1502
- status == WLC_E_STATUS_11HQUIET || status == WLC_E_STATUS_CS_ABORT ||
1503
- status == WLC_E_STATUS_NEWASSOC || status == WLC_E_STATUS_TIMEOUT)))) {
1504
- if (!wl_mesh_update_master_info(apsta_params, mesh_if)) {
1505
- if (!wl_mesh_update_mesh_info(apsta_params, mesh_if)) {
1506
- mesh_info->scan_channel = 0;
1507
- wl_timer_mod(dhd, &mesh_if->delay_scan, WL_MESH_DELAY_SCAN_TMO);
1508
- }
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);
15091384 }
15101385 }
15111386 }
....@@ -1515,7 +1390,9 @@
15151390 wl_mesh_escan_detach(dhd_pub_t *dhd, struct wl_if_info *mesh_if)
15161391 {
15171392 IAPSTA_TRACE(mesh_if->dev->name, "Enter\n");
1518
- wl_timer_deregister(mesh_if->dev, &mesh_if->delay_scan);
1393
+
1394
+ del_timer_sync(&mesh_if->delay_scan);
1395
+
15191396 if (mesh_if->escan) {
15201397 mesh_if->escan = NULL;
15211398 }
....@@ -1527,7 +1404,7 @@
15271404 IAPSTA_TRACE(mesh_if->dev->name, "Enter\n");
15281405
15291406 mesh_if->escan = dhd->escan;
1530
- 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);
15311408
15321409 return 0;
15331410 }
....@@ -1702,10 +1579,6 @@
17021579 WL_MSG(cur_if->ifname, "[%c] skip DFS channel %d\n",
17031580 cur_if->prefix, chan_info->chan);
17041581 return 0;
1705
- } else if (wl_ext_passive_chan(cur_if->dev, chan_info)) {
1706
- WL_MSG(cur_if->ifname, "[%c] skip PASSIVE channel %d\n",
1707
- cur_if->prefix, chan_info->chan);
1708
- return 0;
17091582 } else if (!chan_info->chan) {
17101583 WL_MSG(cur_if->ifname, "[%c] no valid channel\n", cur_if->prefix);
17111584 return 0;
....@@ -1740,7 +1613,7 @@
17401613 }
17411614
17421615 wl_ext_ioctl(cur_if->dev, WLC_GET_SSID, &ssid, sizeof(ssid), 0);
1743
- chanspec = wl_ext_get_chanspec(cur_if->dev, chan_info);
1616
+ chanspec = wl_ext_get_chanspec(apsta_params, cur_if->dev, chan_info);
17441617 WL_MSG(cur_if->ifname, "[%c] enabled with SSID: \"%s\" on channel %s-%d(0x%x)\n",
17451618 cur_if->prefix, ssid.SSID, CHSPEC2BANDSTR(chanspec),
17461619 chan_info->chan, chanspec);
....@@ -1790,7 +1663,7 @@
17901663 if (cur_if != tmp_if && wl_get_isam_status(tmp_if, IF_READY) &&
17911664 tmp_if->prio > max_prio) {
17921665 memset(&chan_info, 0, sizeof(struct wl_chan_info));
1793
- wl_ext_get_chan(tmp_if->dev, &chan_info);
1666
+ wl_ext_get_chan(apsta_params, tmp_if->dev, &chan_info);
17941667 if (wl_ext_dfs_chan(&chan_info) && nodfs)
17951668 continue;
17961669 if (chan_info.chan && (cur_if->chan_info.band == chan_info.band)) {
....@@ -1817,7 +1690,7 @@
18171690 return 0;
18181691
18191692 memset(&chan_info, 0, sizeof(struct wl_chan_info));
1820
- 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);
18211694 if (target_chan) {
18221695 target_band = chan_info.band;
18231696 IAPSTA_INFO(cur_if->ifname, "cur_chan=%s-%d, target_chan=%s-%d\n",
....@@ -1845,13 +1718,13 @@
18451718
18461719 if (apsta_params->rsdb) {
18471720 memset(&cur_chan_info, 0, sizeof(struct wl_chan_info));
1848
- wl_ext_get_chan(cur_if->dev, &cur_chan_info);
1721
+ wl_ext_get_chan(apsta_params, cur_if->dev, &cur_chan_info);
18491722 for (i=0; i<MAX_IF_NUM; i++) {
18501723 tmp_if = &apsta_params->if_info[i];
18511724 if (tmp_if != cur_if && wl_get_isam_status(tmp_if, IF_READY) &&
18521725 tmp_if->prio > cur_if->prio) {
18531726 memset(&tmp_chan_info, 0, sizeof(struct wl_chan_info));
1854
- wl_ext_get_chan(tmp_if->dev, &tmp_chan_info);
1727
+ wl_ext_get_chan(apsta_params, tmp_if->dev, &tmp_chan_info);
18551728 if (!tmp_chan_info.chan)
18561729 continue;
18571730 if (wl_ext_rsdb_band(cur_chan_info.band, tmp_chan_info.band) &&
....@@ -1884,7 +1757,8 @@
18841757 memset(&csa_arg, 0, sizeof(csa_arg));
18851758 csa_arg.mode = 1;
18861759 csa_arg.count = 3;
1887
- 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);
18881762 core_conflict = wl_ext_rsdb_core_conflict(apsta_params, cur_if);
18891763 if (core_conflict) {
18901764 WL_MSG(cur_if->ifname, "[%c] Skip CSA due to rsdb core conflict\n",
....@@ -2064,8 +1938,8 @@
20641938 if (target_if) {
20651939 memset(&cur_chan_info, 0, sizeof(struct wl_chan_info));
20661940 memset(&tgt_chan_info, 0, sizeof(struct wl_chan_info));
2067
- wl_ext_get_chan(cur_if->dev, &cur_chan_info);
2068
- 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);
20691943 if (apsta_params->rsdb && cur_chan_info.chan &&
20701944 wl_ext_rsdb_band(cur_chan_info.band, tgt_chan_info.band)) {
20711945 WL_MSG(cur_if->ifname, "[%c] keep on current channel %s-%d\n",
....@@ -2227,50 +2101,6 @@
22272101 return connecting;
22282102 }
22292103
2230
-bool
2231
-wl_ext_sta_handshaking(struct net_device *dev)
2232
-{
2233
- struct wl_if_info *cur_if = NULL;
2234
- bool connecting = FALSE;
2235
- int state;
2236
-
2237
- cur_if = wl_get_cur_if(dev);
2238
- if (!cur_if)
2239
- return FALSE;
2240
-
2241
- if (cur_if->ifmode != ISTA_MODE && cur_if->ifmode != IGC_MODE)
2242
- return FALSE;
2243
-
2244
- state = cur_if->conn_state;
2245
- if (state >= CONN_STATE_4WAY_M1 && state < CONN_STATE_CONNECTED) {
2246
- connecting = TRUE;
2247
- IAPSTA_TRACE(dev->name, "conn_state %d\n", state);
2248
- }
2249
-
2250
- return connecting;
2251
-}
2252
-
2253
-#ifdef DHD_LOSSLESS_ROAMING
2254
-int
2255
-wl_ext_any_sta_handshaking(struct dhd_pub *dhd)
2256
-{
2257
- struct wl_apsta_params *apsta_params = dhd->iapsta_params;
2258
- struct wl_if_info *cur_if;
2259
- int state = 0, i;
2260
-
2261
- for (i=0; i<MAX_IF_NUM; i++) {
2262
- cur_if = &apsta_params->if_info[i];
2263
- if (cur_if->dev && cur_if->ifmode == ISTA_MODE) {
2264
- state = cur_if->conn_state;
2265
- if (state >= CONN_STATE_4WAY_M1 && state < CONN_STATE_CONNECTED) {
2266
- return state;
2267
- }
2268
- }
2269
- }
2270
- return 0;
2271
-}
2272
-#endif /* DHD_LOSSLESS_ROAMING */
2273
-
22742104 #ifdef PROPTX_MAXCOUNT
22752105 int
22762106 wl_ext_get_wlfc_maxcount(struct dhd_pub *dhd, int ifidx)
....@@ -2313,7 +2143,7 @@
23132143 tmp_if = &apsta_params->if_info[i];
23142144 if (tmp_if->dev) {
23152145 memset(&chan_info, 0, sizeof(struct wl_chan_info));
2316
- wl_ext_get_chan(tmp_if->dev, &chan_info);
2146
+ wl_ext_get_chan(apsta_params, tmp_if->dev, &chan_info);
23172147 if (chan_info.band == WLC_BAND_5G || chan_info.band == WLC_BAND_6G) {
23182148 tmp_if->transit_maxcount = dhd->conf->proptx_maxcnt_5g;
23192149 ret = dhd_wlfc_update_maxcount(dhd, tmp_if->ifidx,
....@@ -2329,7 +2159,7 @@
23292159 for (i=0; i<MAX_IF_NUM; i++) {
23302160 tmp_if = &apsta_params->if_info[i];
23312161 if (tmp_if->dev) {
2332
- wl_ext_get_chan(tmp_if->dev, &chan_info);
2162
+ wl_ext_get_chan(apsta_params, tmp_if->dev, &chan_info);
23332163 if ((chan_info.chan == 0) || (chan_info.band == WLC_BAND_2G)) {
23342164 if (chan_info.chan == 0) {
23352165 tmp_if->transit_maxcount = WL_TXSTATUS_FREERUNCTR_MASK;
....@@ -2362,7 +2192,7 @@
23622192 if (!cur_if->dev || !wl_ext_master_if(cur_if))
23632193 continue;
23642194 memset(&chan_info, 0, sizeof(struct wl_chan_info));
2365
- wl_ext_get_chan(cur_if->dev, &chan_info);
2195
+ wl_ext_get_chan(apsta_params, cur_if->dev, &chan_info);
23662196 if (chan_info.chan && wl_ext_dfs_chan(&chan_info)) {
23672197 return cur_if;
23682198 }
....@@ -2386,7 +2216,7 @@
23862216 if (!cur_if->dev || !wl_ext_master_if(cur_if))
23872217 continue;
23882218 memset(&chan_info, 0, sizeof(struct wl_chan_info));
2389
- wl_ext_get_chan(cur_if->dev, &chan_info);
2219
+ wl_ext_get_chan(apsta_params, cur_if->dev, &chan_info);
23902220 if (chan_info.chan) {
23912221 cur_if->prev_channel = chan_info.chan;
23922222 cur_if->post_channel = post_channel;
....@@ -2409,8 +2239,6 @@
24092239 cur_if->chan_info.chan = cur_if->post_channel;
24102240 else
24112241 cur_if->chan_info.chan = cur_if->prev_channel;
2412
- if (wl_ext_associated(cur_if->dev))
2413
- wl_ext_if_down(apsta_params, cur_if);
24142242 wl_ext_if_up(apsta_params, cur_if, TRUE, 0);
24152243 cur_if->prev_channel = 0;
24162244 cur_if->post_channel = 0;
....@@ -2457,7 +2285,7 @@
24572285 tmp_if = &apsta_params->if_info[i];
24582286 if (tmp_if && tmp_if->ifmode == ifmode &&
24592287 wl_get_isam_status(tmp_if, IF_READY)) {
2460
- 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) {
24612289 WL_MSG(tmp_if->ifname, "re-enable channel %d\n", channel);
24622290 if (ifmode == IAP_MODE) {
24632291 wl_ext_if_down(apsta_params, tmp_if);
....@@ -2505,7 +2333,7 @@
25052333 }
25062334 }
25072335 if (cur_if->ifmode == ISTA_MODE) {
2508
- if (conf->war & SET_CHAN_INCONN && chan_info->chan) {
2336
+ if (conf->war & SET_CHAN_INCONN) {
25092337 chanspec_t fw_chspec;
25102338 IAPSTA_INFO(dev->name, "set channel %d\n", chan_info->chan);
25112339 wl_ext_set_chanspec(cur_if->dev, chan_info, &fw_chspec);
....@@ -2563,9 +2391,6 @@
25632391 cur_if->prio = PRIO_STA;
25642392 cur_if->vsdb = TRUE;
25652393 cur_if->prefix = 'S';
2566
-#ifdef WL_STATIC_IF
2567
- dhd_conf_preinit_ioctls_sta(dhd, ifidx);
2568
-#endif /* WL_STATIC_IF */
25692394 } else if (wl_iftype == WL_IF_TYPE_AP && cur_if->ifmode != IMESH_MODE) {
25702395 cur_if->ifmode = IAP_MODE;
25712396 cur_if->prio = PRIO_AP;
....@@ -2670,84 +2495,7 @@
26702495 return;
26712496 }
26722497 IAPSTA_ERROR(dev->name, "timer expired\n");
2673
- wl_ext_send_event_msg(dev, WLC_E_SET_SSID, WLC_E_STATUS_NO_NETWORKS, WLC_E_STATUS_SUCCESS);
2674
-}
2675
-
2676
-#ifdef WL_EXT_DISCONNECT_RECONNECT
2677
-static bool
2678
-wl_ext_disc_recon_retry(struct wl_apsta_params *apsta_params, struct wl_if_info *cur_if)
2679
-{
2680
- int sta_disc_recon_cnt = cur_if->sta_disc_recon_cnt;
2681
- struct osl_timespec *sta_disc_conn_ts = &cur_if->sta_disc_conn_ts;
2682
- struct osl_timespec cur_ts;
2683
- uint32 diff_ms = 0;
2684
- bool retry = FALSE;
2685
-
2686
- if (sta_disc_recon_cnt == 0)
2687
- osl_do_gettimeofday(sta_disc_conn_ts);
2688
-
2689
- osl_do_gettimeofday(&cur_ts);
2690
- diff_ms = osl_do_gettimediff(&cur_ts, sta_disc_conn_ts)/1000;
2691
-
2692
- IAPSTA_INFO(cur_if->ifname, "sta_disc_recon_cnt=%d, diff_ms = %dms\n",
2693
- sta_disc_recon_cnt, diff_ms);
2694
- if (sta_disc_recon_cnt >= STA_DISCONNECT_RECONNECT_MAX) {
2695
- if (diff_ms >= STA_DISCONNECT_RECONNECT_TIMEOUT) {
2696
- osl_do_gettimeofday(sta_disc_conn_ts);
2697
- cur_if->sta_disc_recon_cnt = 0;
2698
- retry = TRUE;
2699
- } else {
2700
- retry = FALSE;
2701
- }
2702
- } else {
2703
- retry = TRUE;
2704
- }
2705
-
2706
- if (retry)
2707
- cur_if->sta_disc_recon_cnt++;
2708
-
2709
- return retry;
2710
-}
2711
-#endif /* WL_EXT_DISCONNECT_RECONNECT */
2712
-
2713
-static void
2714
-wl_ext_update_assoc_info(struct net_device *dev, bool reassoc)
2715
-{
2716
-#ifndef WL_REASSOC_BCAST
2717
- dhd_pub_t *dhd = dhd_get_pub(dev);
2718
- struct wl_apsta_params *apsta_params = dhd->iapsta_params;
2719
- struct wl_chan_info chan_info;
2720
-#endif
2721
- struct bcm_cfg80211 *cfg = wl_get_cfg(dev);
2722
- wlcfg_assoc_info_t *assoc_info;
2723
- struct wl_if_info *cur_if;
2724
-
2725
- cur_if = wl_get_cur_if(dev);
2726
- if (cur_if) {
2727
- assoc_info = &cur_if->assoc_info;
2728
- assoc_info->reassoc = reassoc;
2729
- assoc_info->bssid_hint = false;
2730
-#ifdef WL_REASSOC_BCAST
2731
- assoc_info->chan_cnt = 0;
2732
- assoc_info->chanspecs[0] = 0;
2733
- memcpy(&assoc_info->bssid, &ether_bcast, ETHER_ADDR_LEN);
2734
-#else
2735
- assoc_info->chanspecs[0] = wl_ext_get_chanspec(dev, &chan_info);
2736
- if (assoc_info->chanspecs[0] && reassoc) {
2737
- assoc_info->chan_cnt = 1;
2738
- wldev_ioctl(dev, WLC_GET_BSSID, &cur_if->bssid, ETHER_ADDR_LEN, 0);
2739
- memcpy(&assoc_info->bssid, &cur_if->bssid, ETHER_ADDR_LEN);
2740
- } else {
2741
- assoc_info->chan_cnt = 0;
2742
- memcpy(&assoc_info->bssid, &ether_bcast, ETHER_ADDR_LEN);
2743
- }
2744
-#endif /* WL_REASSOC_BCAST */
2745
- if (!ETHER_ISBCAST(assoc_info->bssid))
2746
- assoc_info->targeted_join = true;
2747
- else
2748
- assoc_info->targeted_join = false;
2749
- wl_get_assoc_channels(cfg, dev, assoc_info);
2750
- }
2498
+ wl_ext_send_event_msg(dev, WLC_E_SET_SSID, WLC_E_STATUS_NO_NETWORKS);
27512499 }
27522500
27532501 static int
....@@ -2757,122 +2505,45 @@
27572505 struct wl_apsta_params *apsta_params = dhd->iapsta_params;
27582506 struct wl_if_info *cur_if;
27592507 struct bcm_cfg80211 *cfg = wl_get_cfg(dev);
2760
- struct osl_timespec cur_ts, *sta_conn_ts;
2761
- wlcfg_assoc_info_t *assoc_info;
2508
+ struct osl_timespec cur_ts, *sta_conn_ts = &apsta_params->sta_conn_ts;
27622509 uint32 diff_ms = 0;
27632510 int max_wait_time = 0, ret = 0;
2764
- bool connecting, handshaking, associated;
2765
- uint32 etype = ntoh32(e->event_type);
2766
- uint32 status = ntoh32(e->status);
2767
-
2768
- if (wl_get_drv_status(cfg, DISCONNECTING, dev)) {
2769
- WL_MSG(dev->name, "skip connect retry due to disconnecting\n");
2770
- return BCME_BADADDR;
2771
- }
2511
+ bool connecting = FALSE;
27722512
27732513 cur_if = wl_get_cur_if(dev);
27742514 if (!cur_if)
27752515 return ret;
2776
- sta_conn_ts = &cur_if->sta_conn_ts;
2777
- connecting = wl_ext_sta_connecting(dev);
2778
- handshaking = wl_ext_sta_handshaking(dev);
27792516
27802517 mutex_unlock(&apsta_params->in4way_sync);
27812518 mutex_lock(&cfg->connect_sync);
2519
+ connecting = wl_ext_sta_connecting(dev);
27822520
27832521 osl_do_gettimeofday(&cur_ts);
27842522 diff_ms = osl_do_gettimediff(&cur_ts, sta_conn_ts)/1000;
2785
- associated = wl_ext_associated(dev);
2786
- assoc_info = &cur_if->assoc_info;
27872523
27882524 if (connecting && diff_ms < STA_CONNECT_TIMEOUT &&
27892525 !wl_get_drv_status(cfg, DISCONNECTING, dev)) {
2526
+ uint32 etype = ntoh32(e->event_type);
2527
+ uint32 status = ntoh32(e->status);
27902528 if (etype == WLC_E_SET_SSID && (status == WLC_E_STATUS_NO_NETWORKS ||
27912529 status == WLC_E_STATUS_NO_ACK)) {
2792
- wl_timer_mod(dhd, &cur_if->reconnect_timer, 0);
2793
- if (assoc_info->reassoc && associated && !handshaking) {
2794
- /* There are two cases will come in to retry reassoc:
2795
- * 1) reconnect from wpa_supplicant
2796
- * 2) fw roam
2797
- */
2798
- if (associated)
2799
- 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) {
28002532 WL_MSG(dev->name, "retry reassoc\n");
2801
- if (wl_handle_reassoc(cfg, dev, assoc_info))
2802
- goto exit;
2803
- if (assoc_info->chan_cnt == 0)
2804
- max_wait_time = STA_CONNECT_FULL_CHAN_TIMEOUT;
2805
- else
2806
- max_wait_time = STA_RECONNECT_RETRY_TIMEOUT +
2807
- (WL_BCAST_SCAN_JOIN_ACTIVE_DWELL_TIME_MS * assoc_info->chan_cnt);
2808
- max_wait_time = min(max_wait_time, STA_CONNECT_FULL_CHAN_TIMEOUT);
2809
- }
2810
- else {
2811
- /* There is one case will come in to retry join:
2812
- * 1) connect from wpa_supplicant
2813
- */
2814
- WL_MSG(dev->name, "retry join\n");
2815
- if (associated) {
2816
- bzero(&cfg->last_roamed_addr, ETHER_ADDR_LEN);
2817
- 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;
28182541 }
2819
- if (wl_handle_join(cfg, dev, assoc_info))
2820
- goto exit;
2821
- if (assoc_info->chan_cnt == 0)
2822
- max_wait_time = STA_CONNECT_FULL_CHAN_TIMEOUT;
2823
- else
2824
- max_wait_time = STA_CONNECT_RETRY_TIMEOUT +
2825
- (WL_BCAST_SCAN_JOIN_ACTIVE_DWELL_TIME_MS * assoc_info->chan_cnt);
2826
- max_wait_time = min(max_wait_time, STA_CONNECT_FULL_CHAN_TIMEOUT);
28272542 }
2828
- IAPSTA_INFO(dev->name, "reconnect %dms later\n", max_wait_time);
2829
- wl_timer_mod(dhd, &cur_if->reconnect_timer, max_wait_time);
2543
+ wl_ext_mod_timer(&cur_if->reconnect_timer, 0, max_wait_time);
28302544 }
2831
- ret = BCME_ERROR;
2545
+ ret = -EAGAIN;
28322546 }
2833
-#ifdef WL_EXT_DISCONNECT_RECONNECT
2834
- else if (cur_if->conn_state >= CONN_STATE_CONNECTED &&
2835
- !wl_get_drv_status(cfg, DISCONNECTING, dev) &&
2836
- wl_get_drv_status(cfg, CONNECTED, dev)) {
2837
- if (etype == WLC_E_DISASSOC_IND || etype == WLC_E_DEAUTH_IND) {
2838
- /* There is one case will come in to retry join:
2839
- * 1) receive disconnect from AP after connected
2840
- */
2841
- if (wl_ext_disc_recon_retry(apsta_params, cur_if)) {
2842
- int wpa_auth = 0;
2843
- WL_MSG(dev->name, "retry join cnt %d\n", cur_if->sta_disc_recon_cnt);
2844
- bzero(&cfg->last_roamed_addr, ETHER_ADDR_LEN);
2845
- wl_ext_update_assoc_info(dev, FALSE);
2846
-#ifdef DHD_LOSSLESS_ROAMING
2847
- wl_ext_send_event_msg(dev, WLC_E_ROAM_PREP, WLC_E_STATUS_SUCCESS, WLC_E_REASON_DEAUTH);
2848
-#endif
2849
- if (wl_handle_join(cfg, dev, assoc_info))
2850
- goto exit;
2851
- wl_timer_mod(dhd, &cur_if->connect_timer, STA_CONNECT_TIMEOUT);
2852
- osl_do_gettimeofday(sta_conn_ts);
2853
- wl_ext_update_conn_state(dhd, cur_if->ifidx, CONN_STATE_CONNECTING);
2854
- wl_ext_iovar_getint(dev, "wpa_auth", &wpa_auth);
2855
- if (!(wpa_auth & (WPA3_AUTH_SAE_PSK|0x20))) {
2856
- if (assoc_info->chan_cnt == 0)
2857
- max_wait_time = STA_CONNECT_FULL_CHAN_TIMEOUT;
2858
- else
2859
- max_wait_time = STA_CONNECT_RETRY_TIMEOUT +
2860
- (WL_BCAST_SCAN_JOIN_ACTIVE_DWELL_TIME_MS * assoc_info->chan_cnt);
2861
- max_wait_time = min(max_wait_time, STA_CONNECT_FULL_CHAN_TIMEOUT);
2862
- IAPSTA_INFO(dev->name, "reconnect %dms later\n", max_wait_time);
2863
- wl_timer_mod(dhd, &cur_if->reconnect_timer, max_wait_time);
2864
- }
2865
- ret = BCME_ERROR;
2866
- }
2867
- else {
2868
- WL_MSG(dev->name, "out of retry cnt %d within %dms\n",
2869
- cur_if->sta_disc_recon_cnt, STA_DISCONNECT_RECONNECT_TIMEOUT);
2870
- }
2871
- }
2872
- }
2873
-#endif /* WL_EXT_DISCONNECT_RECONNECT */
2874
-
2875
-exit:
28762547 mutex_unlock(&cfg->connect_sync);
28772548 mutex_lock(&apsta_params->in4way_sync);
28782549
....@@ -2882,7 +2553,6 @@
28822553 static void
28832554 wl_ext_set_connect_retry(struct net_device *dev, void *context)
28842555 {
2885
- struct dhd_pub *dhd = dhd_get_pub(dev);
28862556 wlcfg_assoc_info_t *assoc_info = (wlcfg_assoc_info_t *)context;
28872557 struct wl_if_info *cur_if;
28882558 int max_wait_time;
....@@ -2892,20 +2562,18 @@
28922562 if (!cur_if)
28932563 return;
28942564
2895
- wl_timer_mod(dhd, &cur_if->reconnect_timer, 0);
2565
+ wl_ext_mod_timer(&cur_if->reconnect_timer, 0, 0);
28962566 memset(&cur_if->assoc_info, 0, sizeof(wlcfg_assoc_info_t));
28972567 wl_ext_iovar_getint(dev, "wpa_auth", &wpa_auth);
28982568 if (!(wpa_auth & (WPA3_AUTH_SAE_PSK|0x20) && assoc_info)) {
28992569 memcpy(&cur_if->bssid, assoc_info->bssid, ETHER_ADDR_LEN);
29002570 memcpy(&cur_if->assoc_info, assoc_info, sizeof(wlcfg_assoc_info_t));
2901
- if (assoc_info->chan_cnt == 0)
2902
- max_wait_time = STA_CONNECT_FULL_CHAN_TIMEOUT;
2903
- else if (assoc_info->reassoc)
2571
+ if (assoc_info->reassoc)
29042572 max_wait_time = STA_RECONNECT_RETRY_TIMEOUT;
29052573 else
29062574 max_wait_time = STA_CONNECT_RETRY_TIMEOUT;
29072575 IAPSTA_INFO(dev->name, "reconnect %dms later\n", max_wait_time);
2908
- wl_timer_mod(dhd, &cur_if->reconnect_timer, max_wait_time);
2576
+ wl_ext_mod_timer(&cur_if->reconnect_timer, 0, max_wait_time);
29092577 }
29102578 }
29112579 #endif /* WL_EXT_RECONNECT */
....@@ -3283,7 +2951,7 @@
32832951 #ifdef BCMDBUS
32842952 if (!rx)
32852953 #endif /* BCMDBUS */
3286
- wl_timer_mod(dhd, &cur_if->eapol_timer, 0);
2954
+ wl_ext_mod_timer(&cur_if->eapol_timer, 0, 0);
32872955
32882956 if (cur_if->pend_eapol_pkt) {
32892957 PKTCFREE(dhd->osh, cur_if->pend_eapol_pkt, TRUE);
....@@ -3342,7 +3010,7 @@
33423010 #else
33433011 interval = STA_EAPOL_TIMEOUT;
33443012 #endif /* EAPOL_DYNAMATIC_RESEND */
3345
- wl_timer_mod(dhd, &cur_if->eapol_timer, interval);
3013
+ wl_ext_mod_timer(&cur_if->eapol_timer, 0, interval);
33463014 IAPSTA_TRACE(cur_if->dev->name, "backup eapol pkt\n");
33473015 }
33483016 spin_unlock_irqrestore(&apsta_params->eapol_lock, flags);
....@@ -3376,7 +3044,7 @@
33763044 cur_if->eapol_max_intvl, STA_EAPOL_TIMEOUT,
33773045 cur_if->eapol_cnt);
33783046 #else
3379
- 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);
33803048 #endif /* EAPOL_DYNAMATIC_RESEND */
33813049 pending = TRUE;
33823050 }
....@@ -3412,106 +3080,11 @@
34123080 }
34133081 #endif /* EAPOL_RESEND */
34143082
3415
-#ifdef KEY_INSTALL_CHECK
3416
-static void
3417
-wl_ext_key_install_timeout(unsigned long data)
3418
-{
3419
- struct net_device *dev = (struct net_device *)data;
3420
- struct dhd_pub *dhd;
3421
- wl_event_msg_t msg;
3422
-
3423
- if (!dev) {
3424
- IAPSTA_ERROR("wlan", "dev is not ready\n");
3425
- return;
3426
- }
3427
-
3428
- dhd = dhd_get_pub(dev);
3429
-
3430
- bzero(&msg, sizeof(wl_event_msg_t));
3431
- IAPSTA_TRACE(dev->name, "timer expired\n");
3432
-
3433
- msg.ifidx = dhd_net2idx(dhd->info, dev);
3434
- msg.event_type = hton32(WLC_E_RESERVED);
3435
- msg.reason = hton32(ISAM_RC_KEY_INSTALL);
3436
- wl_ext_event_send(dhd->event_params, &msg, NULL);
3437
-}
3438
-
3439
-static void
3440
-wl_ext_key_install_handler(struct wl_if_info *cur_if,
3441
- const wl_event_msg_t *e, void *data)
3442
-{
3443
- struct net_device *dev = cur_if->dev;
3444
- struct dhd_pub *dhd = dhd_get_pub(dev);
3445
- struct bcm_cfg80211 *cfg = wl_get_cfg(dev);
3446
- uint32 etype = ntoh32(e->event_type);
3447
- uint32 reason = ntoh32(e->reason);
3448
- int err, key_installed = 0;
3449
-
3450
- if (etype == WLC_E_RESERVED && reason == ISAM_RC_KEY_INSTALL) {
3451
- if (cur_if->conn_state >= CONN_STATE_4WAY_M4 &&
3452
- !wl_get_drv_status(cfg, DISCONNECTING, dev) &&
3453
- wl_get_drv_status(cfg, CONNECTED, dev)) {
3454
- err = wldev_iovar_getint(dev, "buf_key_b4_m4_installed", &key_installed);
3455
- if (!err && !key_installed) {
3456
- cur_if->key_install_cnt++;
3457
- if (cur_if->key_install_cnt > STA_KEY_INSTALL_MAX) {
3458
- IAPSTA_ERROR(dev->name, "key not installed, send disconnect\n");
3459
-#ifdef EAPOL_RESEND
3460
- wl_ext_release_eapol_txpkt(dhd, cur_if->ifidx, FALSE);
3461
-#endif /* EAPOL_RESEND */
3462
- wl_ext_update_conn_state(dhd, cur_if->ifidx, CONN_STATE_CONNECTED);
3463
- wl_ext_ioctl(cur_if->dev, WLC_DISASSOC, NULL, 0, 1);
3464
- wl_timer_mod(dhd, &cur_if->key_install_timer, 0);
3465
- cur_if->key_install_cnt = 0;
3466
- } else {
3467
- IAPSTA_INFO(dev->name, "check key installed %dms later, cnt=%d\n",
3468
- STA_KEY_INSTALL_INTERVAL, cur_if->key_install_cnt);
3469
- wl_timer_mod(dhd, &cur_if->key_install_timer, STA_KEY_INSTALL_INTERVAL);
3470
- }
3471
- } else {
3472
-#ifdef EAPOL_RESEND
3473
- wl_ext_release_eapol_txpkt(dhd, cur_if->ifidx, FALSE);
3474
-#endif /* EAPOL_RESEND */
3475
- IAPSTA_INFO(dev->name, "key installed\n");
3476
- wl_timer_mod(dhd, &cur_if->connect_timer, 0);
3477
- wl_ext_update_conn_state(dhd, cur_if->ifidx, CONN_STATE_CONNECTED);
3478
- cur_if->key_install_cnt = 0;
3479
- }
3480
- }
3481
- }
3482
- return;
3483
-}
3484
-
3485
-static int
3486
-wl_key_installed(struct wl_if_info *cur_if)
3487
-{
3488
- struct net_device *dev = cur_if->dev;
3489
- dhd_pub_t *dhd = dhd_get_pub(dev);
3490
- int err, key_installed = 0;
3491
-
3492
- err = wldev_iovar_getint(dev, "buf_key_b4_m4_installed", &key_installed);
3493
- if (err) {
3494
- IAPSTA_INFO(dev->name, "not supported %d\n", err);
3495
- key_installed = 1;
3496
- } else if (key_installed)
3497
- IAPSTA_INFO(dev->name, "key installed\n");
3498
-
3499
- if (key_installed)
3500
- wl_timer_mod(dhd, &cur_if->key_install_timer, 0);
3501
- else {
3502
- IAPSTA_INFO(dev->name, "check key installed %dms later\n", STA_KEY_INSTALL_INTERVAL);
3503
- wl_timer_mod(dhd, &cur_if->key_install_timer, STA_KEY_INSTALL_INTERVAL);
3504
- }
3505
-
3506
- return key_installed;
3507
-}
3508
-#endif /* KEY_INSTALL_CHECK */
3509
-
35103083 #if defined(WL_CFG80211) && defined(SCAN_SUPPRESS)
35113084 static void
35123085 wl_ext_light_scan_prep(struct net_device *dev, void *scan_params, bool scan_v2)
35133086 {
3514
- wl_scan_params_v1_t *params = NULL;
3087
+ wl_scan_params_t *params = NULL;
35153088 wl_scan_params_v2_t *params_v2 = NULL;
35163089
35173090 if (!scan_params) {
....@@ -3523,7 +3096,7 @@
35233096 if (scan_v2) {
35243097 params_v2 = (wl_scan_params_v2_t *)scan_params;
35253098 } else {
3526
- params = (wl_scan_params_v1_t *)scan_params;
3099
+ params = (wl_scan_params_t *)scan_params;
35273100 }
35283101
35293102 if (params_v2) {
....@@ -3557,7 +3130,7 @@
35573130 tmp_if = &apsta_params->if_info[i];
35583131 if (tmp_if->dev && (tmp_if->tput_info.tput_tx + tmp_if->tput_info.tput_rx) > tput_sum) {
35593132 memset(chan_info, 0, sizeof(struct wl_chan_info));
3560
- wl_ext_get_chan(tmp_if->dev, chan_info);
3133
+ wl_ext_get_chan(apsta_params, tmp_if->dev, chan_info);
35613134 if (chan_info->chan) {
35623135 max_tput_if = tmp_if;
35633136 tput_sum = tmp_if->tput_info.tput_tx + tmp_if->tput_info.tput_rx;
....@@ -3696,6 +3269,7 @@
36963269 }
36973270 }
36983271 }
3272
+
36993273 }
37003274
37013275 static void
....@@ -3703,7 +3277,7 @@
37033277 enum wl_ext_status status)
37043278 {
37053279 struct net_device *dev = cur_if->dev;
3706
- 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;
37073281 int max_wait_time = 200, max_wait_cnt = 20;
37083282 int cur_conn_state = cur_if->conn_state;
37093283 uint32 diff_ms = 0;
....@@ -3753,7 +3327,8 @@
37533327
37543328 if (suspend) {
37553329 if (insuspend & AP_DOWN_IN_SUSPEND) {
3756
- 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);
37573332 if (cur_if->chan_info.chan)
37583333 wl_ext_if_down(apsta_params, cur_if);
37593334 }
....@@ -3776,7 +3351,7 @@
37763351
37773352 #ifdef TPUT_MONITOR
37783353 if (suspend)
3779
- wl_timer_mod(dhd, &apsta_params->monitor_timer, 0);
3354
+ wl_ext_mod_timer(&apsta_params->monitor_timer, 0, 0);
37803355 #endif /* TPUT_MONITOR */
37813356
37823357 for (i=0; i<MAX_IF_NUM; i++) {
....@@ -3795,7 +3370,7 @@
37953370
37963371 #ifdef TPUT_MONITOR
37973372 if (!suspend)
3798
- 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);
37993374 #endif /* TPUT_MONITOR */
38003375
38013376 return 0;
....@@ -3808,11 +3383,11 @@
38083383 struct wl_apsta_params *apsta_params = dhd->iapsta_params;
38093384 struct dhd_conf *conf = dhd->conf;
38103385 struct net_device *dev = cur_if->dev;
3811
- struct osl_timespec cur_ts, *sta_disc_ts = &cur_if->sta_disc_ts;
3812
- 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;
38133388 uint32 diff_ms = 0;
3814
- int ret = 0, suppressed = 0, wpa_auth = 0, max_wait_time = 0, key_installed = 1;
3815
- uint cur_conn_state, conn_state;
3389
+ int ret = 0, cur_conn_state;
3390
+ int suppressed = 0, wpa_auth = 0;
38163391 bool connecting = FALSE;
38173392 wl_event_msg_t *e = (wl_event_msg_t *)context;
38183393 #ifdef WL_CFG80211
....@@ -3863,8 +3438,7 @@
38633438 osl_do_gettimeofday(&cur_ts);
38643439 diff_ms = osl_do_gettimediff(&cur_ts, sta_conn_ts)/1000;
38653440 if (connecting && diff_ms <= STA_CONNECT_TIMEOUT) {
3866
- IAPSTA_ERROR(dev->name, "scan during connecting... %d\n",
3867
- cur_conn_state);
3441
+ IAPSTA_ERROR(dev->name, "connecting... %d\n", cur_conn_state);
38683442 ret = -EBUSY;
38693443 break;
38703444 }
....@@ -3878,15 +3452,24 @@
38783452 if (wl_get_drv_status(cfg, CONNECTING, dev) ||
38793453 (connecting && diff_ms <= STA_CONNECT_TIMEOUT) ||
38803454 (cur_if->empty_scan >= STA_EMPTY_SCAN_MAX)) {
3455
+ unsigned long flags = 0;
38813456 cur_if->empty_scan = 0;
3882
- WL_MSG(dev->name, "FAKE SCAN\n");
3883
- 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);
38843468 }
38853469 }
38863470 break;
38873471 case WL_EXT_STATUS_SCAN_COMPLETE:
3888
- if ((conf->war & FW_REINIT_EMPTY_SCAN) &&
3889
- cfg->bss_list->count == 0 && !p2p_scan(cfg)) {
3472
+ if ((conf->war & FW_REINIT_EMPTY_SCAN) && cfg->bss_list->count == 0) {
38903473 bool assoc;
38913474 osl_do_gettimeofday(&cur_ts);
38923475 diff_ms = osl_do_gettimediff(&cur_ts, sta_disc_ts)/1000;
....@@ -3911,26 +3494,18 @@
39113494 }
39123495 break;
39133496 #endif /* WL_CFG80211 */
3914
- case WL_EXT_STATUS_PRE_DISCONNECTING:
3497
+ case WL_EXT_STATUS_DISCONNECTING:
39153498 #ifdef EAPOL_RESEND
39163499 wl_ext_release_eapol_txpkt(dhd, cur_if->ifidx, FALSE);
39173500 #endif /* EAPOL_RESEND */
3918
-#ifdef KEY_INSTALL_CHECK
3919
- wl_timer_mod(dhd, &cur_if->key_install_timer, 0);
3920
-#endif /* KEY_INSTALL_CHECK */
3921
- wl_timer_mod(dhd, &cur_if->connect_timer, 0);
3501
+ wl_ext_mod_timer(&cur_if->connect_timer, 0, 0);
39223502 #if defined(WL_EXT_RECONNECT) && defined(WL_CFG80211)
3923
- wl_timer_mod(dhd, &cur_if->reconnect_timer, 0);
3503
+ wl_ext_mod_timer(&cur_if->reconnect_timer, 0, 0);
39243504 memset(&cur_if->assoc_info, 0, sizeof(wlcfg_assoc_info_t));
3925
-#ifdef WL_EXT_DISCONNECT_RECONNECT
3926
- cur_if->sta_disc_recon_cnt = 0;
3927
-#endif /* WL_EXT_DISCONNECT_RECONNECT */
39283505 #endif /* WL_EXT_RECONNECT && WL_CFG80211 */
39293506 #ifdef SCAN_SUPPRESS
39303507 apsta_params->scan_busy_cnt = 0;
39313508 #endif /* SCAN_SUPPRESS */
3932
- break;
3933
- case WL_EXT_STATUS_DISCONNECTING:
39343509 if (connecting) {
39353510 IAPSTA_ERROR(dev->name, "connect failed at %d\n", cur_conn_state);
39363511 wl_ext_update_conn_state(dhd, cur_if->ifidx, CONN_STATE_IDLE);
....@@ -3938,9 +3513,6 @@
39383513 if (action & STA_NO_BTC_IN4WAY) {
39393514 wl_set_btc_in4way(apsta_params, cur_if, status, FALSE);
39403515 }
3941
-#ifdef BTC_WAR
3942
- wl_ext_btc_config(cur_if->dev, FALSE);
3943
-#endif /* BTC_WAR */
39443516 if (action & STA_WAIT_DISCONNECTED) {
39453517 wl_wait_disconnect(apsta_params, cur_if, status);
39463518 wake_up_interruptible(&conf->event_complete);
....@@ -3951,11 +3523,8 @@
39513523 if (action & STA_REASSOC_RETRY) {
39523524 wl_ext_set_connect_retry(dev, context);
39533525 }
3954
-#ifdef WL_EXT_DISCONNECT_RECONNECT
3955
- cur_if->sta_disc_recon_cnt = 0;
3956
-#endif /* WL_EXT_DISCONNECT_RECONNECT */
39573526 #endif /* WL_EXT_RECONNECT && WL_CFG80211 */
3958
- wl_timer_mod(dhd, &cur_if->connect_timer, STA_CONNECT_TIMEOUT);
3527
+ wl_ext_mod_timer(&cur_if->connect_timer, 0, STA_CONNECT_TIMEOUT);
39593528 osl_do_gettimeofday(sta_conn_ts);
39603529 wl_ext_update_conn_state(dhd, cur_if->ifidx, CONN_STATE_CONNECTING);
39613530 if (action & STA_NO_BTC_IN4WAY) {
....@@ -3965,18 +3534,12 @@
39653534 case WL_EXT_STATUS_CONNECTED:
39663535 wl_ext_iovar_getint(dev, "wpa_auth", &wpa_auth);
39673536 if ((wpa_auth < WPA_AUTH_UNSPECIFIED) || (wpa_auth & WPA2_AUTH_FT)) {
3968
- wl_timer_mod(dhd, &cur_if->connect_timer, 0);
3537
+ wl_ext_mod_timer(&cur_if->connect_timer, 0, 0);
39693538 wl_ext_update_conn_state(dhd, cur_if->ifidx, CONN_STATE_CONNECTED);
3970
-#ifdef BTC_WAR
3971
- wl_ext_btc_config(cur_if->dev, TRUE);
3972
-#endif /* BTC_WAR */
3973
- max_wait_time = 0;
3974
- } else {
3975
- max_wait_time = STA_4WAY_TIMEOUT;
39763539 }
39773540 #if defined(WL_EXT_RECONNECT) && defined(WL_CFG80211)
3978
- wl_ext_update_assoc_info(dev, TRUE);
3979
- 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));
39803543 #endif /* WL_EXT_RECONNECT && WL_CFG80211 */
39813544 if (cur_if->ifmode == ISTA_MODE) {
39823545 dhd_conf_set_wme(dhd, cur_if->ifidx, 0);
....@@ -3984,31 +3547,6 @@
39843547 }
39853548 else if (cur_if->ifmode == IGC_MODE) {
39863549 dhd_conf_set_mchan_bw(dhd, WL_P2P_IF_CLIENT, -1);
3987
- }
3988
- break;
3989
- case WL_EXT_STATUS_ROAMED:
3990
- wl_ext_iovar_getint(dev, "wpa_auth", &wpa_auth);
3991
- if ((wpa_auth >= WPA_AUTH_UNSPECIFIED) && !(wpa_auth & WPA2_AUTH_FT)) {
3992
- wl_timer_mod(dhd, &cur_if->connect_timer, STA_CONNECT_TIMEOUT);
3993
- osl_do_gettimeofday(sta_conn_ts);
3994
- wl_ext_update_conn_state(dhd, cur_if->ifidx, CONN_STATE_CONNECTING);
3995
-#ifdef BTC_WAR
3996
- wl_ext_btc_config(cur_if->dev, TRUE);
3997
-#endif /* BTC_WAR */
3998
- max_wait_time = STA_4WAY_TIMEOUT;
3999
- } else {
4000
- max_wait_time = 0;
4001
- }
4002
-#if defined(WL_EXT_RECONNECT) && defined(WL_CFG80211)
4003
- wl_ext_update_assoc_info(dev, TRUE);
4004
- wl_timer_mod(dhd, &cur_if->reconnect_timer, max_wait_time);
4005
-#endif /* WL_EXT_RECONNECT && WL_CFG80211 */
4006
-#ifdef KEY_INSTALL_CHECK
4007
- wl_timer_mod(dhd, &cur_if->key_install_timer, 0);
4008
-#endif /* KEY_INSTALL_CHECK */
4009
- if (cur_if->ifmode == ISTA_MODE) {
4010
- dhd_conf_set_wme(dhd, cur_if->ifidx, 0);
4011
- wake_up_interruptible(&conf->event_complete);
40123550 }
40133551 break;
40143552 case WL_EXT_STATUS_RECONNECT:
....@@ -4025,15 +3563,9 @@
40253563 #ifdef EAPOL_RESEND
40263564 wl_ext_release_eapol_txpkt(dhd, cur_if->ifidx, FALSE);
40273565 #endif /* EAPOL_RESEND */
4028
-#ifdef KEY_INSTALL_CHECK
4029
- wl_timer_mod(dhd, &cur_if->key_install_timer, 0);
4030
-#endif /* KEY_INSTALL_CHECK */
40313566 #if defined(WL_EXT_RECONNECT) && defined(WL_CFG80211)
4032
- wl_timer_mod(dhd, &cur_if->reconnect_timer, 0);
3567
+ wl_ext_mod_timer(&cur_if->reconnect_timer, 0, 0);
40333568 memset(&cur_if->assoc_info, 0, sizeof(wlcfg_assoc_info_t));
4034
-#ifdef WL_EXT_DISCONNECT_RECONNECT
4035
- cur_if->sta_disc_recon_cnt = 0;
4036
-#endif /* WL_EXT_DISCONNECT_RECONNECT */
40373569 #endif /* WL_EXT_RECONNECT && WL_CFG80211 */
40383570 #ifdef SCAN_SUPPRESS
40393571 apsta_params->scan_busy_cnt = 0;
....@@ -4042,7 +3574,7 @@
40423574 !(ntoh16(e->flags) & WLC_EVENT_MSG_LINK)) {
40433575 apsta_params->linkdown_reason = ntoh32(e->reason);
40443576 }
4045
- wl_timer_mod(dhd, &cur_if->connect_timer, 0);
3577
+ wl_ext_mod_timer(&cur_if->connect_timer, 0, 0);
40463578 if (connecting) {
40473579 IAPSTA_ERROR(dev->name, "connect failed at %d\n", cur_conn_state);
40483580 }
....@@ -4050,37 +3582,23 @@
40503582 if (action & STA_NO_BTC_IN4WAY) {
40513583 wl_set_btc_in4way(apsta_params, cur_if, status, FALSE);
40523584 }
4053
-#ifdef BTC_WAR
4054
- wl_ext_btc_config(cur_if->dev, FALSE);
4055
-#endif /* BTC_WAR */
40563585 osl_do_gettimeofday(sta_disc_ts);
40573586 wake_up_interruptible(&conf->event_complete);
40583587 break;
40593588 case WL_EXT_STATUS_ADD_KEY:
4060
- conn_state = CONN_STATE_ADD_KEY;
4061
- wl_timer_mod(dhd, &cur_if->connect_timer, 0);
4062
-#if defined(WL_EXT_RECONNECT) && defined(WL_CFG80211)
4063
- wl_timer_mod(dhd, &cur_if->reconnect_timer, 0);
4064
-#endif /* WL_EXT_RECONNECT && WL_CFG80211 */
4065
-#ifdef KEY_INSTALL_CHECK
4066
- key_installed = wl_key_installed(cur_if);
4067
-#endif /* KEY_INSTALL_CHECK */
4068
- if (key_installed)
4069
- conn_state = CONN_STATE_CONNECTED;
4070
- wl_ext_update_conn_state(dhd, cur_if->ifidx, conn_state);
4071
- IAPSTA_INFO(dev->name, "WPA 4-WAY complete %d => %d\n",
4072
- 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);
40733591 #ifdef EAPOL_RESEND
4074
- if (key_installed)
4075
- wl_ext_release_eapol_txpkt(dhd, cur_if->ifidx, FALSE);
3592
+ wl_ext_release_eapol_txpkt(dhd, cur_if->ifidx, FALSE);
40763593 #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 */
40773597 if (action & STA_NO_BTC_IN4WAY) {
40783598 wl_set_btc_in4way(apsta_params, cur_if, status, FALSE);
40793599 }
4080
-#ifdef BTC_WAR
4081
- wl_ext_btc_config(cur_if->dev, TRUE);
4082
-#endif /* BTC_WAR */
40833600 wake_up_interruptible(&conf->event_complete);
3601
+ IAPSTA_INFO(dev->name, "WPA 4-WAY complete %d\n", cur_conn_state);
40843602 break;
40853603 default:
40863604 IAPSTA_INFO(dev->name, "Unknown action=0x%x, status=%d\n", action, status);
....@@ -4096,8 +3614,8 @@
40963614 {
40973615 struct wl_apsta_params *apsta_params = dhd->iapsta_params;
40983616 struct net_device *dev = cur_if->dev;
4099
- struct osl_timespec cur_ts, *ap_disc_sta_ts = &cur_if->ap_disc_sta_ts;
4100
- 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;
41013619 uint32 diff_ms = 0, timeout, max_wait_time = 300;
41023620 int ret = 0, suppressed = 0;
41033621 u8* mac_addr = context;
....@@ -4118,12 +3636,12 @@
41183636 break;
41193637 case WL_EXT_STATUS_AP_ENABLING:
41203638 #ifdef RESTART_AP_WAR
4121
- 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);
41223640 #endif /* RESTART_AP_WAR */
41233641 break;
41243642 case WL_EXT_STATUS_AP_ENABLED:
41253643 #ifdef RESTART_AP_WAR
4126
- wl_timer_mod(dhd, &cur_if->restart_ap_timer, 0);
3644
+ wl_ext_mod_timer(&cur_if->restart_ap_timer, 0, 0);
41273645 #endif /* RESTART_AP_WAR */
41283646 if (cur_if->ifmode == IAP_MODE)
41293647 dhd_conf_set_wme(dhd, cur_if->ifidx, 1);
....@@ -4132,7 +3650,7 @@
41323650 break;
41333651 case WL_EXT_STATUS_AP_DISABLING:
41343652 #ifdef RESTART_AP_WAR
4135
- wl_timer_mod(dhd, &cur_if->restart_ap_timer, 0);
3653
+ wl_ext_mod_timer(&cur_if->restart_ap_timer, 0, 0);
41363654 #endif /* RESTART_AP_WAR */
41373655 break;
41383656 case WL_EXT_STATUS_DELETE_STA:
....@@ -4150,13 +3668,13 @@
41503668 }
41513669 if (wait) {
41523670 IAPSTA_INFO(dev->name, "status=%d, ap_recon_sta=%d, waiting %dms ...\n",
4153
- status, cur_if->ap_recon_sta, max_wait_time);
3671
+ status, apsta_params->ap_recon_sta, max_wait_time);
41543672 mutex_unlock(&apsta_params->in4way_sync);
4155
- timeout = wait_event_interruptible_timeout(cur_if->ap_recon_sta_event,
4156
- 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));
41573675 mutex_lock(&apsta_params->in4way_sync);
41583676 IAPSTA_INFO(dev->name, "status=%d, ap_recon_sta=%d, timeout=%d\n",
4159
- status, cur_if->ap_recon_sta, timeout);
3677
+ status, apsta_params->ap_recon_sta, timeout);
41603678 if (timeout > 0) {
41613679 IAPSTA_INFO(dev->name, "skip delete STA %pM\n", mac_addr);
41623680 ret = -1;
....@@ -4164,8 +3682,8 @@
41643682 }
41653683 } else {
41663684 IAPSTA_INFO(dev->name, "status=%d, ap_recon_sta=%d => 0\n",
4167
- status, cur_if->ap_recon_sta);
4168
- cur_if->ap_recon_sta = FALSE;
3685
+ status, apsta_params->ap_recon_sta);
3686
+ apsta_params->ap_recon_sta = FALSE;
41693687 if (cur_if->ifmode == IGO_MODE)
41703688 wl_ext_update_conn_state(dhd, cur_if->ifidx, CONN_STATE_IDLE);
41713689 }
....@@ -4174,10 +3692,10 @@
41743692 case WL_EXT_STATUS_STA_DISCONNECTED:
41753693 if (action & AP_WAIT_STA_RECONNECT) {
41763694 IAPSTA_INFO(dev->name, "latest disc STA %pM ap_recon_sta=%d\n",
4177
- ap_disc_sta_bssid, cur_if->ap_recon_sta);
3695
+ ap_disc_sta_bssid, apsta_params->ap_recon_sta);
41783696 osl_do_gettimeofday(ap_disc_sta_ts);
41793697 memcpy(ap_disc_sta_bssid, mac_addr, ETHER_ADDR_LEN);
4180
- cur_if->ap_recon_sta = FALSE;
3698
+ apsta_params->ap_recon_sta = FALSE;
41813699 }
41823700 break;
41833701 case WL_EXT_STATUS_STA_CONNECTED:
....@@ -4187,11 +3705,11 @@
41873705 if (diff_ms < max_wait_time &&
41883706 !memcmp(ap_disc_sta_bssid, mac_addr, ETHER_ADDR_LEN)) {
41893707 IAPSTA_INFO(dev->name, "status=%d, ap_recon_sta=%d => 1\n",
4190
- status, cur_if->ap_recon_sta);
4191
- cur_if->ap_recon_sta = TRUE;
4192
- 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);
41933711 } else {
4194
- cur_if->ap_recon_sta = FALSE;
3712
+ apsta_params->ap_recon_sta = FALSE;
41953713 }
41963714 }
41973715 break;
....@@ -4369,157 +3887,6 @@
43693887 return maxassoc;
43703888 }
43713889
4372
-static int
4373
-dev_wlc_ioctl(struct net_device *dev, int cmd, void *arg, int len)
4374
-{
4375
- struct dhd_pub *dhd = dhd_get_pub(dev);
4376
- dhd_ioctl_t ioc;
4377
- int8 index;
4378
- int ret;
4379
-
4380
- memset(&ioc, 0, sizeof(ioc));
4381
- ioc.cmd = cmd;
4382
- ioc.buf = arg;
4383
- ioc.len = len;
4384
-
4385
- index = dhd_net2idx(dhd->info, dev);
4386
- if (index == DHD_BAD_IF) {
4387
- IAPSTA_ERROR(dev->name, "Bad ifidx from dev\n");
4388
- return -ENODEV;
4389
- }
4390
- ret = dhd_ioctl_process(dhd, index, &ioc, arg);
4391
-
4392
- return ret;
4393
-}
4394
-
4395
-static void
4396
-wl_ampdu_dump(struct net_device *dev)
4397
-{
4398
- struct dhd_pub *dhd = dhd_get_pub(dev);
4399
- struct wl_apsta_params *apsta_params = dhd->iapsta_params;
4400
- char *ioctl_buf = apsta_params->ioctl_buf, *buf = NULL;
4401
- char *tx_pch_start, *tx_pch_end, *rx_pch_start, *rx_pch_end;
4402
- int ret = 0, max_len, tx_len, rx_len;
4403
-
4404
- if (!(android_msg_level & ANDROID_AMPDU_LEVEL))
4405
- return;
4406
-
4407
- if (!ioctl_buf)
4408
- return;
4409
-
4410
- memset(ioctl_buf, 0, WL_DUMP_BUF_LEN);
4411
- ret = bcm_mkiovar("dump", "ampdu", strlen("ampdu"), ioctl_buf, WL_DUMP_BUF_LEN);
4412
- if (ret == 0) {
4413
- goto exit;
4414
- }
4415
- ret = dev_wlc_ioctl(dev, WLC_GET_VAR, (void *)ioctl_buf, WL_DUMP_BUF_LEN);
4416
- if (ret) {
4417
- goto exit;
4418
- }
4419
-
4420
- buf = kmalloc(WLC_IOCTL_MEDLEN, GFP_KERNEL);
4421
- if (buf == NULL) {
4422
- IAPSTA_ERROR(dev->name, "Failed to allocate buffer of %d bytes\n", WLC_IOCTL_MEDLEN);
4423
- goto exit;
4424
- }
4425
- memset(buf, 0, WLC_IOCTL_MEDLEN);
4426
- ret = bcm_mkiovar("dump_clear", "ampdu", strlen("ampdu"), buf, WLC_IOCTL_MEDLEN);
4427
- if (ret == 0) {
4428
- goto exit;
4429
- }
4430
- ret = dev_wlc_ioctl(dev, WLC_SET_VAR, (void *)buf, WLC_IOCTL_MEDLEN);
4431
- if (ret) {
4432
- goto exit;
4433
- }
4434
-
4435
- tx_pch_start = strstr(ioctl_buf, "TX MCS");
4436
- tx_pch_end = strstr(ioctl_buf, "HEMU");
4437
- rx_pch_start = strstr(ioctl_buf, "RX MCS");
4438
- rx_pch_end = strstr(ioctl_buf, "RX MCS SGI");
4439
- max_len = (tx_pch_end-tx_pch_start) + (rx_pch_end-rx_pch_start);
4440
- if (max_len > (WLC_IOCTL_MEDLEN-1))
4441
- goto exit;
4442
-
4443
- tx_len = tx_pch_end - tx_pch_start;
4444
- rx_len = rx_pch_end - rx_pch_start;
4445
-
4446
- memset(buf, 0, WLC_IOCTL_MEDLEN);
4447
- memcpy(buf, tx_pch_start, tx_len);
4448
- memcpy(buf+tx_len, rx_pch_start, rx_len);
4449
- WL_MSG(dev->name,"\n%s\n", buf);
4450
-
4451
-exit:
4452
- if (buf)
4453
- kfree(buf);
4454
-}
4455
-
4456
-static void
4457
-wl_btc_dump(struct net_device *dev)
4458
-{
4459
- struct dhd_pub *dhd = dhd_get_pub(dev);
4460
- int ret, val;
4461
-
4462
- if (!(android_msg_level & ANDROID_BTC_LEVEL))
4463
- return;
4464
-
4465
- ret = dhd_conf_reg2args(dhd, "btc_params", FALSE, 15, &val);
4466
- if (!ret)
4467
- WL_MSG(dev->name,"btc_params15=%d\n", val);
4468
-}
4469
-
4470
-static void
4471
-wl_tvpm_dump(struct net_device *dev)
4472
-{
4473
- struct dhd_pub *dhd = dhd_get_pub(dev);
4474
- struct wl_apsta_params *apsta_params = dhd->iapsta_params;
4475
- wl_tvpm_req_t* tvpm_req = NULL;
4476
- size_t reqlen = sizeof(wl_tvpm_req_t) + sizeof(wl_tvpm_status_t);
4477
- uint8 *outbuf = apsta_params->ioctl_buf;
4478
- size_t outlen = WLC_IOCTL_MEDLEN;
4479
- wl_tvpm_status_t* status;
4480
- int ret, phy_temp = 0;
4481
- bool tvpm = FALSE, sense = FALSE;
4482
-
4483
- if (!(android_msg_level & ANDROID_TVPM_LEVEL))
4484
- return;
4485
-
4486
- tvpm_req = kmalloc(reqlen, GFP_KERNEL);
4487
- if (tvpm_req == NULL) {
4488
- IAPSTA_ERROR(dev->name, "MALLOC failed\n");
4489
- goto exit;
4490
- }
4491
- memset(tvpm_req, 0, reqlen);
4492
-
4493
- tvpm_req->version = TVPM_REQ_VERSION_1;
4494
- tvpm_req->length = reqlen;
4495
- tvpm_req->req_type = WL_TVPM_REQ_STATUS;
4496
- ret = wldev_iovar_getbuf(dev, "tvpm", tvpm_req, reqlen, outbuf, outlen, NULL);
4497
- status = (wl_tvpm_status_t*)outbuf;
4498
- if (!ret && status->enable) {
4499
- tvpm = TRUE;
4500
- } else {
4501
- ret = wldev_iovar_getbuf(dev, "phy_tempsense", &phy_temp, sizeof(phy_temp),
4502
- outbuf, outlen, NULL);
4503
- if (!ret) {
4504
- phy_temp = dtoh32(*(int*)outbuf);
4505
- sense = TRUE;
4506
- }
4507
- }
4508
-
4509
- if (tvpm) {
4510
- WL_MSG(dev->name,"temp=%3d, duty=%3d, pwrbko=%d, chains=%d\n",
4511
- status->temp, status->tx_dutycycle, status->tx_power_backoff,
4512
- status->num_active_chains);
4513
- }
4514
- else if (sense) {
4515
- WL_MSG(dev->name,"phy_temp=%3d\n", phy_temp);
4516
- }
4517
-
4518
-exit:
4519
- if (tvpm_req)
4520
- kfree(tvpm_req);
4521
-}
4522
-
45233890 static void
45243891 wl_phy_rssi_ant(struct net_device *dev, struct ether_addr *mac,
45253892 char *rssi_buf, int len)
....@@ -4570,14 +3937,17 @@
45703937 static void
45713938 wl_sta_info_dump(struct net_device *dev, struct ether_addr *mac)
45723939 {
4573
- struct dhd_pub *dhd = dhd_get_pub(dev);
4574
- struct wl_apsta_params *apsta_params = dhd->iapsta_params;
4575
- void *buf = apsta_params->ioctl_buf;
3940
+ void *buf = NULL;
45763941 sta_info_v4_t *sta = NULL;
45773942 char rssi_buf[16];
45783943 int ret;
45793944 s32 rate = 0;
45803945
3946
+ buf = kmalloc(WLC_IOCTL_MEDLEN, GFP_KERNEL);
3947
+ if (buf == NULL) {
3948
+ IAPSTA_ERROR(dev->name, "MALLOC failed\n");
3949
+ goto exit;
3950
+ }
45813951 memset(rssi_buf, 0, sizeof(rssi_buf));
45823952 wl_phy_rssi_ant(dev, mac, rssi_buf, sizeof(rssi_buf));
45833953 ret = wldev_iovar_getbuf(dev, "sta_info", (const void*)mac,
....@@ -4585,27 +3955,22 @@
45853955 if (ret == 0) {
45863956 sta = (sta_info_v4_t *)buf;
45873957 }
4588
- if (sta == NULL || (sta->ver != WL_STA_VER_4 && sta->ver != WL_STA_VER_5 &&
4589
- sta->ver != WL_STA_VER_6)) {
3958
+ if (sta == NULL || (sta->ver != WL_STA_VER_4 && sta->ver != WL_STA_VER_5)) {
45903959 wldev_ioctl_get(dev, WLC_GET_RATE, &rate, sizeof(rate));
45913960 rate = dtoh32(rate);
45923961 WL_MSG(dev->name,
45933962 "mac=%pM, rssi=%s, tx_rate:%4d%2s\n",
45943963 mac, rssi_buf, rate/2, (rate & 1) ? ".5" : "");
45953964 } else {
4596
- if (dtoh32(sta->rx_rate) != -1) {
4597
- WL_MSG(dev->name,
4598
- "mac=%pM, rssi=%s, tx_rate:%4d.%d, rx_rate:%4d.%d\n",
4599
- mac, rssi_buf,
4600
- dtoh32(sta->tx_rate)/1000, ((dtoh32(sta->tx_rate)/100)%10),
4601
- dtoh32(sta->rx_rate)/1000, ((dtoh32(sta->rx_rate)/100)%10));
4602
- } else {
4603
- WL_MSG(dev->name,
4604
- "mac=%pM, rssi=%s, tx_rate:%4d.%d, rx_rate:%4d\n",
4605
- mac, rssi_buf,
4606
- dtoh32(sta->tx_rate)/1000, ((dtoh32(sta->tx_rate)/100)%10),
4607
- dtoh32(sta->rx_rate));
4608
- }
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);
46093974 }
46103975 }
46113976
....@@ -4698,11 +4063,10 @@
46984063 }
46994064
47004065 static void
4701
-wl_tput_monitor_handler(struct wl_if_info *cur_if,
4702
- 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)
47034068 {
4704
- struct dhd_pub *dhd = dhd_get_pub(cur_if->dev);
4705
- struct wl_apsta_params *apsta_params = dhd->iapsta_params;
4069
+ struct dhd_pub *dhd = apsta_params->dhd;
47064070 wl_tput_info_t *tput_info;
47074071 struct wl_if_info *tmp_if;
47084072 #ifdef WLDWDS
....@@ -4759,12 +4123,8 @@
47594123 monitor = TRUE;
47604124 }
47614125 }
4762
- if (monitor) {
4763
- wl_btc_dump(cur_if->dev);
4764
- wl_tvpm_dump(cur_if->dev);
4765
- wl_ampdu_dump(cur_if->dev);
4766
- wl_timer_mod(dhd, &apsta_params->monitor_timer, timeout);
4767
- }
4126
+ if (monitor)
4127
+ wl_ext_mod_timer(&apsta_params->monitor_timer, 0, timeout);
47684128 #ifdef BCMSDIO
47694129 if (apsta_params->tput_sum >= dhd->conf->doflow_tput_thresh && dhd_doflow) {
47704130 dhd_doflow = FALSE;
....@@ -4780,9 +4140,9 @@
47804140 else if (cur_if->ifmode == ISTA_MODE || cur_if->ifmode == IGC_MODE) {
47814141 if (etype == WLC_E_LINK) {
47824142 if (flags & WLC_EVENT_MSG_LINK) {
4783
- wl_timer_mod(dhd, &apsta_params->monitor_timer, timeout);
4143
+ wl_ext_mod_timer(&apsta_params->monitor_timer, 0, timeout);
47844144 } else if (!wl_ext_iapsta_other_if_enabled(cur_if->dev)) {
4785
- wl_timer_mod(dhd, &apsta_params->monitor_timer, 0);
4145
+ wl_ext_mod_timer(&apsta_params->monitor_timer, 0, 0);
47864146 }
47874147 }
47884148 }
....@@ -4790,22 +4150,33 @@
47904150 if ((etype == WLC_E_SET_SSID && status == WLC_E_STATUS_SUCCESS) ||
47914151 (etype == WLC_E_LINK && status == WLC_E_STATUS_SUCCESS &&
47924152 reason == WLC_E_REASON_INITIAL_ASSOC)) {
4793
- wl_timer_mod(dhd, &apsta_params->monitor_timer, timeout);
4153
+ wl_ext_mod_timer(&apsta_params->monitor_timer, 0, timeout);
47944154 } else if ((etype == WLC_E_LINK && reason == WLC_E_LINK_BSSCFG_DIS) ||
47954155 (etype == WLC_E_LINK && status == WLC_E_STATUS_SUCCESS &&
47964156 reason == WLC_E_REASON_DEAUTH)) {
47974157 if (!wl_ext_iapsta_other_if_enabled(cur_if->dev)) {
4798
- wl_timer_mod(dhd, &apsta_params->monitor_timer, 0);
4158
+ wl_ext_mod_timer(&apsta_params->monitor_timer, 0, 0);
47994159 }
48004160 } else if ((etype == WLC_E_ASSOC_IND || etype == WLC_E_REASSOC_IND) &&
48014161 reason == DOT11_SC_SUCCESS) {
4802
- wl_timer_mod(dhd, &apsta_params->monitor_timer, timeout);
4162
+ wl_ext_mod_timer(&apsta_params->monitor_timer, 0, timeout);
48034163 }
48044164 }
48054165 }
48064166 #endif /* TPUT_MONITOR */
48074167
48084168 #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
+
48094180 static bool
48104181 wl_ext_max_prio_if(struct wl_apsta_params *apsta_params,
48114182 struct wl_if_info *cur_if)
....@@ -4860,7 +4231,7 @@
48604231 if (apsta_params->acs & ACS_DRV_BIT) {
48614232 mutex_lock(&apsta_params->usr_sync);
48624233 memset(&chan_info, 0, sizeof(struct wl_chan_info));
4863
- wl_ext_get_chan(cur_if->dev, &chan_info);
4234
+ wl_ext_get_chan(apsta_params, cur_if->dev, &chan_info);
48644235 if (chan_info.chan) {
48654236 if (chan_info.band == WLC_BAND_5G)
48664237 cur_if->chan_info.chan = cur_if->escan->best_5g_ch;
....@@ -4869,7 +4240,7 @@
48694240 wl_ext_move_cur_channel(apsta_params, cur_if);
48704241 if (!wl_ext_same_chan(&cur_if->chan_info, &chan_info)) {
48714242 WL_MSG(cur_if->dev->name, "move channel %s-%d => %s-%d\n",
4872
- WLCBAND2STR(chan_info.band), chan_info.chan,
4243
+ WLCBAND2STR(chan_info->band), chan_info.chan,
48734244 WLCBAND2STR(cur_if->chan_info.band), cur_if->chan_info.chan);
48744245 wl_ext_if_down(apsta_params, cur_if);
48754246 wl_ext_move_other_channel(apsta_params, cur_if);
....@@ -4918,34 +4289,34 @@
49184289 (etype == WLC_E_LINK && status == WLC_E_STATUS_SUCCESS &&
49194290 reason == WLC_E_REASON_INITIAL_ASSOC)) {
49204291 // Link up
4921
- wl_timer_mod(dhd, &cur_if->acs_timer, acs_tmo*1000);
4292
+ wl_ext_mod_timer_pending(&cur_if->acs_timer, acs_tmo, 0);
49224293 }
49234294 else if ((etype == WLC_E_LINK && reason == WLC_E_LINK_BSSCFG_DIS) ||
49244295 (etype == WLC_E_LINK && status == WLC_E_STATUS_SUCCESS &&
49254296 reason == WLC_E_REASON_DEAUTH)) {
49264297 // Link down
4927
- wl_timer_mod(dhd, &cur_if->acs_timer, 0);
4298
+ wl_ext_mod_timer(&cur_if->acs_timer, 0, 0);
49284299 cur_if->escan->autochannel = 0;
49294300 }
49304301 else if ((etype == WLC_E_ASSOC_IND || etype == WLC_E_REASSOC_IND) &&
49314302 reason == DOT11_SC_SUCCESS) {
49324303 // external STA connected
4933
- wl_timer_mod(dhd, &cur_if->acs_timer, 0);
4304
+ wl_ext_mod_timer(&cur_if->acs_timer, 0, 0);
49344305 }
49354306 else if (etype == WLC_E_DISASSOC_IND ||
49364307 etype == WLC_E_DEAUTH_IND ||
49374308 (etype == WLC_E_DEAUTH && reason != DOT11_RC_RESERVED)) {
49384309 // external STA disconnected
4939
- wl_timer_mod(dhd, &cur_if->acs_timer, acs_tmo*1000);
4310
+ wl_ext_mod_timer_pending(&cur_if->acs_timer, acs_tmo, 0);
49404311 }
49414312 else if (etype == WLC_E_RESERVED && reason == ISAM_RC_AP_ACS) {
49424313 // acs_tmo expired
49434314 if (!wl_ext_assoclist_num(cur_if->dev) &&
49444315 !wl_ext_max_prio_if(apsta_params, cur_if)) {
49454316 wl_ext_acs_scan(apsta_params, cur_if);
4946
- wl_timer_mod(dhd, &cur_if->acs_timer, acs_tmo*1000);
4317
+ wl_ext_mod_timer(&cur_if->acs_timer, acs_tmo, 0);
49474318 } else {
4948
- wl_timer_mod(dhd, &cur_if->acs_timer, 0);
4319
+ wl_ext_mod_timer(&cur_if->acs_timer, 0, 0);
49494320 }
49504321 }
49514322 else if (((etype == WLC_E_ESCAN_RESULT && status == WLC_E_STATUS_SUCCESS) ||
....@@ -4959,7 +4330,7 @@
49594330 !wl_ext_max_prio_if(apsta_params, cur_if)) {
49604331 wl_ext_acs(apsta_params, cur_if);
49614332 } else {
4962
- wl_timer_mod(dhd, &cur_if->acs_timer, 0);
4333
+ wl_ext_mod_timer(&cur_if->acs_timer, 0, 0);
49634334 }
49644335 }
49654336 }
....@@ -4969,7 +4340,7 @@
49694340 wl_acs_detach(struct wl_if_info *cur_if)
49704341 {
49714342 IAPSTA_TRACE(cur_if->dev->name, "Enter\n");
4972
- wl_timer_deregister(cur_if->dev, &cur_if->acs_timer);
4343
+ del_timer_sync(&cur_if->acs_timer);
49734344 if (cur_if->escan) {
49744345 cur_if->escan = NULL;
49754346 }
....@@ -4980,7 +4351,7 @@
49804351 {
49814352 IAPSTA_TRACE(cur_if->dev->name, "Enter\n");
49824353 cur_if->escan = dhd->escan;
4983
- 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);
49844355 }
49854356 #endif /* ACS_MONITOR */
49864357
....@@ -5023,7 +4394,7 @@
50234394 WL_MSG(cur_if->ifname, "restart AP\n");
50244395 wl_ext_if_down(apsta_params, cur_if);
50254396 wl_ext_if_up(apsta_params, cur_if, FALSE, 1);
5026
- 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);
50274398 } else {
50284399 WL_MSG(cur_if->ifname, "skip restart AP\n");
50294400 }
....@@ -5112,12 +4483,20 @@
51124483 {
51134484 struct dhd_pub *dhd = dhd_get_pub(cur_if->dev);
51144485 struct wl_apsta_params *apsta_params = dhd->iapsta_params;
5115
- char *iovar_buf = apsta_params->ioctl_buf;
4486
+ char *iovar_buf = NULL;
51164487 uint32 corerev = 0;
51174488 wl_cnt_info_t *cntinfo;
51184489 uint16 ver;
51194490 int ret = 0;
51204491
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);
51214500 ret = wldev_iovar_getbuf(cur_if->dev, "counters", NULL, 0,
51224501 iovar_buf, WLC_IOCTL_MEDLEN, NULL);
51234502 if (unlikely(ret)) {
....@@ -5130,10 +4509,10 @@
51304509 cntinfo->datalen = dtoh16(cntinfo->datalen);
51314510 ver = cntinfo->version;
51324511 CHK_CNTBUF_DATALEN(iovar_buf, WLC_IOCTL_MEDLEN);
5133
- if (ver > WL_CNT_VERSION_XTLV) {
4512
+ if (ver > WL_CNT_T_VERSION) {
51344513 IAPSTA_ERROR(cur_if->ifname,
51354514 "Incorrect version of counters struct: expected %d; got %d\n",
5136
- WL_CNT_VERSION_XTLV, ver);
4515
+ WL_CNT_T_VERSION, ver);
51374516 goto exit;
51384517 }
51394518
....@@ -5161,6 +4540,9 @@
51614540 }
51624541
51634542 exit:
4543
+ if (iovar_buf)
4544
+ kfree(iovar_buf);
4545
+
51644546 return ret;
51654547 }
51664548 #endif /* RESET_AP_WAR | RXF0OVFL_REINIT_WAR */
....@@ -5207,7 +4589,7 @@
52074589 reason == WLC_E_REASON_INITIAL_ASSOC)) {
52084590 // Link up
52094591 wl_ext_counters_update(cur_if, ISAM_RC_AP_RESET);
5210
- 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);
52114593 }
52124594 else if (etype == WLC_E_RESERVED && reason == ISAM_RC_AP_RESET) {
52134595 txbcnfrm = cur_if->txbcnfrm;
....@@ -5220,7 +4602,7 @@
52204602 wl_ext_if_up(apsta_params, cur_if, FALSE, 500);
52214603 }
52224604 done:
5223
- 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);
52244606 }
52254607 }
52264608 return;
....@@ -5268,7 +4650,7 @@
52684650 (etype == WLC_E_LINK) && (flags & WLC_EVENT_MSG_LINK)) {
52694651 // Link up
52704652 wl_ext_counters_update(cur_if, ISAM_RC_RXF0OVFL_REINIT);
5271
- wl_timer_mod(dhd, &apsta_params->rxf0ovfl_timer, RXF0OVFL_POLLING_TIMEOUT);
4653
+ wl_ext_mod_timer(&apsta_params->rxf0ovfl_timer, RXF0OVFL_POLLING_TIMEOUT, 0);
52724654 }
52734655 else if ((cur_if->ifmode == IAP_MODE) &&
52744656 ((etype == WLC_E_SET_SSID && status == WLC_E_STATUS_SUCCESS) ||
....@@ -5276,7 +4658,7 @@
52764658 reason == WLC_E_REASON_INITIAL_ASSOC))) {
52774659 // Link up
52784660 wl_ext_counters_update(cur_if, ISAM_RC_RXF0OVFL_REINIT);
5279
- wl_timer_mod(dhd, &apsta_params->rxf0ovfl_timer, RXF0OVFL_POLLING_TIMEOUT);
4661
+ wl_ext_mod_timer(&apsta_params->rxf0ovfl_timer, RXF0OVFL_POLLING_TIMEOUT, 0);
52804662 }
52814663 else if ((etype == WLC_E_RESERVED) && (reason == ISAM_RC_RXF0OVFL_REINIT) &&
52824664 (wl_ext_iapsta_other_if_enabled(cur_if->dev))) {
....@@ -5305,7 +4687,7 @@
53054687 wl_ext_ioctl(cur_if->dev, WLC_INIT, NULL, 0, 1);
53064688 }
53074689 done:
5308
- wl_timer_mod(dhd, &apsta_params->rxf0ovfl_timer, RXF0OVFL_POLLING_TIMEOUT);
4690
+ wl_ext_mod_timer(&apsta_params->rxf0ovfl_timer, RXF0OVFL_POLLING_TIMEOUT, 0);
53094691 }
53104692
53114693 return;
....@@ -5313,15 +4695,36 @@
53134695 #endif /* RXF0OVFL_REINIT_WAR */
53144696
53154697 void
5316
-wl_ext_iapsta_link(struct wl_if_info *cur_if,
4698
+wl_ext_iapsta_event(struct net_device *dev, void *argu,
53174699 const wl_event_msg_t *e, void *data)
53184700 {
5319
- struct dhd_pub *dhd = dhd_get_pub(cur_if->dev);
5320
- 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 */
53214708 uint32 event_type = ntoh32(e->event_type);
53224709 uint32 status = ntoh32(e->status);
53234710 uint32 reason = ntoh32(e->reason);
53244711 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
+ }
53254728
53264729 if (cur_if->ifmode == ISTA_MODE || cur_if->ifmode == IGC_MODE) {
53274730 if (event_type == WLC_E_LINK) {
....@@ -5334,6 +4737,10 @@
53344737 wl_ext_net_setcarrier(cur_if, FALSE, FALSE);
53354738 #endif /* SET_CARRIER */
53364739 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 */
53374744 } else {
53384745 WL_MSG(cur_if->ifname, "[%c] Link UP with %pM\n",
53394746 cur_if->prefix, &e->addr);
....@@ -5341,11 +4748,15 @@
53414748 wl_ext_net_setcarrier(cur_if, TRUE, FALSE);
53424749 #endif /* SET_CARRIER */
53434750 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 */
53444755 }
53454756 wl_clr_isam_status(cur_if, STA_CONNECTING);
53464757 wake_up_interruptible(&apsta_params->netif_change_event);
53474758 #ifdef PROPTX_MAXCOUNT
5348
- wl_ext_update_wlfc_maxcount(dhd);
4759
+ wl_ext_update_wlfc_maxcount(apsta_params->dhd);
53494760 #endif /* PROPTX_MAXCOUNT */
53504761 }
53514762 else if (event_type == WLC_E_SET_SSID && status != WLC_E_STATUS_SUCCESS) {
....@@ -5354,8 +4765,12 @@
53544765 event_type, reason, status);
53554766 wl_clr_isam_status(cur_if, STA_CONNECTING);
53564767 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 */
53574772 #ifdef PROPTX_MAXCOUNT
5358
- wl_ext_update_wlfc_maxcount(dhd);
4773
+ wl_ext_update_wlfc_maxcount(apsta_params->dhd);
53594774 #endif /* PROPTX_MAXCOUNT */
53604775 }
53614776 else if (event_type == WLC_E_DEAUTH || event_type == WLC_E_DEAUTH_IND ||
....@@ -5366,6 +4781,10 @@
53664781 #ifdef SET_CARRIER
53674782 wl_ext_net_setcarrier(cur_if, FALSE, FALSE);
53684783 #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 */
53694788 }
53704789 }
53714790 else if (cur_if->ifmode == IAP_MODE || cur_if->ifmode == IGO_MODE ||
....@@ -5387,7 +4806,7 @@
53874806 wl_ext_net_setcarrier(cur_if, TRUE, FALSE);
53884807 #endif /* SET_CARRIER */
53894808 #ifdef PROPTX_MAXCOUNT
5390
- wl_ext_update_wlfc_maxcount(dhd);
4809
+ wl_ext_update_wlfc_maxcount(apsta_params->dhd);
53914810 #endif /* PROPTX_MAXCOUNT */
53924811 }
53934812 else if ((event_type == WLC_E_LINK && reason == WLC_E_LINK_BSSCFG_DIS) ||
....@@ -5400,7 +4819,7 @@
54004819 wl_ext_net_setcarrier(cur_if, FALSE, FALSE);
54014820 #endif /* SET_CARRIER */
54024821 #ifdef PROPTX_MAXCOUNT
5403
- wl_ext_update_wlfc_maxcount(dhd);
4822
+ wl_ext_update_wlfc_maxcount(apsta_params->dhd);
54044823 #endif /* PROPTX_MAXCOUNT */
54054824 }
54064825 else if ((event_type == WLC_E_ASSOC_IND || event_type == WLC_E_REASSOC_IND) &&
....@@ -5418,34 +4837,17 @@
54184837 event_type, reason);
54194838 wl_ext_isam_status(cur_if->dev, NULL, 0);
54204839 }
5421
- }
5422
-}
5423
-
5424
-void
5425
-wl_ext_iapsta_event(struct net_device *dev, void *argu,
5426
- const wl_event_msg_t *e, void *data)
5427
-{
5428
-#ifdef ACS_MONITOR
5429
- struct wl_apsta_params *apsta_params = (struct wl_apsta_params *)argu;
5430
-#endif /* ACS_MONITOR */
5431
- struct dhd_pub *dhd = dhd_get_pub(dev);
5432
- struct wl_if_info *cur_if = NULL;
5433
-
5434
- cur_if = wl_get_cur_if(dev);
5435
- if (!cur_if || !cur_if->dev) {
5436
- IAPSTA_DBG(dev->name, "ifidx %d is not ready\n", e->ifidx);
5437
- 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 */
54384844 }
54394845
5440
- wl_ext_iapsta_link(cur_if, e, data);
54414846 #ifdef TPUT_MONITOR
5442
- if (dhd->conf->tput_monitor_ms)
5443
- 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);
54444849 #endif /* TPUT_MONITOR */
54454850
5446
-#if defined(WLMESH) && defined(WL_ESCAN)
5447
- wl_mesh_event_handler(cur_if, e, data);
5448
-#endif /* WLMESH && WL_ESCAN */
54494851 #ifdef ACS_MONITOR
54504852 if ((apsta_params->acs & ACS_DRV_BIT) && apsta_params->acs_tmo)
54514853 wl_acs_handler(cur_if, e, data);
....@@ -5453,9 +4855,6 @@
54534855 #ifdef EAPOL_RESEND
54544856 wl_resend_eapol_handler(cur_if, e, data);
54554857 #endif /* EAPOL_RESEND */
5456
-#ifdef KEY_INSTALL_CHECK
5457
- wl_ext_key_install_handler(cur_if, e, data);
5458
-#endif /* KEY_INSTALL_CHECK */
54594858 #ifdef RESTART_AP_WAR
54604859 wl_ext_restart_ap_handler(cur_if, e, data);
54614860 #endif /* RESTART_AP_WAR */
....@@ -5707,6 +5106,10 @@
57075106 cur_if->vsdb = FALSE;
57085107 cur_if->prefix = 'M';
57095108 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 */
57105113 #endif /* WLMESH */
57115114 }
57125115 }
....@@ -5814,6 +5217,7 @@
58145217 }
58155218 #endif /* WLMESH */
58165219
5220
+ wl_ext_get_ioctl_ver(dev, &apsta_params->ioctl_ver);
58175221 apsta_params->init = TRUE;
58185222
58195223 WL_MSG(dev->name, "apstamode=%d\n", apstamode);
....@@ -5987,7 +5391,7 @@
59875391 }
59885392
59895393 memset(&chan_info, 0, sizeof(struct wl_chan_info));
5990
- wl_ext_get_chan(cur_if->dev, &chan_info);
5394
+ wl_ext_get_chan(apsta_params, cur_if->dev, &chan_info);
59915395 if (chan_info.chan) {
59925396 IAPSTA_INFO(cur_if->ifname, "Associated\n");
59935397 if (!wl_ext_same_chan(&cur_if->chan_info, &chan_info)) {
....@@ -6032,7 +5436,7 @@
60325436 }
60335437
60345438 wl_ext_set_amode(cur_if);
6035
- wl_ext_set_emode(cur_if);
5439
+ wl_ext_set_emode(apsta_params, cur_if);
60365440
60375441 if (cur_if->ifmode == ISTA_MODE) {
60385442 conn_info.bssidx = cur_if->bssidx;
....@@ -6163,6 +5567,8 @@
61635567 wl_ext_isam_dev_status(struct net_device *dev, ifmode_t ifmode, char prefix,
61645568 char *dump_buf, int dump_len)
61655569 {
5570
+ struct dhd_pub *dhd = dhd_get_pub(dev);
5571
+ struct wl_apsta_params *apsta_params = dhd->iapsta_params;
61665572 struct wl_chan_info chan_info;
61675573 wlc_ssid_t ssid = { 0, {0} };
61685574 struct ether_addr bssid;
....@@ -6179,8 +5585,9 @@
61795585 if (wl_ext_associated(dev)) {
61805586 wl_ext_ioctl(dev, WLC_GET_SSID, &ssid, sizeof(ssid), 0);
61815587 wldev_ioctl(dev, WLC_GET_BSSID, &bssid, sizeof(bssid), 0);
6182
- wldev_ioctl(dev, WLC_GET_RSSI, &scb_val, sizeof(scb_val_t), 0);
6183
- 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);
61845591 wl_ext_get_sec(dev, ifmode, sec, sizeof(sec), FALSE);
61855592 dump_written += snprintf(dump_buf+dump_written, dump_len,
61865593 "\n" DHD_LOG_PREFIXS "[%s-%c]: bssid=%pM, chan=%s-%-3d(0x%x %sMHz), "
....@@ -6301,7 +5708,7 @@
63015708 if (apsta_params->acs_tmo != acs_tmo) {
63025709 apsta_params->acs_tmo = acs_tmo;
63035710 WL_MSG(dev->name, "acs_timer reset to %d\n", acs_tmo);
6304
- wl_timer_mod(dhd, &cur_if->acs_timer, 0);
5711
+ wl_ext_mod_timer(&cur_if->acs_timer, acs_tmo, 0);
63055712 }
63065713 ret = 0;
63075714 } else {
....@@ -6618,6 +6025,7 @@
66186025 }
66196026 // fix me: how to check it's ISTAAP_MODE or IDUALAP_MODE?
66206027
6028
+ wl_ext_get_ioctl_ver(dev, &apsta_params->ioctl_ver);
66216029 WL_MSG(dev->name, "apstamode=%d\n", apsta_params->apstamode);
66226030
66236031 for (i=0; i<MAX_IF_NUM; i++) {
....@@ -6704,10 +6112,6 @@
67046112 if (dhd->conf->fw_type == FW_TYPE_MESH) {
67056113 apsta_params->csa |= (CSA_FW_BIT | CSA_DRV_BIT);
67066114 }
6707
- cur_if->ifmode = ISTA_MODE;
6708
- cur_if->prio = PRIO_STA;
6709
- cur_if->vsdb = TRUE;
6710
- cur_if->prefix = 'S';
67116115 if (dhd->conf->vndr_ie_assocreq && strlen(dhd->conf->vndr_ie_assocreq))
67126116 wl_ext_add_del_ie(net, VNDR_IE_ASSOCREQ_FLAG, dhd->conf->vndr_ie_assocreq, "add");
67136117 } else {
....@@ -6867,42 +6271,6 @@
68676271 }
68686272 #endif /* WLDWDS */
68696273
6870
-static void
6871
-wl_ext_iapsta_init_priv(struct net_device *net)
6872
-{
6873
- struct dhd_pub *dhd = dhd_get_pub(net);
6874
- struct wl_apsta_params *apsta_params = dhd->iapsta_params;
6875
-
6876
- if (!apsta_params->ioctl_buf) {
6877
- apsta_params->ioctl_buf = kmalloc(WL_DUMP_BUF_LEN, GFP_KERNEL);
6878
- if (unlikely(!apsta_params->ioctl_buf)) {
6879
- IAPSTA_ERROR(net->name, "Can not allocate ioctl_buf\n");
6880
- }
6881
- }
6882
- init_waitqueue_head(&apsta_params->netif_change_event);
6883
- mutex_init(&apsta_params->usr_sync);
6884
- mutex_init(&apsta_params->in4way_sync);
6885
-#ifdef STA_MGMT
6886
- INIT_LIST_HEAD(&apsta_params->sta_list);
6887
-#endif /* STA_MGMT */
6888
-#ifdef EAPOL_RESEND
6889
- spin_lock_init(&apsta_params->eapol_lock);
6890
-#endif /* EAPOL_RESEND */
6891
-}
6892
-
6893
-static void
6894
-wl_ext_iapsta_deinit_priv(struct net_device *net)
6895
-{
6896
- struct dhd_pub *dhd = dhd_get_pub(net);
6897
- struct wl_apsta_params *apsta_params = dhd->iapsta_params;
6898
-
6899
- if (apsta_params->ioctl_buf) {
6900
- kfree(apsta_params->ioctl_buf);
6901
- apsta_params->ioctl_buf = NULL;
6902
- }
6903
- memset(apsta_params, 0, sizeof(struct wl_apsta_params));
6904
-}
6905
-
69066274 int
69076275 wl_ext_iapsta_attach_netdev(struct net_device *net, int ifidx, uint8 bssidx)
69086276 {
....@@ -6914,52 +6282,87 @@
69146282 IAPSTA_TRACE(net->name, "ifidx=%d, bssidx=%d\n", ifidx, bssidx);
69156283 cur_if = &apsta_params->if_info[ifidx];
69166284 }
6917
-
69186285 if (ifidx == 0) {
6919
- wl_ext_iapsta_init_priv(net);
6920
- strcpy(cur_if->ifname, net->name);
6921
-#ifdef TPUT_MONITOR
6922
- wl_timer_register(net, &apsta_params->monitor_timer, wl_tput_monitor_timer);
6923
-#endif /* TPUT_MONITOR */
6924
-#ifdef RXF0OVFL_REINIT_WAR
6925
- wl_timer_register(net, &apsta_params->rxf0ovfl_timer, wl_ext_rxf0ovfl_reinit_timeout);
6926
-#endif /* RXF0OVFL_REINIT_WAR */
6927
- }
6928
-
6929
- 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;
69306288 cur_if->dev = net;
69316289 cur_if->ifidx = ifidx;
69326290 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);
69336302 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 */
69346312 INIT_DELAYED_WORK(&cur_if->pm_enable_work, wl_ext_pm_work_handler);
6935
- 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;
69366338 wl_ext_event_register(net, dhd, WLC_E_LAST, wl_ext_iapsta_event,
69376339 apsta_params, PRIO_EVENT_IAPSTA);
69386340 #if defined(WLMESH) && defined(WL_ESCAN)
6939
- 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
+ }
69406344 #endif /* WLMESH && WL_ESCAN */
69416345 #ifdef ACS_MONITOR
69426346 wl_acs_attach(dhd, cur_if);
69436347 #endif /* ACS_MONITOR */
6348
+ mutex_init(&cur_if->pm_sync);
6349
+ INIT_DELAYED_WORK(&cur_if->pm_enable_work, wl_ext_pm_work_handler);
69446350 #ifdef SET_CARRIER
69456351 wl_ext_net_setcarrier(cur_if, FALSE, TRUE);
69466352 #endif /* SET_CARRIER */
6947
- wl_timer_register(net, &cur_if->connect_timer, wl_ext_connect_timeout);
6948
-#if defined(WL_EXT_RECONNECT) && defined(WL_CFG80211)
6949
- wl_timer_register(net, &cur_if->reconnect_timer, wl_ext_reconnect_timeout);
6950
-#endif /* WL_EXT_RECONNECT && WL_CFG80211 */
6353
+ init_timer_compat(&cur_if->connect_timer, wl_ext_connect_timeout, net);
69516354 #ifdef RESTART_AP_WAR
6952
- 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);
69536356 #endif /* RESTART_AP_WAR */
69546357 #ifdef RESET_AP_WAR
6955
- 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);
69566359 #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 */
69576363 #ifdef EAPOL_RESEND
6958
- wl_timer_register(net, &cur_if->eapol_timer, wl_eapol_timer);
6364
+ init_timer_compat(&cur_if->eapol_timer, wl_eapol_timer, net);
69596365 #endif /* EAPOL_RESEND */
6960
-#ifdef KEY_INSTALL_CHECK
6961
- wl_timer_register(net, &cur_if->key_install_timer, wl_ext_key_install_timeout);
6962
-#endif /* KEY_INSTALL_CHECK */
69636366 }
69646367
69656368 return 0;
....@@ -6980,23 +6383,58 @@
69806383 cur_if = &apsta_params->if_info[ifidx];
69816384 }
69826385
6983
- if (ifidx == 0 || (cur_if && (wl_get_isam_status(cur_if, IF_READY) ||
6984
- wl_get_isam_status(cur_if, IF_ADDING)))) {
6386
+ if (ifidx == 0) {
69856387 #ifdef EAPOL_RESEND
69866388 wl_ext_release_eapol_txpkt(dhd, ifidx, FALSE);
69876389 #endif /* EAPOL_RESEND */
6988
-#ifdef KEY_INSTALL_CHECK
6989
- wl_timer_deregister(net, &cur_if->key_install_timer);
6990
-#endif /* KEY_INSTALL_CHECK */
6991
- wl_timer_deregister(net, &cur_if->connect_timer);
6390
+ wl_ext_mod_timer(&cur_if->connect_timer, 0, 0);
69926391 #if defined(WL_EXT_RECONNECT) && defined(WL_CFG80211)
6993
- wl_timer_deregister(net, &cur_if->reconnect_timer);
6392
+ wl_ext_mod_timer(&cur_if->reconnect_timer, 0, 0);
69946393 #endif /* WL_EXT_RECONNECT && WL_CFG80211 */
69956394 #ifdef RESTART_AP_WAR
6996
- wl_timer_deregister(net, &cur_if->restart_ap_timer);
6395
+ wl_ext_mod_timer(&cur_if->restart_ap_timer, 0, 0);
69976396 #endif /* RESTART_AP_WAR */
69986397 #ifdef RESET_AP_WAR
6999
- 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);
70006438 #endif /* RESET_AP_WAR */
70016439 #ifdef SET_CARRIER
70026440 wl_ext_net_setcarrier(cur_if, FALSE, FALSE);
....@@ -7006,23 +6444,15 @@
70066444 wl_acs_detach(cur_if);
70076445 #endif /* ACS_MONITOR */
70086446 #if defined(WLMESH) && defined(WL_ESCAN)
7009
- 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
+ }
70106450 #endif /* WLMESH && WL_ESCAN */
70116451 wl_ext_event_deregister(net, dhd, WLC_E_LAST, wl_ext_iapsta_event);
70126452 #ifdef STA_MGMT
70136453 wl_ext_flush_sta_list(net, ifidx);
70146454 #endif /* STA_MGMT */
70156455 memset(cur_if, 0, sizeof(struct wl_if_info));
7016
- }
7017
-
7018
- if (ifidx == 0) {
7019
-#ifdef RXF0OVFL_REINIT_WAR
7020
- wl_timer_deregister(net, &apsta_params->rxf0ovfl_timer);
7021
-#endif /* RXF0OVFL_REINIT_WAR */
7022
-#ifdef TPUT_MONITOR
7023
- wl_timer_deregister(net, &apsta_params->monitor_timer);
7024
-#endif /* TPUT_MONITOR */
7025
- wl_ext_iapsta_deinit_priv(net);
70266456 }
70276457
70286458 return 0;
....@@ -7038,7 +6468,7 @@
70386468
70396469 iapsta_params = kzalloc(sizeof(struct wl_apsta_params), GFP_KERNEL);
70406470 if (unlikely(!iapsta_params)) {
7041
- IAPSTA_ERROR(net->name, "Can not allocate apsta_params\n");
6471
+ IAPSTA_ERROR("wlan", "Could not allocate apsta_params\n");
70426472 return -ENOMEM;
70436473 }
70446474 dhd->iapsta_params = (void *)iapsta_params;
....@@ -7054,7 +6484,6 @@
70546484 IAPSTA_TRACE(net->name, "Enter\n");
70556485
70566486 if (dhd->iapsta_params) {
7057
- wl_ext_iapsta_deinit_priv(net);
70586487 kfree(dhd->iapsta_params);
70596488 dhd->iapsta_params = NULL;
70606489 }