• Home
  • Raw
  • Download

Lines Matching refs:wl

50 static int gelic_wl_start_scan(struct gelic_wl_info *wl, int always_scan,
158 struct gelic_wl_info *wl; in gelic_eurus_sync_cmd_worker() local
166 wl = cmd->wl; in gelic_eurus_sync_cmd_worker()
167 card = port_to_card(wl_port(wl)); in gelic_eurus_sync_cmd_worker()
178 init_completion(&wl->cmd_done_intr); in gelic_eurus_sync_cmd_worker()
190 wait_for_completion(&wl->cmd_done_intr); in gelic_eurus_sync_cmd_worker()
216 static struct gelic_eurus_cmd *gelic_eurus_sync_cmd(struct gelic_wl_info *wl, in gelic_eurus_sync_cmd() argument
232 cmd->wl = wl; in gelic_eurus_sync_cmd()
235 queue_work(wl->eurus_cmd_queue, &cmd->work); in gelic_eurus_sync_cmd()
245 struct gelic_wl_info *wl = port_wl(netdev_port(netdev)); in gelic_wl_get_link() local
249 mutex_lock(&wl->assoc_stat_lock); in gelic_wl_get_link()
250 if (wl->assoc_stat == GELIC_WL_ASSOC_STAT_ASSOCIATED) in gelic_wl_get_link()
254 mutex_unlock(&wl->assoc_stat_lock); in gelic_wl_get_link()
259 static void gelic_wl_send_iwap_event(struct gelic_wl_info *wl, u8 *bssid) in gelic_wl_send_iwap_event() argument
267 wireless_send_event(port_to_netdev(wl_port(wl)), SIOCGIWAP, in gelic_wl_send_iwap_event()
284 static void gelic_wl_get_ch_info(struct gelic_wl_info *wl) in gelic_wl_get_ch_info() argument
286 struct gelic_card *card = port_to_card(wl_port(wl)); in gelic_wl_get_ch_info()
290 if (!test_and_set_bit(GELIC_WL_STAT_CH_INFO, &wl->stat)) { in gelic_wl_get_ch_info()
299 wl->ch_info = 0x07ff;/* 11 ch */ in gelic_wl_get_ch_info()
302 wl->ch_info = ch_info_raw >> 48; in gelic_wl_get_ch_info()
313 struct gelic_wl_info *wl = port_wl(netdev_port(netdev)); in gelic_wl_get_range() local
324 gelic_wl_get_ch_info(wl); in gelic_wl_get_range()
328 if (wl->ch_info & (1 << i)) { in gelic_wl_get_range()
381 struct gelic_wl_info *wl = port_wl(netdev_priv(netdev)); in gelic_wl_set_scan() local
393 return gelic_wl_start_scan(wl, 1, essid, essid_len); in gelic_wl_set_scan()
710 struct gelic_wl_info *wl = port_wl(netdev_priv(netdev)); in gelic_wl_get_scan() local
718 if (mutex_lock_interruptible(&wl->scan_lock)) in gelic_wl_get_scan()
721 switch (wl->scan_stat) { in gelic_wl_get_scan()
735 list_for_each_entry(scan_info, &wl->network_list, list) { in gelic_wl_get_scan()
736 if (wl->scan_age == 0 || in gelic_wl_get_scan()
737 time_after(scan_info->last_scanned + wl->scan_age, in gelic_wl_get_scan()
754 mutex_unlock(&wl->scan_lock); in gelic_wl_get_scan()
760 static void scan_list_dump(struct gelic_wl_info *wl) in scan_list_dump() argument
766 list_for_each_entry(scan_info, &wl->network_list, list) { in scan_list_dump()
786 struct gelic_wl_info *wl = port_wl(netdev_port(netdev)); in gelic_wl_set_auth() local
791 spin_lock_irqsave(&wl->lock, irqflag); in gelic_wl_set_auth()
796 wl->wpa_level = GELIC_WL_WPA_LEVEL_NONE; in gelic_wl_set_auth()
797 wl->group_cipher_method = GELIC_WL_CIPHER_WEP; in gelic_wl_set_auth()
798 wl->pairwise_cipher_method = GELIC_WL_CIPHER_WEP; in gelic_wl_set_auth()
802 wl->wpa_level = GELIC_WL_WPA_LEVEL_WPA; in gelic_wl_set_auth()
803 wl->group_cipher_method = GELIC_WL_CIPHER_TKIP; in gelic_wl_set_auth()
804 wl->pairwise_cipher_method = GELIC_WL_CIPHER_TKIP; in gelic_wl_set_auth()
805 wl->auth_method = GELIC_EURUS_AUTH_OPEN; in gelic_wl_set_auth()
820 wl->wpa_level = GELIC_WL_WPA_LEVEL_WPA2; in gelic_wl_set_auth()
821 wl->group_cipher_method = GELIC_WL_CIPHER_AES; in gelic_wl_set_auth()
822 wl->pairwise_cipher_method = in gelic_wl_set_auth()
824 wl->auth_method = GELIC_EURUS_AUTH_OPEN; in gelic_wl_set_auth()
834 wl->pairwise_cipher_method = GELIC_WL_CIPHER_WEP; in gelic_wl_set_auth()
838 wl->pairwise_cipher_method = GELIC_WL_CIPHER_TKIP; in gelic_wl_set_auth()
842 wl->pairwise_cipher_method = GELIC_WL_CIPHER_AES; in gelic_wl_set_auth()
846 wl->pairwise_cipher_method = GELIC_WL_CIPHER_NONE; in gelic_wl_set_auth()
853 wl->group_cipher_method = GELIC_WL_CIPHER_WEP; in gelic_wl_set_auth()
857 wl->group_cipher_method = GELIC_WL_CIPHER_TKIP; in gelic_wl_set_auth()
861 wl->group_cipher_method = GELIC_WL_CIPHER_AES; in gelic_wl_set_auth()
865 wl->group_cipher_method = GELIC_WL_CIPHER_NONE; in gelic_wl_set_auth()
871 wl->auth_method = GELIC_EURUS_AUTH_SHARED; in gelic_wl_set_auth()
874 wl->auth_method = GELIC_EURUS_AUTH_OPEN; in gelic_wl_set_auth()
882 wl->wpa_level = GELIC_WL_WPA_LEVEL_WPA; in gelic_wl_set_auth()
885 wl->wpa_level = GELIC_WL_WPA_LEVEL_NONE; in gelic_wl_set_auth()
899 set_bit(GELIC_WL_STAT_CONFIGURED, &wl->stat); in gelic_wl_set_auth()
901 spin_unlock_irqrestore(&wl->lock, irqflag); in gelic_wl_set_auth()
911 struct gelic_wl_info *wl = port_wl(netdev_port(netdev)); in gelic_wl_get_auth() local
916 spin_lock_irqsave(&wl->lock, irqflag); in gelic_wl_get_auth()
919 switch (wl->wpa_level) { in gelic_wl_get_auth()
932 if (wl->auth_method == GELIC_EURUS_AUTH_SHARED) in gelic_wl_get_auth()
934 else if (wl->auth_method == GELIC_EURUS_AUTH_OPEN) in gelic_wl_get_auth()
939 switch (wl->wpa_level) { in gelic_wl_get_auth()
953 spin_unlock_irqrestore(&wl->lock, irqflag); in gelic_wl_get_auth()
963 struct gelic_wl_info *wl = port_wl(netdev_priv(netdev)); in gelic_wl_set_essid() local
971 spin_lock_irqsave(&wl->lock, irqflag); in gelic_wl_set_essid()
973 wl->essid_len = data->essid.length; in gelic_wl_set_essid()
974 memcpy(wl->essid, extra, wl->essid_len); in gelic_wl_set_essid()
976 set_bit(GELIC_WL_STAT_ESSID_SET, &wl->stat); in gelic_wl_set_essid()
979 clear_bit(GELIC_WL_STAT_ESSID_SET, &wl->stat); in gelic_wl_set_essid()
981 set_bit(GELIC_WL_STAT_CONFIGURED, &wl->stat); in gelic_wl_set_essid()
982 spin_unlock_irqrestore(&wl->lock, irqflag); in gelic_wl_set_essid()
994 struct gelic_wl_info *wl = port_wl(netdev_priv(netdev)); in gelic_wl_get_essid() local
998 mutex_lock(&wl->assoc_stat_lock); in gelic_wl_get_essid()
999 spin_lock_irqsave(&wl->lock, irqflag); in gelic_wl_get_essid()
1000 if (test_bit(GELIC_WL_STAT_ESSID_SET, &wl->stat) || in gelic_wl_get_essid()
1001 wl->assoc_stat == GELIC_WL_ASSOC_STAT_ASSOCIATED) { in gelic_wl_get_essid()
1002 memcpy(extra, wl->essid, wl->essid_len); in gelic_wl_get_essid()
1003 data->essid.length = wl->essid_len; in gelic_wl_get_essid()
1008 mutex_unlock(&wl->assoc_stat_lock); in gelic_wl_get_essid()
1009 spin_unlock_irqrestore(&wl->lock, irqflag); in gelic_wl_get_essid()
1020 struct gelic_wl_info *wl = port_wl(netdev_priv(netdev)); in gelic_wl_set_encode() local
1038 spin_lock_irqsave(&wl->lock, irqflag); in gelic_wl_set_encode()
1044 key_index = wl->current_key; in gelic_wl_set_encode()
1050 wl->current_key = key_index; in gelic_wl_set_encode()
1057 wl->group_cipher_method = GELIC_WL_CIPHER_NONE; in gelic_wl_set_encode()
1058 wl->pairwise_cipher_method = in gelic_wl_set_encode()
1061 wl->key_enabled = 0; in gelic_wl_set_encode()
1063 clear_bit(key_index, &wl->key_enabled); in gelic_wl_set_encode()
1067 wl->auth_method = GELIC_EURUS_AUTH_OPEN; in gelic_wl_set_encode()
1070 wl->auth_method = GELIC_EURUS_AUTH_SHARED; in gelic_wl_set_encode()
1077 wl->key_len[key_index] = enc->length; in gelic_wl_set_encode()
1078 memcpy(wl->key[key_index], extra, enc->length); in gelic_wl_set_encode()
1079 set_bit(key_index, &wl->key_enabled); in gelic_wl_set_encode()
1080 wl->pairwise_cipher_method = GELIC_WL_CIPHER_WEP; in gelic_wl_set_encode()
1081 wl->group_cipher_method = GELIC_WL_CIPHER_WEP; in gelic_wl_set_encode()
1083 set_bit(GELIC_WL_STAT_CONFIGURED, &wl->stat); in gelic_wl_set_encode()
1085 spin_unlock_irqrestore(&wl->lock, irqflag); in gelic_wl_set_encode()
1094 struct gelic_wl_info *wl = port_wl(netdev_priv(netdev)); in gelic_wl_get_encode() local
1107 spin_lock_irqsave(&wl->lock, irqflag); in gelic_wl_get_encode()
1113 key_index = wl->current_key; in gelic_wl_get_encode()
1116 if (wl->group_cipher_method == GELIC_WL_CIPHER_WEP) { in gelic_wl_get_encode()
1117 switch (wl->auth_method) { in gelic_wl_get_encode()
1128 if (test_bit(key_index, &wl->key_enabled)) { in gelic_wl_get_encode()
1129 if (enc->length < wl->key_len[key_index]) { in gelic_wl_get_encode()
1133 enc->length = wl->key_len[key_index]; in gelic_wl_get_encode()
1134 memcpy(extra, wl->key[key_index], wl->key_len[key_index]); in gelic_wl_get_encode()
1144 spin_unlock_irqrestore(&wl->lock, irqflag); in gelic_wl_get_encode()
1153 struct gelic_wl_info *wl = port_wl(netdev_priv(netdev)); in gelic_wl_set_ap() local
1160 spin_lock_irqsave(&wl->lock, irqflag); in gelic_wl_set_ap()
1162 memcpy(wl->bssid, data->ap_addr.sa_data, in gelic_wl_set_ap()
1164 set_bit(GELIC_WL_STAT_BSSID_SET, &wl->stat); in gelic_wl_set_ap()
1165 set_bit(GELIC_WL_STAT_CONFIGURED, &wl->stat); in gelic_wl_set_ap()
1166 pr_debug("%s: bss=%pM\n", __func__, wl->bssid); in gelic_wl_set_ap()
1169 clear_bit(GELIC_WL_STAT_BSSID_SET, &wl->stat); in gelic_wl_set_ap()
1170 eth_zero_addr(wl->bssid); in gelic_wl_set_ap()
1172 spin_unlock_irqrestore(&wl->lock, irqflag); in gelic_wl_set_ap()
1181 struct gelic_wl_info *wl = port_wl(netdev_priv(netdev)); in gelic_wl_get_ap() local
1185 mutex_lock(&wl->assoc_stat_lock); in gelic_wl_get_ap()
1186 spin_lock_irqsave(&wl->lock, irqflag); in gelic_wl_get_ap()
1187 if (wl->assoc_stat == GELIC_WL_ASSOC_STAT_ASSOCIATED) { in gelic_wl_get_ap()
1189 memcpy(data->ap_addr.sa_data, wl->active_bssid, in gelic_wl_get_ap()
1194 spin_unlock_irqrestore(&wl->lock, irqflag); in gelic_wl_get_ap()
1195 mutex_unlock(&wl->assoc_stat_lock); in gelic_wl_get_ap()
1205 struct gelic_wl_info *wl = port_wl(netdev_priv(netdev)); in gelic_wl_set_encodeext() local
1228 spin_lock_irqsave(&wl->lock, irqflag); in gelic_wl_set_encodeext()
1232 key_index = wl->current_key; in gelic_wl_set_encodeext()
1238 wl->current_key = key_index; in gelic_wl_set_encodeext()
1244 wl->wpa_level = GELIC_WL_WPA_LEVEL_NONE; in gelic_wl_set_encodeext()
1245 wl->group_cipher_method = GELIC_WL_CIPHER_NONE; in gelic_wl_set_encodeext()
1246 wl->pairwise_cipher_method = GELIC_WL_CIPHER_NONE; in gelic_wl_set_encodeext()
1247 wl->auth_method = GELIC_EURUS_AUTH_OPEN; /* should be open */ in gelic_wl_set_encodeext()
1252 wl->auth_method = GELIC_EURUS_AUTH_OPEN; in gelic_wl_set_encodeext()
1256 wl->auth_method = GELIC_EURUS_AUTH_SHARED; in gelic_wl_set_encodeext()
1265 wl->key_len[key_index] = ext->key_len; in gelic_wl_set_encodeext()
1266 memset(wl->key[key_index], 0, IW_ENCODING_TOKEN_MAX); in gelic_wl_set_encodeext()
1267 memcpy(wl->key[key_index], ext->key, ext->key_len); in gelic_wl_set_encodeext()
1268 set_bit(key_index, &wl->key_enabled); in gelic_wl_set_encodeext()
1270 set_bit(GELIC_WL_STAT_CONFIGURED, &wl->stat); in gelic_wl_set_encodeext()
1278 memset(wl->psk, 0, sizeof(wl->psk)); in gelic_wl_set_encodeext()
1279 memcpy(wl->psk, ext->key, ext->key_len); in gelic_wl_set_encodeext()
1280 wl->psk_len = ext->key_len; in gelic_wl_set_encodeext()
1281 wl->psk_type = GELIC_EURUS_WPA_PSK_BIN; in gelic_wl_set_encodeext()
1283 set_bit(GELIC_WL_STAT_WPA_PSK_SET, &wl->stat); in gelic_wl_set_encodeext()
1286 spin_unlock_irqrestore(&wl->lock, irqflag); in gelic_wl_set_encodeext()
1295 struct gelic_wl_info *wl = port_wl(netdev_priv(netdev)); in gelic_wl_get_encodeext() local
1317 spin_lock_irqsave(&wl->lock, irqflag); in gelic_wl_get_encodeext()
1321 key_index = wl->current_key; in gelic_wl_get_encodeext()
1324 switch (wl->group_cipher_method) { in gelic_wl_get_encodeext()
1345 if (max_key_len < wl->key_len[key_index]) { in gelic_wl_get_encodeext()
1349 if (test_bit(key_index, &wl->key_enabled)) in gelic_wl_get_encodeext()
1350 memcpy(ext->key, wl->key[key_index], in gelic_wl_get_encodeext()
1351 wl->key_len[key_index]); in gelic_wl_get_encodeext()
1357 spin_unlock_irqrestore(&wl->lock, irqflag); in gelic_wl_get_encodeext()
1407 struct gelic_wl_info *wl = port_wl(netdev_priv(netdev)); in gelic_wl_get_wireless_stats() local
1419 is = &wl->iwstat; in gelic_wl_get_wireless_stats()
1421 cmd = gelic_eurus_sync_cmd(wl, GELIC_EURUS_CMD_GET_RSSI_CFG, in gelic_wl_get_wireless_stats()
1441 static int gelic_wl_start_scan(struct gelic_wl_info *wl, int always_scan, in gelic_wl_start_scan() argument
1450 if (mutex_lock_interruptible(&wl->scan_lock)) in gelic_wl_start_scan()
1456 if (wl->scan_stat == GELIC_WL_SCAN_STAT_SCANNING) { in gelic_wl_start_scan()
1461 init_completion(&wl->scan_done); in gelic_wl_start_scan()
1467 && wl->scan_stat == GELIC_WL_SCAN_STAT_GOT_LIST) { in gelic_wl_start_scan()
1469 complete(&wl->scan_done); in gelic_wl_start_scan()
1490 wl->scan_stat = GELIC_WL_SCAN_STAT_SCANNING; in gelic_wl_start_scan()
1491 cmd = gelic_eurus_sync_cmd(wl, GELIC_EURUS_CMD_START_SCAN, in gelic_wl_start_scan()
1494 wl->scan_stat = GELIC_WL_SCAN_STAT_INIT; in gelic_wl_start_scan()
1495 complete(&wl->scan_done); in gelic_wl_start_scan()
1502 mutex_unlock(&wl->scan_lock); in gelic_wl_start_scan()
1511 static void gelic_wl_scan_complete_event(struct gelic_wl_info *wl) in gelic_wl_scan_complete_event() argument
1524 mutex_lock(&wl->scan_lock); in gelic_wl_scan_complete_event()
1532 if (wl->scan_stat != GELIC_WL_SCAN_STAT_SCANNING) { in gelic_wl_scan_complete_event()
1537 __func__, wl->scan_stat); in gelic_wl_scan_complete_event()
1541 cmd = gelic_eurus_sync_cmd(wl, GELIC_EURUS_CMD_GET_SCAN, in gelic_wl_scan_complete_event()
1544 wl->scan_stat = GELIC_WL_SCAN_STAT_INIT; in gelic_wl_scan_complete_event()
1554 wl->scan_stat = GELIC_WL_SCAN_STAT_GOT_LIST; in gelic_wl_scan_complete_event()
1557 list_for_each_entry_safe(target, tmp, &wl->network_list, list) { in gelic_wl_scan_complete_event()
1560 if (time_before(target->last_scanned + wl->scan_age, in gelic_wl_scan_complete_event()
1564 list_move_tail(&target->list, &wl->network_free_list); in gelic_wl_scan_complete_event()
1589 list_for_each_entry(target, &wl->network_list, list) { in gelic_wl_scan_complete_event()
1604 if (list_empty(&wl->network_free_list)) { in gelic_wl_scan_complete_event()
1608 target = list_entry(wl->network_free_list.next, in gelic_wl_scan_complete_event()
1639 list_move_tail(&target->list, &wl->network_list); in gelic_wl_scan_complete_event()
1642 wireless_send_event(port_to_netdev(wl_port(wl)), SIOCGIWSCAN, &data, in gelic_wl_scan_complete_event()
1646 complete(&wl->scan_done); in gelic_wl_scan_complete_event()
1647 mutex_unlock(&wl->scan_lock); in gelic_wl_scan_complete_event()
1669 struct gelic_wl_scan_info *gelic_wl_find_best_bss(struct gelic_wl_info *wl) in gelic_wl_find_best_bss() argument
1681 list_for_each_entry(scan_info, &wl->network_list, list) { in gelic_wl_find_best_bss()
1690 if (test_bit(GELIC_WL_STAT_BSSID_SET, &wl->stat)) { in gelic_wl_find_best_bss()
1692 wl->bssid)) { in gelic_wl_find_best_bss()
1707 if (wl->wpa_level == GELIC_WL_WPA_LEVEL_WPA2) { in gelic_wl_find_best_bss()
1713 } else if (wl->wpa_level == GELIC_WL_WPA_LEVEL_WPA) { in gelic_wl_find_best_bss()
1719 } else if (wl->wpa_level == GELIC_WL_WPA_LEVEL_NONE && in gelic_wl_find_best_bss()
1720 wl->group_cipher_method == GELIC_WL_CIPHER_WEP) { in gelic_wl_find_best_bss()
1729 if (test_bit(GELIC_WL_STAT_ESSID_SET, &wl->stat)) { in gelic_wl_find_best_bss()
1730 if ((scan_info->essid_len == wl->essid_len) && in gelic_wl_find_best_bss()
1731 !strncmp(wl->essid, in gelic_wl_find_best_bss()
1756 static int gelic_wl_do_wep_setup(struct gelic_wl_info *wl) in gelic_wl_do_wep_setup() argument
1773 if (wl->group_cipher_method == GELIC_WL_CIPHER_WEP) { in gelic_wl_do_wep_setup()
1776 if (!test_bit(i, &wl->key_enabled)) in gelic_wl_do_wep_setup()
1781 if (wl->key_len[i] == 13) in gelic_wl_do_wep_setup()
1783 else if (wl->key_len[i] != 5) { in gelic_wl_do_wep_setup()
1785 __func__, i, wl->key_len[i]); in gelic_wl_do_wep_setup()
1789 memcpy(wep->key[i], wl->key[i], wl->key_len[i]); in gelic_wl_do_wep_setup()
1811 cmd = gelic_eurus_sync_cmd(wl, GELIC_EURUS_CMD_SET_WEP_CFG, in gelic_wl_do_wep_setup()
1848 static int gelic_wl_do_wpa_setup(struct gelic_wl_info *wl) in gelic_wl_do_wpa_setup() argument
1863 if (!test_bit(GELIC_WL_STAT_WPA_PSK_SET, &wl->stat)) in gelic_wl_do_wpa_setup()
1867 memcpy(wpa->psk, wl->psk, wl->psk_len); in gelic_wl_do_wpa_setup()
1870 if (wl->wpa_level == GELIC_WL_WPA_LEVEL_WPA2) { in gelic_wl_do_wpa_setup()
1871 if (wl->group_cipher_method == GELIC_WL_CIPHER_AES) { in gelic_wl_do_wpa_setup()
1874 if (wl->pairwise_cipher_method == GELIC_WL_CIPHER_AES && in gelic_wl_do_wpa_setup()
1881 if (wl->group_cipher_method == GELIC_WL_CIPHER_AES) { in gelic_wl_do_wpa_setup()
1884 if (wl->pairwise_cipher_method == GELIC_WL_CIPHER_AES && in gelic_wl_do_wpa_setup()
1894 wpa->psk_type = cpu_to_be16(wl->psk_type); in gelic_wl_do_wpa_setup()
1912 cmd = gelic_eurus_sync_cmd(wl, GELIC_EURUS_CMD_SET_WPA_CFG, in gelic_wl_do_wpa_setup()
1927 static int gelic_wl_associate_bss(struct gelic_wl_info *wl, in gelic_wl_associate_bss() argument
1947 switch (wl->auth_method) { in gelic_wl_associate_bss()
1957 scan_list_dump(wl); in gelic_wl_associate_bss()
1964 cmd = gelic_eurus_sync_cmd(wl, GELIC_EURUS_CMD_SET_COMMON_CFG, in gelic_wl_associate_bss()
1974 switch (wl->wpa_level) { in gelic_wl_associate_bss()
1977 ret = gelic_wl_do_wep_setup(wl); in gelic_wl_associate_bss()
1981 ret = gelic_wl_do_wpa_setup(wl); in gelic_wl_associate_bss()
1989 gelic_wl_send_iwap_event(wl, NULL); in gelic_wl_associate_bss()
1994 init_completion(&wl->assoc_done); in gelic_wl_associate_bss()
1995 wl->assoc_stat = GELIC_WL_ASSOC_STAT_ASSOCIATING; in gelic_wl_associate_bss()
1996 cmd = gelic_eurus_sync_cmd(wl, GELIC_EURUS_CMD_ASSOC, in gelic_wl_associate_bss()
2000 wl->assoc_stat = GELIC_WL_ASSOC_STAT_DISCONN; in gelic_wl_associate_bss()
2003 gelic_wl_send_iwap_event(wl, NULL); in gelic_wl_associate_bss()
2009 rc = wait_for_completion_timeout(&wl->assoc_done, HZ * 4);/*FIXME*/ in gelic_wl_associate_bss()
2014 cmd = gelic_eurus_sync_cmd(wl, GELIC_EURUS_CMD_DISASSOC, in gelic_wl_associate_bss()
2017 wl->assoc_stat = GELIC_WL_ASSOC_STAT_DISCONN; in gelic_wl_associate_bss()
2018 gelic_wl_send_iwap_event(wl, NULL); in gelic_wl_associate_bss()
2021 wl->assoc_stat = GELIC_WL_ASSOC_STAT_ASSOCIATED; in gelic_wl_associate_bss()
2023 memcpy(wl->active_bssid, &bss->hwinfo->bssid[2], ETH_ALEN); in gelic_wl_associate_bss()
2026 gelic_wl_send_iwap_event(wl, wl->active_bssid); in gelic_wl_associate_bss()
2038 static void gelic_wl_connected_event(struct gelic_wl_info *wl, in gelic_wl_connected_event() argument
2043 switch (wl->wpa_level) { in gelic_wl_connected_event()
2055 complete(&wl->assoc_done); in gelic_wl_connected_event()
2056 netif_carrier_on(port_to_netdev(wl_port(wl))); in gelic_wl_connected_event()
2065 static void gelic_wl_disconnect_event(struct gelic_wl_info *wl, in gelic_wl_disconnect_event() argument
2078 if (!mutex_trylock(&wl->assoc_stat_lock)) { in gelic_wl_disconnect_event()
2086 cmd = gelic_eurus_sync_cmd(wl, GELIC_EURUS_CMD_DISASSOC, NULL, 0); in gelic_wl_disconnect_event()
2090 if (wl->assoc_stat == GELIC_WL_ASSOC_STAT_ASSOCIATED) in gelic_wl_disconnect_event()
2091 gelic_wl_send_iwap_event(wl, NULL); in gelic_wl_disconnect_event()
2093 wl->assoc_stat = GELIC_WL_ASSOC_STAT_DISCONN; in gelic_wl_disconnect_event()
2094 netif_carrier_off(port_to_netdev(wl_port(wl))); in gelic_wl_disconnect_event()
2097 mutex_unlock(&wl->assoc_stat_lock); in gelic_wl_disconnect_event()
2135 struct gelic_wl_info *wl; in gelic_wl_event_worker() local
2141 wl = container_of(work, struct gelic_wl_info, event_work.work); in gelic_wl_event_worker()
2142 port = wl_port(wl); in gelic_wl_event_worker()
2158 gelic_wl_scan_complete_event(wl); in gelic_wl_event_worker()
2162 gelic_wl_disconnect_event(wl, event); in gelic_wl_event_worker()
2166 gelic_wl_connected_event(wl, event); in gelic_wl_event_worker()
2178 struct gelic_wl_info *wl; in gelic_wl_assoc_worker() local
2186 wl = container_of(work, struct gelic_wl_info, assoc_work.work); in gelic_wl_assoc_worker()
2188 mutex_lock(&wl->assoc_stat_lock); in gelic_wl_assoc_worker()
2190 if (wl->assoc_stat != GELIC_WL_ASSOC_STAT_DISCONN) in gelic_wl_assoc_worker()
2193 spin_lock_irqsave(&wl->lock, irqflag); in gelic_wl_assoc_worker()
2194 if (test_bit(GELIC_WL_STAT_ESSID_SET, &wl->stat)) { in gelic_wl_assoc_worker()
2196 wl->essid); in gelic_wl_assoc_worker()
2197 essid = wl->essid; in gelic_wl_assoc_worker()
2198 essid_len = wl->essid_len; in gelic_wl_assoc_worker()
2203 spin_unlock_irqrestore(&wl->lock, irqflag); in gelic_wl_assoc_worker()
2205 ret = gelic_wl_start_scan(wl, 0, essid, essid_len); in gelic_wl_assoc_worker()
2208 schedule_delayed_work(&wl->assoc_work, HZ/10); /*FIXME*/ in gelic_wl_assoc_worker()
2221 wait_for_completion(&wl->scan_done); in gelic_wl_assoc_worker()
2224 mutex_lock(&wl->scan_lock); in gelic_wl_assoc_worker()
2225 if (wl->scan_stat != GELIC_WL_SCAN_STAT_GOT_LIST) { in gelic_wl_assoc_worker()
2226 gelic_wl_send_iwap_event(wl, NULL); in gelic_wl_assoc_worker()
2232 best_bss = gelic_wl_find_best_bss(wl); in gelic_wl_assoc_worker()
2234 gelic_wl_send_iwap_event(wl, NULL); in gelic_wl_assoc_worker()
2240 ret = gelic_wl_associate_bss(wl, best_bss); in gelic_wl_assoc_worker()
2244 mutex_unlock(&wl->scan_lock); in gelic_wl_assoc_worker()
2246 mutex_unlock(&wl->assoc_stat_lock); in gelic_wl_assoc_worker()
2255 struct gelic_wl_info *wl = port_wl(netdev_priv(netdev)); in gelic_wl_interrupt() local
2259 complete(&wl->cmd_done_intr); in gelic_wl_interrupt()
2264 queue_delayed_work(wl->event_queue, &wl->event_work, 0); in gelic_wl_interrupt()
2302 struct gelic_wl_info *wl; in gelic_wl_alloc() local
2319 wl = port_wl(port); in gelic_wl_alloc()
2320 pr_debug("%s: wl=%p port=%p\n", __func__, wl, port); in gelic_wl_alloc()
2323 wl->networks = kzalloc(sizeof(struct gelic_wl_scan_info) * in gelic_wl_alloc()
2326 if (!wl->networks) in gelic_wl_alloc()
2329 wl->eurus_cmd_queue = create_singlethread_workqueue("gelic_cmd"); in gelic_wl_alloc()
2330 if (!wl->eurus_cmd_queue) in gelic_wl_alloc()
2333 wl->event_queue = create_singlethread_workqueue("gelic_event"); in gelic_wl_alloc()
2334 if (!wl->event_queue) in gelic_wl_alloc()
2337 INIT_LIST_HEAD(&wl->network_free_list); in gelic_wl_alloc()
2338 INIT_LIST_HEAD(&wl->network_list); in gelic_wl_alloc()
2340 list_add_tail(&wl->networks[i].list, in gelic_wl_alloc()
2341 &wl->network_free_list); in gelic_wl_alloc()
2342 init_completion(&wl->cmd_done_intr); in gelic_wl_alloc()
2344 INIT_DELAYED_WORK(&wl->event_work, gelic_wl_event_worker); in gelic_wl_alloc()
2345 INIT_DELAYED_WORK(&wl->assoc_work, gelic_wl_assoc_worker); in gelic_wl_alloc()
2346 mutex_init(&wl->scan_lock); in gelic_wl_alloc()
2347 mutex_init(&wl->assoc_stat_lock); in gelic_wl_alloc()
2349 init_completion(&wl->scan_done); in gelic_wl_alloc()
2351 complete(&wl->scan_done); in gelic_wl_alloc()
2353 spin_lock_init(&wl->lock); in gelic_wl_alloc()
2355 wl->scan_age = 5*HZ; /* FIXME */ in gelic_wl_alloc()
2365 destroy_workqueue(wl->eurus_cmd_queue); in gelic_wl_alloc()
2367 kfree(wl->networks); in gelic_wl_alloc()
2375 static void gelic_wl_free(struct gelic_wl_info *wl) in gelic_wl_free() argument
2383 destroy_workqueue(wl->eurus_cmd_queue); in gelic_wl_free()
2384 destroy_workqueue(wl->event_queue); in gelic_wl_free()
2386 scan_info = wl->networks; in gelic_wl_free()
2389 kfree(wl->networks); in gelic_wl_free()
2391 free_netdev(port_to_netdev(wl_port(wl))); in gelic_wl_free()
2398 struct gelic_wl_info *wl = port_wl(netdev_priv(netdev)); in gelic_wl_try_associate() local
2406 if (wl->group_cipher_method == GELIC_WL_CIPHER_NONE) { in gelic_wl_try_associate()
2408 &wl->stat)) in gelic_wl_try_associate()
2417 if (wl->group_cipher_method == GELIC_WL_CIPHER_WEP) { in gelic_wl_try_associate()
2420 if (test_bit(i, &wl->key_enabled)) in gelic_wl_try_associate()
2428 if ((wl->group_cipher_method == GELIC_WL_CIPHER_TKIP) || in gelic_wl_try_associate()
2429 (wl->group_cipher_method == GELIC_WL_CIPHER_AES)) { in gelic_wl_try_associate()
2431 &wl->stat)) in gelic_wl_try_associate()
2441 ret = schedule_delayed_work(&wl->assoc_work, 0); in gelic_wl_try_associate()
2469 static int gelic_wl_reset_state(struct gelic_wl_info *wl) in gelic_wl_reset_state() argument
2475 list_for_each_entry_safe(target, tmp, &wl->network_list, list) { in gelic_wl_reset_state()
2476 list_move_tail(&target->list, &wl->network_free_list); in gelic_wl_reset_state()
2478 wl->scan_stat = GELIC_WL_SCAN_STAT_INIT; in gelic_wl_reset_state()
2481 wl->auth_method = GELIC_EURUS_AUTH_OPEN; in gelic_wl_reset_state()
2482 wl->group_cipher_method = GELIC_WL_CIPHER_NONE; in gelic_wl_reset_state()
2483 wl->pairwise_cipher_method = GELIC_WL_CIPHER_NONE; in gelic_wl_reset_state()
2484 wl->wpa_level = GELIC_WL_WPA_LEVEL_NONE; in gelic_wl_reset_state()
2486 wl->key_enabled = 0; in gelic_wl_reset_state()
2487 wl->current_key = 0; in gelic_wl_reset_state()
2489 wl->psk_type = GELIC_EURUS_WPA_PSK_PASSPHRASE; in gelic_wl_reset_state()
2490 wl->psk_len = 0; in gelic_wl_reset_state()
2492 wl->essid_len = 0; in gelic_wl_reset_state()
2493 memset(wl->essid, 0, sizeof(wl->essid)); in gelic_wl_reset_state()
2494 memset(wl->bssid, 0, sizeof(wl->bssid)); in gelic_wl_reset_state()
2495 memset(wl->active_bssid, 0, sizeof(wl->active_bssid)); in gelic_wl_reset_state()
2497 wl->assoc_stat = GELIC_WL_ASSOC_STAT_DISCONN; in gelic_wl_reset_state()
2499 memset(&wl->iwstat, 0, sizeof(wl->iwstat)); in gelic_wl_reset_state()
2501 wl->stat = 0; in gelic_wl_reset_state()
2511 struct gelic_wl_info *wl = port_wl(port); in gelic_wl_disconnect() local
2518 if (wl->scan_stat == GELIC_WL_SCAN_STAT_SCANNING) in gelic_wl_disconnect()
2519 wait_for_completion_timeout(&wl->scan_done, HZ); in gelic_wl_disconnect()
2521 cmd = gelic_eurus_sync_cmd(wl, GELIC_EURUS_CMD_DISASSOC, NULL, 0); in gelic_wl_disconnect()
2523 gelic_wl_send_iwap_event(wl, NULL); in gelic_wl_disconnect()
2529 struct gelic_wl_info *wl = port_wl(port); in gelic_wl_stop() local
2538 cancel_delayed_work(&wl->assoc_work); in gelic_wl_stop()
2540 if (wl->assoc_stat == GELIC_WL_ASSOC_STAT_ASSOCIATED) in gelic_wl_stop()
2544 gelic_wl_reset_state(wl); in gelic_wl_stop()
2577 struct gelic_wl_info *wl; in gelic_wl_setup_netdev_ops() local
2578 wl = port_wl(netdev_priv(netdev)); in gelic_wl_setup_netdev_ops()
2579 BUG_ON(!wl); in gelic_wl_setup_netdev_ops()
2584 netdev->wireless_data = &wl->wireless_data; in gelic_wl_setup_netdev_ops()
2635 struct gelic_wl_info *wl; in gelic_wl_driver_remove() local
2646 wl = port_wl(netdev_priv(netdev)); in gelic_wl_driver_remove()
2649 if (wl->assoc_stat == GELIC_WL_ASSOC_STAT_ASSOCIATED) in gelic_wl_driver_remove()
2652 complete(&wl->cmd_done_intr); in gelic_wl_driver_remove()
2655 cancel_delayed_work(&wl->assoc_work); in gelic_wl_driver_remove()
2656 cancel_delayed_work(&wl->event_work); in gelic_wl_driver_remove()
2657 flush_workqueue(wl->eurus_cmd_queue); in gelic_wl_driver_remove()
2658 flush_workqueue(wl->event_queue); in gelic_wl_driver_remove()
2667 gelic_wl_free(wl); in gelic_wl_driver_remove()