Lines Matching +full:assoc +full:- +full:select
1 // SPDX-License-Identifier: GPL-2.0-only
28 #include <linux/dma-mapping.h>
108 return "ASSOC"; in cmdstr()
150 pr_debug("%s: <-\n", __func__); in gelic_eurus_sync_cmd_worker()
152 BUG_ON(cmd_info[cmd->cmd].pre_arg && in gelic_eurus_sync_cmd_worker()
153 cmd_info[cmd->cmd].post_arg); in gelic_eurus_sync_cmd_worker()
154 wl = cmd->wl; in gelic_eurus_sync_cmd_worker()
157 if (cmd_info[cmd->cmd].pre_arg) { in gelic_eurus_sync_cmd_worker()
158 arg1 = (cmd->buffer) ? in gelic_eurus_sync_cmd_worker()
159 ps3_mm_phys_to_lpar(__pa(cmd->buffer)) : in gelic_eurus_sync_cmd_worker()
161 arg2 = cmd->buf_size; in gelic_eurus_sync_cmd_worker()
166 init_completion(&wl->cmd_done_intr); in gelic_eurus_sync_cmd_worker()
167 pr_debug("%s: cmd='%s' start\n", __func__, cmdstr(cmd->cmd)); in gelic_eurus_sync_cmd_worker()
168 cmd->status = lv1_net_control(bus_id(card), dev_id(card), in gelic_eurus_sync_cmd_worker()
170 cmd->cmd, arg1, arg2, in gelic_eurus_sync_cmd_worker()
171 &cmd->tag, &cmd->size); in gelic_eurus_sync_cmd_worker()
172 if (cmd->status) { in gelic_eurus_sync_cmd_worker()
173 complete(&cmd->done); in gelic_eurus_sync_cmd_worker()
178 wait_for_completion(&wl->cmd_done_intr); in gelic_eurus_sync_cmd_worker()
180 if (cmd_info[cmd->cmd].post_arg) { in gelic_eurus_sync_cmd_worker()
181 arg1 = ps3_mm_phys_to_lpar(__pa(cmd->buffer)); in gelic_eurus_sync_cmd_worker()
182 arg2 = cmd->buf_size; in gelic_eurus_sync_cmd_worker()
188 cmd->status = lv1_net_control(bus_id(card), dev_id(card), in gelic_eurus_sync_cmd_worker()
190 cmd->tag, arg1, arg2, in gelic_eurus_sync_cmd_worker()
191 &cmd->cmd_status, &cmd->size); in gelic_eurus_sync_cmd_worker()
193 if (cmd->status || cmd->cmd_status) { in gelic_eurus_sync_cmd_worker()
195 cmd->tag, arg1, arg2); in gelic_eurus_sync_cmd_worker()
197 __func__, cmd->status, cmd->cmd_status, cmd->size); in gelic_eurus_sync_cmd_worker()
200 complete(&cmd->done); in gelic_eurus_sync_cmd_worker()
201 pr_debug("%s: cmd='%s' done\n", __func__, cmdstr(cmd->cmd)); in gelic_eurus_sync_cmd_worker()
217 cmd->cmd = eurus_cmd; in gelic_eurus_sync_cmd()
218 cmd->buffer = buffer; in gelic_eurus_sync_cmd()
219 cmd->buf_size = buf_size; in gelic_eurus_sync_cmd()
220 cmd->wl = wl; in gelic_eurus_sync_cmd()
221 INIT_WORK(&cmd->work, gelic_eurus_sync_cmd_worker); in gelic_eurus_sync_cmd()
222 init_completion(&cmd->done); in gelic_eurus_sync_cmd()
223 queue_work(wl->eurus_cmd_queue, &cmd->work); in gelic_eurus_sync_cmd()
226 wait_for_completion(&cmd->done); in gelic_eurus_sync_cmd()
236 pr_debug("%s: <-\n", __func__); in gelic_wl_get_link()
237 mutex_lock(&wl->assoc_stat_lock); in gelic_wl_get_link()
238 if (wl->assoc_stat == GELIC_WL_ASSOC_STAT_ASSOCIATED) in gelic_wl_get_link()
242 mutex_unlock(&wl->assoc_stat_lock); in gelic_wl_get_link()
243 pr_debug("%s: ->\n", __func__); in gelic_wl_get_link()
268 strcpy(iwreq->name, "IEEE 802.11bg"); in gelic_wl_get_name()
278 if (!test_and_set_bit(GELIC_WL_STAT_CH_INFO, &wl->stat)) { in gelic_wl_get_ch_info()
287 wl->ch_info = 0x07ff;/* 11 ch */ in gelic_wl_get_ch_info()
290 wl->ch_info = ch_info_raw >> 48; in gelic_wl_get_ch_info()
299 struct iw_point *point = &iwreq->data; in gelic_wl_get_range()
304 pr_debug("%s: <-\n", __func__); in gelic_wl_get_range()
305 point->length = sizeof(struct iw_range); in gelic_wl_get_range()
308 range->we_version_compiled = WIRELESS_EXT; in gelic_wl_get_range()
309 range->we_version_source = 22; in gelic_wl_get_range()
316 if (wl->ch_info & (1 << i)) { in gelic_wl_get_range()
317 range->freq[chs].i = i + 1; in gelic_wl_get_range()
318 range->freq[chs].m = channel_freq[i]; in gelic_wl_get_range()
319 range->freq[chs].e = 6; in gelic_wl_get_range()
322 range->num_frequency = chs; in gelic_wl_get_range()
323 range->old_num_frequency = chs; in gelic_wl_get_range()
324 range->num_channels = chs; in gelic_wl_get_range()
325 range->old_num_channels = chs; in gelic_wl_get_range()
329 range->bitrate[i] = bitrate_list[i]; in gelic_wl_get_range()
330 range->num_bitrates = i; in gelic_wl_get_range()
333 range->max_qual.qual = 100; /* relative value */ in gelic_wl_get_range()
334 range->max_qual.level = 100; in gelic_wl_get_range()
335 range->avg_qual.qual = 50; in gelic_wl_get_range()
336 range->avg_qual.level = 50; in gelic_wl_get_range()
337 range->sensitivity = 0; in gelic_wl_get_range()
340 IW_EVENT_CAPA_SET_KERNEL(range->event_capa); in gelic_wl_get_range()
341 IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWAP); in gelic_wl_get_range()
342 IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWSCAN); in gelic_wl_get_range()
345 range->enc_capa = IW_ENC_CAPA_WPA | in gelic_wl_get_range()
349 range->enc_capa |= IW_ENC_CAPA_WPA2; in gelic_wl_get_range()
350 range->encoding_size[0] = 5; /* 40bit WEP */ in gelic_wl_get_range()
351 range->encoding_size[1] = 13; /* 104bit WEP */ in gelic_wl_get_range()
352 range->encoding_size[2] = 32; /* WPA-PSK */ in gelic_wl_get_range()
353 range->num_encoding_sizes = 3; in gelic_wl_get_range()
354 range->max_encoding_tokens = GELIC_WEP_KEYS; in gelic_wl_get_range()
357 range->scan_capa = IW_SCAN_CAPA_ESSID; in gelic_wl_get_range()
359 pr_debug("%s: ->\n", __func__); in gelic_wl_get_range()
374 if (wrqu->data.length == sizeof(struct iw_scan_req) && in gelic_wl_set_scan()
375 wrqu->data.flags & IW_SCAN_THIS_ESSID) { in gelic_wl_set_scan()
377 essid = req->essid; in gelic_wl_set_scan()
378 essid_len = req->essid_len; in gelic_wl_set_scan()
390 * See WiFi WPA specification and IEEE 802.11-2007 7.3.2.25
402 pr_debug("%s: <- sec=%16x\n", __func__, scan->security); in gelic_wl_synthesize_ie()
403 switch (be16_to_cpu(scan->security) & GELIC_EURUS_SCAN_SEC_MASK) { in gelic_wl_synthesize_ie()
415 switch (be16_to_cpu(scan->security) & GELIC_EURUS_SCAN_SEC_WPA_MASK) { in gelic_wl_synthesize_ie()
494 start[1] = (buf - start - 2); in gelic_wl_synthesize_ie()
496 pr_debug("%s: ->\n", __func__); in gelic_wl_synthesize_ie()
497 return buf - start; in gelic_wl_synthesize_ie()
525 data_left -= 2; in gelic_wl_parse_ie()
535 ie_info->wpa.data = pos - 2; in gelic_wl_parse_ie()
536 ie_info->wpa.len = item_len + 2; in gelic_wl_parse_ie()
540 ie_info->rsn.data = pos - 2; in gelic_wl_parse_ie()
542 ie_info->rsn.len = item_len + 2; in gelic_wl_parse_ie()
550 data_left -= item_len; in gelic_wl_parse_ie()
553 ie_info->wpa.data, ie_info->wpa.len, in gelic_wl_parse_ie()
554 ie_info->rsn.data, ie_info->rsn.len); in gelic_wl_parse_ie()
569 struct gelic_eurus_scan_info *scan = network->hwinfo; in gelic_wl_translate_scan()
575 pr_debug("%s: <-\n", __func__); in gelic_wl_translate_scan()
580 memcpy(iwe.u.ap_addr.sa_data, &scan->bssid[2], ETH_ALEN); in gelic_wl_translate_scan()
586 iwe.u.data.length = strnlen(scan->essid, 32); in gelic_wl_translate_scan()
587 ev = iwe_stream_add_point(info, ev, stop, &iwe, scan->essid); in gelic_wl_translate_scan()
591 iwe.u.freq.m = be16_to_cpu(scan->channel); in gelic_wl_translate_scan()
605 network->rate_len, network->rate_ext_len); in gelic_wl_translate_scan()
606 while (i < network->rate_len) { in gelic_wl_translate_scan()
607 if (j < network->rate_ext_len && in gelic_wl_translate_scan()
608 ((scan->ext_rate[j] & 0x7f) < (scan->rate[i] & 0x7f))) in gelic_wl_translate_scan()
609 rate = scan->ext_rate[j++] & 0x7f; in gelic_wl_translate_scan()
611 rate = scan->rate[i++] & 0x7f; in gelic_wl_translate_scan()
616 while (j < network->rate_ext_len) { in gelic_wl_translate_scan()
617 iwe.u.bitrate.value = (scan->ext_rate[j++] & 0x7f) * 500000; in gelic_wl_translate_scan()
622 if (iwe_stream_lcp_len(info) < (tmp - ev)) in gelic_wl_translate_scan()
627 if (be16_to_cpu(scan->capability) & WLAN_CAPABILITY_PRIVACY) in gelic_wl_translate_scan()
632 ev = iwe_stream_add_point(info, ev, stop, &iwe, scan->essid); in gelic_wl_translate_scan()
636 if (be16_to_cpu(scan->capability) & in gelic_wl_translate_scan()
638 if (be16_to_cpu(scan->capability) & WLAN_CAPABILITY_ESS) in gelic_wl_translate_scan()
649 iwe.u.qual.level = be16_to_cpu(scan->rssi); in gelic_wl_translate_scan()
650 iwe.u.qual.qual = be16_to_cpu(scan->rssi); in gelic_wl_translate_scan()
656 if (be16_to_cpu(scan->size) <= sizeof(*scan)) { in gelic_wl_translate_scan()
669 data_len = be16_to_cpu(scan->size) - sizeof(*scan); in gelic_wl_translate_scan()
671 gelic_wl_parse_ie(scan->elements, data_len, &ie_info); in gelic_wl_translate_scan()
689 pr_debug("%s: ->\n", __func__); in gelic_wl_translate_scan()
701 char *stop = ev + wrqu->data.length; in gelic_wl_get_scan()
705 pr_debug("%s: <-\n", __func__); in gelic_wl_get_scan()
706 if (mutex_lock_interruptible(&wl->scan_lock)) in gelic_wl_get_scan()
707 return -EAGAIN; in gelic_wl_get_scan()
709 switch (wl->scan_stat) { in gelic_wl_get_scan()
712 ret = -EAGAIN; in gelic_wl_get_scan()
716 ret = -ENODEV; in gelic_wl_get_scan()
723 list_for_each_entry(scan_info, &wl->network_list, list) { in gelic_wl_get_scan()
724 if (wl->scan_age == 0 || in gelic_wl_get_scan()
725 time_after(scan_info->last_scanned + wl->scan_age, in gelic_wl_get_scan()
733 if (stop - ev <= IW_EV_ADDR_LEN) { in gelic_wl_get_scan()
734 ret = -E2BIG; in gelic_wl_get_scan()
739 wrqu->data.length = ev - extra; in gelic_wl_get_scan()
740 wrqu->data.flags = 0; in gelic_wl_get_scan()
742 mutex_unlock(&wl->scan_lock); in gelic_wl_get_scan()
743 pr_debug("%s: -> %d %d\n", __func__, ret, wrqu->data.length); in gelic_wl_get_scan()
754 list_for_each_entry(scan_info, &wl->network_list, list) { in scan_list_dump()
757 scan_info->valid, scan_info->eurus_index, in scan_list_dump()
758 scan_info->last_scanned); in scan_list_dump()
760 scan_info->rate_len, scan_info->rate_ext_len, in scan_list_dump()
761 scan_info->essid_len); in scan_list_dump()
762 /* -- */ in scan_list_dump()
763 pr_debug("bssid=%pM\n", &scan_info->hwinfo->bssid[2]); in scan_list_dump()
764 pr_debug("essid=%s\n", scan_info->hwinfo->essid); in scan_list_dump()
773 struct iw_param *param = &data->param; in gelic_wl_set_auth()
778 pr_debug("%s: <- %d\n", __func__, param->flags & IW_AUTH_INDEX); in gelic_wl_set_auth()
779 spin_lock_irqsave(&wl->lock, irqflag); in gelic_wl_set_auth()
780 switch (param->flags & IW_AUTH_INDEX) { in gelic_wl_set_auth()
782 if (param->value & IW_AUTH_WPA_VERSION_DISABLED) { in gelic_wl_set_auth()
784 wl->wpa_level = GELIC_WL_WPA_LEVEL_NONE; in gelic_wl_set_auth()
785 wl->group_cipher_method = GELIC_WL_CIPHER_WEP; in gelic_wl_set_auth()
786 wl->pairwise_cipher_method = GELIC_WL_CIPHER_WEP; in gelic_wl_set_auth()
788 if (param->value & IW_AUTH_WPA_VERSION_WPA) { in gelic_wl_set_auth()
790 wl->wpa_level = GELIC_WL_WPA_LEVEL_WPA; in gelic_wl_set_auth()
791 wl->group_cipher_method = GELIC_WL_CIPHER_TKIP; in gelic_wl_set_auth()
792 wl->pairwise_cipher_method = GELIC_WL_CIPHER_TKIP; in gelic_wl_set_auth()
793 wl->auth_method = GELIC_EURUS_AUTH_OPEN; in gelic_wl_set_auth()
795 if (param->value & IW_AUTH_WPA_VERSION_WPA2) { in gelic_wl_set_auth()
808 wl->wpa_level = GELIC_WL_WPA_LEVEL_WPA2; in gelic_wl_set_auth()
809 wl->group_cipher_method = GELIC_WL_CIPHER_AES; in gelic_wl_set_auth()
810 wl->pairwise_cipher_method = in gelic_wl_set_auth()
812 wl->auth_method = GELIC_EURUS_AUTH_OPEN; in gelic_wl_set_auth()
814 ret = -EINVAL; in gelic_wl_set_auth()
819 if (param->value & in gelic_wl_set_auth()
822 wl->pairwise_cipher_method = GELIC_WL_CIPHER_WEP; in gelic_wl_set_auth()
824 if (param->value & IW_AUTH_CIPHER_TKIP) { in gelic_wl_set_auth()
826 wl->pairwise_cipher_method = GELIC_WL_CIPHER_TKIP; in gelic_wl_set_auth()
828 if (param->value & IW_AUTH_CIPHER_CCMP) { in gelic_wl_set_auth()
830 wl->pairwise_cipher_method = GELIC_WL_CIPHER_AES; in gelic_wl_set_auth()
832 if (param->value & IW_AUTH_CIPHER_NONE) { in gelic_wl_set_auth()
834 wl->pairwise_cipher_method = GELIC_WL_CIPHER_NONE; in gelic_wl_set_auth()
838 if (param->value & in gelic_wl_set_auth()
841 wl->group_cipher_method = GELIC_WL_CIPHER_WEP; in gelic_wl_set_auth()
843 if (param->value & IW_AUTH_CIPHER_TKIP) { in gelic_wl_set_auth()
845 wl->group_cipher_method = GELIC_WL_CIPHER_TKIP; in gelic_wl_set_auth()
847 if (param->value & IW_AUTH_CIPHER_CCMP) { in gelic_wl_set_auth()
849 wl->group_cipher_method = GELIC_WL_CIPHER_AES; in gelic_wl_set_auth()
851 if (param->value & IW_AUTH_CIPHER_NONE) { in gelic_wl_set_auth()
853 wl->group_cipher_method = GELIC_WL_CIPHER_NONE; in gelic_wl_set_auth()
857 if (param->value & IW_AUTH_ALG_SHARED_KEY) { in gelic_wl_set_auth()
859 wl->auth_method = GELIC_EURUS_AUTH_SHARED; in gelic_wl_set_auth()
860 } else if (param->value & IW_AUTH_ALG_OPEN_SYSTEM) { in gelic_wl_set_auth()
862 wl->auth_method = GELIC_EURUS_AUTH_OPEN; in gelic_wl_set_auth()
864 ret = -EINVAL; in gelic_wl_set_auth()
868 if (param->value) { in gelic_wl_set_auth()
870 wl->wpa_level = GELIC_WL_WPA_LEVEL_WPA; in gelic_wl_set_auth()
873 wl->wpa_level = GELIC_WL_WPA_LEVEL_NONE; in gelic_wl_set_auth()
878 if (param->value & IW_AUTH_KEY_MGMT_PSK) in gelic_wl_set_auth()
882 ret = -EOPNOTSUPP; in gelic_wl_set_auth()
887 set_bit(GELIC_WL_STAT_CONFIGURED, &wl->stat); in gelic_wl_set_auth()
889 spin_unlock_irqrestore(&wl->lock, irqflag); in gelic_wl_set_auth()
890 pr_debug("%s: -> %d\n", __func__, ret); in gelic_wl_set_auth()
898 struct iw_param *param = &iwreq->param; in gelic_wl_get_auth()
903 pr_debug("%s: <- %d\n", __func__, param->flags & IW_AUTH_INDEX); in gelic_wl_get_auth()
904 spin_lock_irqsave(&wl->lock, irqflag); in gelic_wl_get_auth()
905 switch (param->flags & IW_AUTH_INDEX) { in gelic_wl_get_auth()
907 switch (wl->wpa_level) { in gelic_wl_get_auth()
909 param->value |= IW_AUTH_WPA_VERSION_WPA; in gelic_wl_get_auth()
912 param->value |= IW_AUTH_WPA_VERSION_WPA2; in gelic_wl_get_auth()
915 param->value |= IW_AUTH_WPA_VERSION_DISABLED; in gelic_wl_get_auth()
920 if (wl->auth_method == GELIC_EURUS_AUTH_SHARED) in gelic_wl_get_auth()
921 param->value = IW_AUTH_ALG_SHARED_KEY; in gelic_wl_get_auth()
922 else if (wl->auth_method == GELIC_EURUS_AUTH_OPEN) in gelic_wl_get_auth()
923 param->value = IW_AUTH_ALG_OPEN_SYSTEM; in gelic_wl_get_auth()
927 switch (wl->wpa_level) { in gelic_wl_get_auth()
930 param->value = 1; in gelic_wl_get_auth()
933 param->value = 0; in gelic_wl_get_auth()
938 ret = -EOPNOTSUPP; in gelic_wl_get_auth()
941 spin_unlock_irqrestore(&wl->lock, irqflag); in gelic_wl_get_auth()
942 pr_debug("%s: -> %d\n", __func__, ret); in gelic_wl_get_auth()
954 pr_debug("%s: <- l=%d f=%d\n", __func__, in gelic_wl_set_essid()
955 data->essid.length, data->essid.flags); in gelic_wl_set_essid()
956 if (IW_ESSID_MAX_SIZE < data->essid.length) in gelic_wl_set_essid()
957 return -EINVAL; in gelic_wl_set_essid()
959 spin_lock_irqsave(&wl->lock, irqflag); in gelic_wl_set_essid()
960 if (data->essid.flags) { in gelic_wl_set_essid()
961 wl->essid_len = data->essid.length; in gelic_wl_set_essid()
962 memcpy(wl->essid, extra, wl->essid_len); in gelic_wl_set_essid()
964 set_bit(GELIC_WL_STAT_ESSID_SET, &wl->stat); in gelic_wl_set_essid()
967 clear_bit(GELIC_WL_STAT_ESSID_SET, &wl->stat); in gelic_wl_set_essid()
969 set_bit(GELIC_WL_STAT_CONFIGURED, &wl->stat); in gelic_wl_set_essid()
970 spin_unlock_irqrestore(&wl->lock, irqflag); in gelic_wl_set_essid()
974 pr_debug("%s: ->\n", __func__); in gelic_wl_set_essid()
985 pr_debug("%s: <-\n", __func__); in gelic_wl_get_essid()
986 mutex_lock(&wl->assoc_stat_lock); in gelic_wl_get_essid()
987 spin_lock_irqsave(&wl->lock, irqflag); in gelic_wl_get_essid()
988 if (test_bit(GELIC_WL_STAT_ESSID_SET, &wl->stat) || in gelic_wl_get_essid()
989 wl->assoc_stat == GELIC_WL_ASSOC_STAT_ASSOCIATED) { in gelic_wl_get_essid()
990 memcpy(extra, wl->essid, wl->essid_len); in gelic_wl_get_essid()
991 data->essid.length = wl->essid_len; in gelic_wl_get_essid()
992 data->essid.flags = 1; in gelic_wl_get_essid()
994 data->essid.flags = 0; in gelic_wl_get_essid()
996 mutex_unlock(&wl->assoc_stat_lock); in gelic_wl_get_essid()
997 spin_unlock_irqrestore(&wl->lock, irqflag); in gelic_wl_get_essid()
998 pr_debug("%s: -> len=%d\n", __func__, data->essid.length); in gelic_wl_get_essid()
1009 struct iw_point *enc = &data->encoding; in gelic_wl_set_encode()
1015 pr_debug("%s: <-\n", __func__); in gelic_wl_set_encode()
1016 flags = enc->flags & IW_ENCODE_FLAGS; in gelic_wl_set_encode()
1017 key_index = enc->flags & IW_ENCODE_INDEX; in gelic_wl_set_encode()
1020 pr_debug("%s: key_len = %d\n", __func__, enc->length); in gelic_wl_set_encode()
1021 pr_debug("%s: flag=%x\n", __func__, enc->flags & IW_ENCODE_FLAGS); in gelic_wl_set_encode()
1024 return -EINVAL; in gelic_wl_set_encode()
1026 spin_lock_irqsave(&wl->lock, irqflag); in gelic_wl_set_encode()
1029 key_index--; in gelic_wl_set_encode()
1032 key_index = wl->current_key; in gelic_wl_set_encode()
1038 wl->current_key = key_index; in gelic_wl_set_encode()
1045 wl->group_cipher_method = GELIC_WL_CIPHER_NONE; in gelic_wl_set_encode()
1046 wl->pairwise_cipher_method = in gelic_wl_set_encode()
1049 wl->key_enabled = 0; in gelic_wl_set_encode()
1051 clear_bit(key_index, &wl->key_enabled); in gelic_wl_set_encode()
1055 wl->auth_method = GELIC_EURUS_AUTH_OPEN; in gelic_wl_set_encode()
1058 wl->auth_method = GELIC_EURUS_AUTH_SHARED; in gelic_wl_set_encode()
1061 if (IW_ENCODING_TOKEN_MAX < enc->length) { in gelic_wl_set_encode()
1062 ret = -EINVAL; in gelic_wl_set_encode()
1065 wl->key_len[key_index] = enc->length; in gelic_wl_set_encode()
1066 memcpy(wl->key[key_index], extra, enc->length); in gelic_wl_set_encode()
1067 set_bit(key_index, &wl->key_enabled); in gelic_wl_set_encode()
1068 wl->pairwise_cipher_method = GELIC_WL_CIPHER_WEP; in gelic_wl_set_encode()
1069 wl->group_cipher_method = GELIC_WL_CIPHER_WEP; in gelic_wl_set_encode()
1071 set_bit(GELIC_WL_STAT_CONFIGURED, &wl->stat); in gelic_wl_set_encode()
1073 spin_unlock_irqrestore(&wl->lock, irqflag); in gelic_wl_set_encode()
1074 pr_debug("%s: ->\n", __func__); in gelic_wl_set_encode()
1083 struct iw_point *enc = &data->encoding; in gelic_wl_get_encode()
1088 pr_debug("%s: <-\n", __func__); in gelic_wl_get_encode()
1089 key_index = enc->flags & IW_ENCODE_INDEX; in gelic_wl_get_encode()
1091 enc->flags, enc->pointer, enc->length, extra); in gelic_wl_get_encode()
1093 return -EINVAL; in gelic_wl_get_encode()
1095 spin_lock_irqsave(&wl->lock, irqflag); in gelic_wl_get_encode()
1097 key_index--; in gelic_wl_get_encode()
1099 key_index = wl->current_key; in gelic_wl_get_encode()
1101 if (wl->group_cipher_method == GELIC_WL_CIPHER_WEP) { in gelic_wl_get_encode()
1102 switch (wl->auth_method) { in gelic_wl_get_encode()
1104 enc->flags = IW_ENCODE_OPEN; in gelic_wl_get_encode()
1107 enc->flags = IW_ENCODE_RESTRICTED; in gelic_wl_get_encode()
1111 enc->flags = IW_ENCODE_DISABLED; in gelic_wl_get_encode()
1113 if (test_bit(key_index, &wl->key_enabled)) { in gelic_wl_get_encode()
1114 if (enc->length < wl->key_len[key_index]) { in gelic_wl_get_encode()
1115 ret = -EINVAL; in gelic_wl_get_encode()
1118 enc->length = wl->key_len[key_index]; in gelic_wl_get_encode()
1119 memcpy(extra, wl->key[key_index], wl->key_len[key_index]); in gelic_wl_get_encode()
1121 enc->length = 0; in gelic_wl_get_encode()
1122 enc->flags |= IW_ENCODE_NOKEY; in gelic_wl_get_encode()
1124 enc->flags |= key_index + 1; in gelic_wl_get_encode()
1125 pr_debug("%s: -> flag=%x len=%d\n", __func__, in gelic_wl_get_encode()
1126 enc->flags, enc->length); in gelic_wl_get_encode()
1129 spin_unlock_irqrestore(&wl->lock, irqflag); in gelic_wl_get_encode()
1141 pr_debug("%s: <-\n", __func__); in gelic_wl_set_ap()
1142 if (data->ap_addr.sa_family != ARPHRD_ETHER) in gelic_wl_set_ap()
1143 return -EINVAL; in gelic_wl_set_ap()
1145 spin_lock_irqsave(&wl->lock, irqflag); in gelic_wl_set_ap()
1146 if (is_valid_ether_addr(data->ap_addr.sa_data)) { in gelic_wl_set_ap()
1147 memcpy(wl->bssid, data->ap_addr.sa_data, in gelic_wl_set_ap()
1149 set_bit(GELIC_WL_STAT_BSSID_SET, &wl->stat); in gelic_wl_set_ap()
1150 set_bit(GELIC_WL_STAT_CONFIGURED, &wl->stat); in gelic_wl_set_ap()
1151 pr_debug("%s: bss=%pM\n", __func__, wl->bssid); in gelic_wl_set_ap()
1154 clear_bit(GELIC_WL_STAT_BSSID_SET, &wl->stat); in gelic_wl_set_ap()
1155 eth_zero_addr(wl->bssid); in gelic_wl_set_ap()
1157 spin_unlock_irqrestore(&wl->lock, irqflag); in gelic_wl_set_ap()
1158 pr_debug("%s: ->\n", __func__); in gelic_wl_set_ap()
1169 pr_debug("%s: <-\n", __func__); in gelic_wl_get_ap()
1170 mutex_lock(&wl->assoc_stat_lock); in gelic_wl_get_ap()
1171 spin_lock_irqsave(&wl->lock, irqflag); in gelic_wl_get_ap()
1172 if (wl->assoc_stat == GELIC_WL_ASSOC_STAT_ASSOCIATED) { in gelic_wl_get_ap()
1173 data->ap_addr.sa_family = ARPHRD_ETHER; in gelic_wl_get_ap()
1174 memcpy(data->ap_addr.sa_data, wl->active_bssid, in gelic_wl_get_ap()
1177 eth_zero_addr(data->ap_addr.sa_data); in gelic_wl_get_ap()
1179 spin_unlock_irqrestore(&wl->lock, irqflag); in gelic_wl_get_ap()
1180 mutex_unlock(&wl->assoc_stat_lock); in gelic_wl_get_ap()
1181 pr_debug("%s: ->\n", __func__); in gelic_wl_get_ap()
1191 struct iw_point *enc = &data->encoding; in gelic_wl_set_encodeext()
1199 pr_debug("%s: <-\n", __func__); in gelic_wl_set_encodeext()
1200 flags = enc->flags & IW_ENCODE_FLAGS; in gelic_wl_set_encodeext()
1201 alg = ext->alg; in gelic_wl_set_encodeext()
1202 key_index = enc->flags & IW_ENCODE_INDEX; in gelic_wl_set_encodeext()
1205 pr_debug("%s: key_len = %d\n", __func__, enc->length); in gelic_wl_set_encodeext()
1206 pr_debug("%s: flag=%x\n", __func__, enc->flags & IW_ENCODE_FLAGS); in gelic_wl_set_encodeext()
1207 pr_debug("%s: ext_flag=%x\n", __func__, ext->ext_flags); in gelic_wl_set_encodeext()
1208 pr_debug("%s: ext_key_len=%x\n", __func__, ext->key_len); in gelic_wl_set_encodeext()
1211 return -EINVAL; in gelic_wl_set_encodeext()
1213 spin_lock_irqsave(&wl->lock, irqflag); in gelic_wl_set_encodeext()
1215 key_index--; in gelic_wl_set_encodeext()
1217 key_index = wl->current_key; in gelic_wl_set_encodeext()
1219 if (!enc->length && (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY)) { in gelic_wl_set_encodeext()
1223 wl->current_key = key_index; in gelic_wl_set_encodeext()
1229 wl->wpa_level = GELIC_WL_WPA_LEVEL_NONE; in gelic_wl_set_encodeext()
1230 wl->group_cipher_method = GELIC_WL_CIPHER_NONE; in gelic_wl_set_encodeext()
1231 wl->pairwise_cipher_method = GELIC_WL_CIPHER_NONE; in gelic_wl_set_encodeext()
1232 wl->auth_method = GELIC_EURUS_AUTH_OPEN; /* should be open */ in gelic_wl_set_encodeext()
1237 wl->auth_method = GELIC_EURUS_AUTH_OPEN; in gelic_wl_set_encodeext()
1241 wl->auth_method = GELIC_EURUS_AUTH_SHARED; in gelic_wl_set_encodeext()
1243 if (IW_ENCODING_TOKEN_MAX < ext->key_len) { in gelic_wl_set_encodeext()
1245 ext->key_len); in gelic_wl_set_encodeext()
1246 ret = -EINVAL; in gelic_wl_set_encodeext()
1250 wl->key_len[key_index] = ext->key_len; in gelic_wl_set_encodeext()
1251 memset(wl->key[key_index], 0, IW_ENCODING_TOKEN_MAX); in gelic_wl_set_encodeext()
1252 memcpy(wl->key[key_index], ext->key, ext->key_len); in gelic_wl_set_encodeext()
1253 set_bit(key_index, &wl->key_enabled); in gelic_wl_set_encodeext()
1255 set_bit(GELIC_WL_STAT_CONFIGURED, &wl->stat); in gelic_wl_set_encodeext()
1257 if (ext->key_len != WPA_PSK_LEN) { in gelic_wl_set_encodeext()
1259 ext->key_len); in gelic_wl_set_encodeext()
1260 ret = -EINVAL; in gelic_wl_set_encodeext()
1263 memset(wl->psk, 0, sizeof(wl->psk)); in gelic_wl_set_encodeext()
1264 memcpy(wl->psk, ext->key, ext->key_len); in gelic_wl_set_encodeext()
1265 wl->psk_len = ext->key_len; in gelic_wl_set_encodeext()
1266 wl->psk_type = GELIC_EURUS_WPA_PSK_BIN; in gelic_wl_set_encodeext()
1268 set_bit(GELIC_WL_STAT_WPA_PSK_SET, &wl->stat); in gelic_wl_set_encodeext()
1271 spin_unlock_irqrestore(&wl->lock, irqflag); in gelic_wl_set_encodeext()
1272 pr_debug("%s: ->\n", __func__); in gelic_wl_set_encodeext()
1281 struct iw_point *enc = &data->encoding; in gelic_wl_get_encodeext()
1288 pr_debug("%s: <-\n", __func__); in gelic_wl_get_encodeext()
1290 max_key_len = enc->length - sizeof(struct iw_encode_ext); in gelic_wl_get_encodeext()
1292 return -EINVAL; in gelic_wl_get_encodeext()
1293 key_index = enc->flags & IW_ENCODE_INDEX; in gelic_wl_get_encodeext()
1296 pr_debug("%s: key_len = %d\n", __func__, enc->length); in gelic_wl_get_encodeext()
1297 pr_debug("%s: flag=%x\n", __func__, enc->flags & IW_ENCODE_FLAGS); in gelic_wl_get_encodeext()
1300 return -EINVAL; in gelic_wl_get_encodeext()
1302 spin_lock_irqsave(&wl->lock, irqflag); in gelic_wl_get_encodeext()
1304 key_index--; in gelic_wl_get_encodeext()
1306 key_index = wl->current_key; in gelic_wl_get_encodeext()
1309 switch (wl->group_cipher_method) { in gelic_wl_get_encodeext()
1311 ext->alg = IW_ENCODE_ALG_WEP; in gelic_wl_get_encodeext()
1312 enc->flags |= IW_ENCODE_ENABLED; in gelic_wl_get_encodeext()
1315 ext->alg = IW_ENCODE_ALG_TKIP; in gelic_wl_get_encodeext()
1316 enc->flags |= IW_ENCODE_ENABLED; in gelic_wl_get_encodeext()
1319 ext->alg = IW_ENCODE_ALG_CCMP; in gelic_wl_get_encodeext()
1320 enc->flags |= IW_ENCODE_ENABLED; in gelic_wl_get_encodeext()
1324 ext->alg = IW_ENCODE_ALG_NONE; in gelic_wl_get_encodeext()
1325 enc->flags |= IW_ENCODE_NOKEY; in gelic_wl_get_encodeext()
1329 if (!(enc->flags & IW_ENCODE_NOKEY)) { in gelic_wl_get_encodeext()
1330 if (max_key_len < wl->key_len[key_index]) { in gelic_wl_get_encodeext()
1331 ret = -E2BIG; in gelic_wl_get_encodeext()
1334 if (test_bit(key_index, &wl->key_enabled)) in gelic_wl_get_encodeext()
1335 memcpy(ext->key, wl->key[key_index], in gelic_wl_get_encodeext()
1336 wl->key_len[key_index]); in gelic_wl_get_encodeext()
1342 spin_unlock_irqrestore(&wl->lock, irqflag); in gelic_wl_get_encodeext()
1343 pr_debug("%s: ->\n", __func__); in gelic_wl_get_encodeext()
1351 __u32 mode = data->mode; in gelic_wl_set_mode()
1354 pr_debug("%s: <-\n", __func__); in gelic_wl_set_mode()
1358 ret = -EOPNOTSUPP; in gelic_wl_set_mode()
1359 pr_debug("%s: -> %d\n", __func__, ret); in gelic_wl_set_mode()
1367 __u32 *mode = &data->mode; in gelic_wl_get_mode()
1368 pr_debug("%s: <-\n", __func__); in gelic_wl_get_mode()
1370 pr_debug("%s: ->\n", __func__); in gelic_wl_get_mode()
1380 data->data.length = strlen(extra); in gelic_wl_get_nick()
1381 data->data.flags = 1; in gelic_wl_get_nick()
1386 /* --- */
1398 pr_debug("%s: <-\n", __func__); in gelic_wl_get_wireless_stats()
1404 is = &wl->iwstat; in gelic_wl_get_wireless_stats()
1408 if (cmd && !cmd->status && !cmd->cmd_status) { in gelic_wl_get_wireless_stats()
1410 is->qual.level = be16_to_cpu(rssi->rssi); in gelic_wl_get_wireless_stats()
1411 is->qual.updated = IW_QUAL_LEVEL_UPDATED | in gelic_wl_get_wireless_stats()
1415 is->qual.updated = IW_QUAL_ALL_INVALID; in gelic_wl_get_wireless_stats()
1419 pr_debug("%s: ->\n", __func__); in gelic_wl_get_wireless_stats()
1434 pr_debug("%s: <- always=%d\n", __func__, always_scan); in gelic_wl_start_scan()
1435 if (mutex_lock_interruptible(&wl->scan_lock)) in gelic_wl_start_scan()
1436 return -ERESTARTSYS; in gelic_wl_start_scan()
1441 if (wl->scan_stat == GELIC_WL_SCAN_STAT_SCANNING) { in gelic_wl_start_scan()
1446 init_completion(&wl->scan_done); in gelic_wl_start_scan()
1452 && wl->scan_stat == GELIC_WL_SCAN_STAT_GOT_LIST) { in gelic_wl_start_scan()
1454 complete(&wl->scan_done); in gelic_wl_start_scan()
1462 ret = -ENOMEM; in gelic_wl_start_scan()
1475 wl->scan_stat = GELIC_WL_SCAN_STAT_SCANNING; in gelic_wl_start_scan()
1478 if (!cmd || cmd->status || cmd->cmd_status) { in gelic_wl_start_scan()
1479 wl->scan_stat = GELIC_WL_SCAN_STAT_INIT; in gelic_wl_start_scan()
1480 complete(&wl->scan_done); in gelic_wl_start_scan()
1481 ret = -ENOMEM; in gelic_wl_start_scan()
1487 mutex_unlock(&wl->scan_lock); in gelic_wl_start_scan()
1488 pr_debug("%s: ->\n", __func__); in gelic_wl_start_scan()
1509 mutex_lock(&wl->scan_lock); in gelic_wl_scan_complete_event()
1517 if (wl->scan_stat != GELIC_WL_SCAN_STAT_SCANNING) { in gelic_wl_scan_complete_event()
1522 __func__, wl->scan_stat); in gelic_wl_scan_complete_event()
1528 if (!cmd || cmd->status || cmd->cmd_status) { in gelic_wl_scan_complete_event()
1529 wl->scan_stat = GELIC_WL_SCAN_STAT_INIT; in gelic_wl_scan_complete_event()
1534 data_len = cmd->size; in gelic_wl_scan_complete_event()
1539 wl->scan_stat = GELIC_WL_SCAN_STAT_GOT_LIST; in gelic_wl_scan_complete_event()
1542 list_for_each_entry_safe(target, tmp, &wl->network_list, list) { in gelic_wl_scan_complete_event()
1543 target->valid = 0; in gelic_wl_scan_complete_event()
1545 if (time_before(target->last_scanned + wl->scan_age, in gelic_wl_scan_complete_event()
1547 kfree(target->hwinfo); in gelic_wl_scan_complete_event()
1548 target->hwinfo = NULL; in gelic_wl_scan_complete_event()
1549 list_move_tail(&target->list, &wl->network_free_list); in gelic_wl_scan_complete_event()
1556 i++, scan_info_size += be16_to_cpu(scan_info->size), in gelic_wl_scan_complete_event()
1557 scan_info = (void *)scan_info + be16_to_cpu(scan_info->size)) { in gelic_wl_scan_complete_event()
1559 be16_to_cpu(scan_info->size), in gelic_wl_scan_complete_event()
1560 &scan_info->bssid[2], scan_info); in gelic_wl_scan_complete_event()
1567 if (!be16_to_cpu(scan_info->channel) || !scan_info->rate[0]) { in gelic_wl_scan_complete_event()
1574 list_for_each_entry(target, &wl->network_list, list) { in gelic_wl_scan_complete_event()
1575 if (ether_addr_equal(&target->hwinfo->bssid[2], in gelic_wl_scan_complete_event()
1576 &scan_info->bssid[2])) { in gelic_wl_scan_complete_event()
1583 (target->last_scanned < oldest->last_scanned)) in gelic_wl_scan_complete_event()
1589 if (list_empty(&wl->network_free_list)) { in gelic_wl_scan_complete_event()
1593 target = list_entry(wl->network_free_list.next, in gelic_wl_scan_complete_event()
1600 target->last_scanned = this_time; in gelic_wl_scan_complete_event()
1601 target->valid = 1; in gelic_wl_scan_complete_event()
1602 target->eurus_index = i; in gelic_wl_scan_complete_event()
1603 kfree(target->hwinfo); in gelic_wl_scan_complete_event()
1604 target->hwinfo = kmemdup(scan_info, in gelic_wl_scan_complete_event()
1605 be16_to_cpu(scan_info->size), in gelic_wl_scan_complete_event()
1607 if (!target->hwinfo) in gelic_wl_scan_complete_event()
1611 target->essid_len = strnlen(scan_info->essid, in gelic_wl_scan_complete_event()
1612 sizeof(scan_info->essid)); in gelic_wl_scan_complete_event()
1613 target->rate_len = 0; in gelic_wl_scan_complete_event()
1615 if (scan_info->rate[r]) in gelic_wl_scan_complete_event()
1616 target->rate_len++; in gelic_wl_scan_complete_event()
1617 if (8 < target->rate_len) in gelic_wl_scan_complete_event()
1619 target->rate_len); in gelic_wl_scan_complete_event()
1620 target->rate_ext_len = 0; in gelic_wl_scan_complete_event()
1622 if (scan_info->ext_rate[r]) in gelic_wl_scan_complete_event()
1623 target->rate_ext_len++; in gelic_wl_scan_complete_event()
1624 list_move_tail(&target->list, &wl->network_list); in gelic_wl_scan_complete_event()
1631 complete(&wl->scan_done); in gelic_wl_scan_complete_event()
1632 mutex_unlock(&wl->scan_lock); in gelic_wl_scan_complete_event()
1637 * Select an appropriate bss from current scan list regarding
1639 * The caller must hold wl->scan_lock,
1640 * and on the state of wl->scan_state == GELIC_WL_SCAN_GOT_LIST
1661 pr_debug("%s: <-\n", __func__); in gelic_wl_find_best_bss()
1666 list_for_each_entry(scan_info, &wl->network_list, list) { in gelic_wl_find_best_bss()
1669 if (!scan_info->valid) { in gelic_wl_find_best_bss()
1675 if (test_bit(GELIC_WL_STAT_BSSID_SET, &wl->stat)) { in gelic_wl_find_best_bss()
1676 if (ether_addr_equal(&scan_info->hwinfo->bssid[2], in gelic_wl_find_best_bss()
1677 wl->bssid)) { in gelic_wl_find_best_bss()
1690 security = be16_to_cpu(scan_info->hwinfo->security) & in gelic_wl_find_best_bss()
1692 if (wl->wpa_level == GELIC_WL_WPA_LEVEL_WPA2) { in gelic_wl_find_best_bss()
1698 } else if (wl->wpa_level == GELIC_WL_WPA_LEVEL_WPA) { in gelic_wl_find_best_bss()
1704 } else if (wl->wpa_level == GELIC_WL_WPA_LEVEL_NONE && in gelic_wl_find_best_bss()
1705 wl->group_cipher_method == GELIC_WL_CIPHER_WEP) { in gelic_wl_find_best_bss()
1714 if (test_bit(GELIC_WL_STAT_ESSID_SET, &wl->stat)) { in gelic_wl_find_best_bss()
1715 if ((scan_info->essid_len == wl->essid_len) && in gelic_wl_find_best_bss()
1716 !strncmp(wl->essid, in gelic_wl_find_best_bss()
1717 scan_info->hwinfo->essid, in gelic_wl_find_best_bss()
1718 scan_info->essid_len)) in gelic_wl_find_best_bss()
1727 pr_debug("%s: -> bss=%p\n", __func__, best_bss); in gelic_wl_find_best_bss()
1730 &best_bss->hwinfo->bssid[2]); in gelic_wl_find_best_bss()
1738 * The caller must hold wl->scan_lock,
1739 * and on the state of wl->scan_state == GELIC_WL_SCAN_GOT_LIST
1750 pr_debug("%s: <-\n", __func__); in gelic_wl_do_wep_setup()
1754 return -ENOMEM; in gelic_wl_do_wep_setup()
1758 if (wl->group_cipher_method == GELIC_WL_CIPHER_WEP) { in gelic_wl_do_wep_setup()
1761 if (!test_bit(i, &wl->key_enabled)) in gelic_wl_do_wep_setup()
1766 if (wl->key_len[i] == 13) in gelic_wl_do_wep_setup()
1768 else if (wl->key_len[i] != 5) { in gelic_wl_do_wep_setup()
1770 __func__, i, wl->key_len[i]); in gelic_wl_do_wep_setup()
1771 ret = -EINVAL; in gelic_wl_do_wep_setup()
1774 memcpy(wep->key[i], wl->key[i], wl->key_len[i]); in gelic_wl_do_wep_setup()
1779 ret = -EINVAL; in gelic_wl_do_wep_setup()
1785 wep->security = cpu_to_be16(GELIC_EURUS_WEP_SEC_104BIT); in gelic_wl_do_wep_setup()
1788 wep->security = cpu_to_be16(GELIC_EURUS_WEP_SEC_40BIT); in gelic_wl_do_wep_setup()
1792 wep->security = cpu_to_be16(GELIC_EURUS_WEP_SEC_NONE); in gelic_wl_do_wep_setup()
1799 ret = -ENOMEM; in gelic_wl_do_wep_setup()
1800 else if (cmd->status || cmd->cmd_status) in gelic_wl_do_wep_setup()
1801 ret = -ENXIO; in gelic_wl_do_wep_setup()
1806 pr_debug("%s: ->\n", __func__); in gelic_wl_do_wep_setup()
1840 pr_debug("%s: <-\n", __func__); in gelic_wl_do_wpa_setup()
1844 return -ENOMEM; in gelic_wl_do_wpa_setup()
1848 if (!test_bit(GELIC_WL_STAT_WPA_PSK_SET, &wl->stat)) in gelic_wl_do_wpa_setup()
1852 memcpy(wpa->psk, wl->psk, wl->psk_len); in gelic_wl_do_wpa_setup()
1855 if (wl->wpa_level == GELIC_WL_WPA_LEVEL_WPA2) { in gelic_wl_do_wpa_setup()
1856 if (wl->group_cipher_method == GELIC_WL_CIPHER_AES) { in gelic_wl_do_wpa_setup()
1859 if (wl->pairwise_cipher_method == GELIC_WL_CIPHER_AES && in gelic_wl_do_wpa_setup()
1866 if (wl->group_cipher_method == GELIC_WL_CIPHER_AES) { in gelic_wl_do_wpa_setup()
1869 if (wl->pairwise_cipher_method == GELIC_WL_CIPHER_AES && in gelic_wl_do_wpa_setup()
1876 wpa->security = cpu_to_be16(security); in gelic_wl_do_wpa_setup()
1879 wpa->psk_type = cpu_to_be16(wl->psk_type); in gelic_wl_do_wpa_setup()
1882 wpasecstr(wpa->security), in gelic_wl_do_wpa_setup()
1883 (wpa->psk_type == GELIC_EURUS_WPA_PSK_BIN) ? in gelic_wl_do_wpa_setup()
1892 (wpa->psk_type == GELIC_EURUS_WPA_PSK_BIN) ? in gelic_wl_do_wpa_setup()
1893 "N/A" : wpa->psk); in gelic_wl_do_wpa_setup()
1900 ret = -ENOMEM; in gelic_wl_do_wpa_setup()
1901 else if (cmd->status || cmd->cmd_status) in gelic_wl_do_wpa_setup()
1902 ret = -ENXIO; in gelic_wl_do_wpa_setup()
1905 pr_debug("%s: --> %d\n", __func__, ret); in gelic_wl_do_wpa_setup()
1920 pr_debug("%s: <-\n", __func__); in gelic_wl_associate_bss()
1925 return -ENOMEM; in gelic_wl_associate_bss()
1928 common->bss_type = cpu_to_be16(GELIC_EURUS_BSS_INFRA); in gelic_wl_associate_bss()
1929 common->op_mode = cpu_to_be16(GELIC_EURUS_OPMODE_11BG); in gelic_wl_associate_bss()
1931 common->scan_index = cpu_to_be16(bss->eurus_index); in gelic_wl_associate_bss()
1932 switch (wl->auth_method) { in gelic_wl_associate_bss()
1934 common->auth_method = cpu_to_be16(GELIC_EURUS_AUTH_OPEN); in gelic_wl_associate_bss()
1937 common->auth_method = cpu_to_be16(GELIC_EURUS_AUTH_SHARED); in gelic_wl_associate_bss()
1945 be16_to_cpu(common->scan_index), in gelic_wl_associate_bss()
1946 be16_to_cpu(common->bss_type), in gelic_wl_associate_bss()
1947 be16_to_cpu(common->auth_method)); in gelic_wl_associate_bss()
1951 if (!cmd || cmd->status || cmd->cmd_status) { in gelic_wl_associate_bss()
1952 ret = -ENOMEM; in gelic_wl_associate_bss()
1959 switch (wl->wpa_level) { in gelic_wl_associate_bss()
1973 ret = -EPERM; in gelic_wl_associate_bss()
1979 init_completion(&wl->assoc_done); in gelic_wl_associate_bss()
1980 wl->assoc_stat = GELIC_WL_ASSOC_STAT_ASSOCIATING; in gelic_wl_associate_bss()
1983 if (!cmd || cmd->status || cmd->cmd_status) { in gelic_wl_associate_bss()
1984 pr_debug("%s: assoc request failed\n", __func__); in gelic_wl_associate_bss()
1985 wl->assoc_stat = GELIC_WL_ASSOC_STAT_DISCONN; in gelic_wl_associate_bss()
1987 ret = -ENOMEM; in gelic_wl_associate_bss()
1994 rc = wait_for_completion_timeout(&wl->assoc_done, HZ * 4);/*FIXME*/ in gelic_wl_associate_bss()
2002 wl->assoc_stat = GELIC_WL_ASSOC_STAT_DISCONN; in gelic_wl_associate_bss()
2004 ret = -ENXIO; in gelic_wl_associate_bss()
2006 wl->assoc_stat = GELIC_WL_ASSOC_STAT_ASSOCIATED; in gelic_wl_associate_bss()
2008 memcpy(wl->active_bssid, &bss->hwinfo->bssid[2], ETH_ALEN); in gelic_wl_associate_bss()
2011 gelic_wl_send_iwap_event(wl, wl->active_bssid); in gelic_wl_associate_bss()
2016 pr_debug("%s: ->\n", __func__); in gelic_wl_associate_bss()
2028 switch (wl->wpa_level) { in gelic_wl_connected_event()
2040 complete(&wl->assoc_done); in gelic_wl_connected_event()
2059 * wl->assoc_done. in gelic_wl_disconnect_event()
2063 if (!mutex_trylock(&wl->assoc_stat_lock)) { in gelic_wl_disconnect_event()
2075 if (wl->assoc_stat == GELIC_WL_ASSOC_STAT_ASSOCIATED) in gelic_wl_disconnect_event()
2078 wl->assoc_stat = GELIC_WL_ASSOC_STAT_DISCONN; in gelic_wl_disconnect_event()
2082 mutex_unlock(&wl->assoc_stat_lock); in gelic_wl_disconnect_event()
2129 status = lv1_net_control(bus_id(port->card), dev_id(port->card), in gelic_wl_event_worker()
2173 mutex_lock(&wl->assoc_stat_lock); in gelic_wl_assoc_worker()
2175 if (wl->assoc_stat != GELIC_WL_ASSOC_STAT_DISCONN) in gelic_wl_assoc_worker()
2178 spin_lock_irqsave(&wl->lock, irqflag); in gelic_wl_assoc_worker()
2179 if (test_bit(GELIC_WL_STAT_ESSID_SET, &wl->stat)) { in gelic_wl_assoc_worker()
2180 pr_debug("%s: assoc ESSID configured %s\n", __func__, in gelic_wl_assoc_worker()
2181 wl->essid); in gelic_wl_assoc_worker()
2182 essid = wl->essid; in gelic_wl_assoc_worker()
2183 essid_len = wl->essid_len; in gelic_wl_assoc_worker()
2188 spin_unlock_irqrestore(&wl->lock, irqflag); in gelic_wl_assoc_worker()
2191 if (ret == -ERESTARTSYS) { in gelic_wl_assoc_worker()
2193 schedule_delayed_work(&wl->assoc_work, HZ/10); /*FIXME*/ in gelic_wl_assoc_worker()
2206 wait_for_completion(&wl->scan_done); in gelic_wl_assoc_worker()
2209 mutex_lock(&wl->scan_lock); in gelic_wl_assoc_worker()
2210 if (wl->scan_stat != GELIC_WL_SCAN_STAT_GOT_LIST) { in gelic_wl_assoc_worker()
2229 mutex_unlock(&wl->scan_lock); in gelic_wl_assoc_worker()
2231 mutex_unlock(&wl->assoc_stat_lock); in gelic_wl_assoc_worker()
2244 complete(&wl->cmd_done_intr); in gelic_wl_interrupt()
2249 queue_delayed_work(wl->event_queue, &wl->event_work, 0); in gelic_wl_interrupt()
2297 strcpy(netdev->name, "wlan%d"); in gelic_wl_alloc()
2300 port->netdev = netdev; in gelic_wl_alloc()
2301 port->card = card; in gelic_wl_alloc()
2302 port->type = GELIC_PORT_WIRELESS; in gelic_wl_alloc()
2308 wl->networks = kcalloc(GELIC_WL_BSS_MAX_ENT, in gelic_wl_alloc()
2312 if (!wl->networks) in gelic_wl_alloc()
2315 wl->eurus_cmd_queue = create_singlethread_workqueue("gelic_cmd"); in gelic_wl_alloc()
2316 if (!wl->eurus_cmd_queue) in gelic_wl_alloc()
2319 wl->event_queue = create_singlethread_workqueue("gelic_event"); in gelic_wl_alloc()
2320 if (!wl->event_queue) in gelic_wl_alloc()
2323 INIT_LIST_HEAD(&wl->network_free_list); in gelic_wl_alloc()
2324 INIT_LIST_HEAD(&wl->network_list); in gelic_wl_alloc()
2326 list_add_tail(&wl->networks[i].list, in gelic_wl_alloc()
2327 &wl->network_free_list); in gelic_wl_alloc()
2328 init_completion(&wl->cmd_done_intr); in gelic_wl_alloc()
2330 INIT_DELAYED_WORK(&wl->event_work, gelic_wl_event_worker); in gelic_wl_alloc()
2331 INIT_DELAYED_WORK(&wl->assoc_work, gelic_wl_assoc_worker); in gelic_wl_alloc()
2332 mutex_init(&wl->scan_lock); in gelic_wl_alloc()
2333 mutex_init(&wl->assoc_stat_lock); in gelic_wl_alloc()
2335 init_completion(&wl->scan_done); in gelic_wl_alloc()
2337 complete(&wl->scan_done); in gelic_wl_alloc()
2339 spin_lock_init(&wl->lock); in gelic_wl_alloc()
2341 wl->scan_age = 5*HZ; /* FIXME */ in gelic_wl_alloc()
2351 destroy_workqueue(wl->eurus_cmd_queue); in gelic_wl_alloc()
2353 kfree(wl->networks); in gelic_wl_alloc()
2366 pr_debug("%s: <-\n", __func__); in gelic_wl_free()
2369 destroy_workqueue(wl->eurus_cmd_queue); in gelic_wl_free()
2370 destroy_workqueue(wl->event_queue); in gelic_wl_free()
2372 scan_info = wl->networks; in gelic_wl_free()
2374 kfree(scan_info->hwinfo); in gelic_wl_free()
2375 kfree(wl->networks); in gelic_wl_free()
2379 pr_debug("%s: ->\n", __func__); in gelic_wl_free()
2385 int ret = -1; in gelic_wl_try_associate()
2388 pr_debug("%s: <-\n", __func__); in gelic_wl_try_associate()
2392 if (wl->group_cipher_method == GELIC_WL_CIPHER_NONE) { in gelic_wl_try_associate()
2394 &wl->stat)) in gelic_wl_try_associate()
2403 if (wl->group_cipher_method == GELIC_WL_CIPHER_WEP) { in gelic_wl_try_associate()
2406 if (test_bit(i, &wl->key_enabled)) in gelic_wl_try_associate()
2414 if ((wl->group_cipher_method == GELIC_WL_CIPHER_TKIP) || in gelic_wl_try_associate()
2415 (wl->group_cipher_method == GELIC_WL_CIPHER_AES)) { in gelic_wl_try_associate()
2417 &wl->stat)) in gelic_wl_try_associate()
2427 ret = schedule_delayed_work(&wl->assoc_work, 0); in gelic_wl_try_associate()
2439 pr_debug("%s:->%p\n", __func__, netdev); in gelic_wl_open()
2448 pr_debug("%s:<-\n", __func__); in gelic_wl_open()
2461 list_for_each_entry_safe(target, tmp, &wl->network_list, list) { in gelic_wl_reset_state()
2462 list_move_tail(&target->list, &wl->network_free_list); in gelic_wl_reset_state()
2464 wl->scan_stat = GELIC_WL_SCAN_STAT_INIT; in gelic_wl_reset_state()
2467 wl->auth_method = GELIC_EURUS_AUTH_OPEN; in gelic_wl_reset_state()
2468 wl->group_cipher_method = GELIC_WL_CIPHER_NONE; in gelic_wl_reset_state()
2469 wl->pairwise_cipher_method = GELIC_WL_CIPHER_NONE; in gelic_wl_reset_state()
2470 wl->wpa_level = GELIC_WL_WPA_LEVEL_NONE; in gelic_wl_reset_state()
2472 wl->key_enabled = 0; in gelic_wl_reset_state()
2473 wl->current_key = 0; in gelic_wl_reset_state()
2475 wl->psk_type = GELIC_EURUS_WPA_PSK_PASSPHRASE; in gelic_wl_reset_state()
2476 wl->psk_len = 0; in gelic_wl_reset_state()
2478 wl->essid_len = 0; in gelic_wl_reset_state()
2479 memset(wl->essid, 0, sizeof(wl->essid)); in gelic_wl_reset_state()
2480 memset(wl->bssid, 0, sizeof(wl->bssid)); in gelic_wl_reset_state()
2481 memset(wl->active_bssid, 0, sizeof(wl->active_bssid)); in gelic_wl_reset_state()
2483 wl->assoc_stat = GELIC_WL_ASSOC_STAT_DISCONN; in gelic_wl_reset_state()
2485 memset(&wl->iwstat, 0, sizeof(wl->iwstat)); in gelic_wl_reset_state()
2487 wl->stat = 0; in gelic_wl_reset_state()
2504 if (wl->scan_stat == GELIC_WL_SCAN_STAT_SCANNING) in gelic_wl_disconnect()
2505 wait_for_completion_timeout(&wl->scan_done, HZ); in gelic_wl_disconnect()
2518 pr_debug("%s:<-\n", __func__); in gelic_wl_stop()
2524 cancel_delayed_work(&wl->assoc_work); in gelic_wl_stop()
2526 if (wl->assoc_stat == GELIC_WL_ASSOC_STAT_ASSOCIATED) in gelic_wl_stop()
2536 pr_debug("%s:->\n", __func__); in gelic_wl_stop()
2540 /* -- */
2565 netdev->watchdog_timeo = GELIC_NET_WATCHDOG_TIMEOUT; in gelic_wl_setup_netdev_ops()
2567 netdev->ethtool_ops = &gelic_wl_ethtool_ops; in gelic_wl_setup_netdev_ops()
2568 netdev->netdev_ops = &gelic_wl_netdevice_ops; in gelic_wl_setup_netdev_ops()
2569 netdev->wireless_data = &wl->wireless_data; in gelic_wl_setup_netdev_ops()
2570 netdev->wireless_handlers = &gelic_wl_wext_handler_def; in gelic_wl_setup_netdev_ops()
2585 if (!card->vlan[GELIC_PORT_WIRELESS].tx) in gelic_wl_driver_probe()
2591 return -ENOMEM; in gelic_wl_driver_probe()
2594 SET_NETDEV_DEV(netdev, &card->dev->core); in gelic_wl_driver_probe()
2601 card->netdev[GELIC_PORT_WIRELESS] = netdev; in gelic_wl_driver_probe()
2604 card->irq_mask |= GELIC_CARD_WLAN_EVENT_RECEIVED | in gelic_wl_driver_probe()
2627 if (!card->vlan[GELIC_PORT_WIRELESS].tx) in gelic_wl_driver_remove()
2630 netdev = card->netdev[GELIC_PORT_WIRELESS]; in gelic_wl_driver_remove()
2634 if (wl->assoc_stat == GELIC_WL_ASSOC_STAT_ASSOCIATED) in gelic_wl_driver_remove()
2637 complete(&wl->cmd_done_intr); in gelic_wl_driver_remove()
2640 cancel_delayed_work(&wl->assoc_work); in gelic_wl_driver_remove()
2641 cancel_delayed_work(&wl->event_work); in gelic_wl_driver_remove()
2642 flush_workqueue(wl->eurus_cmd_queue); in gelic_wl_driver_remove()
2643 flush_workqueue(wl->event_queue); in gelic_wl_driver_remove()
2649 card->irq_mask &= ~(GELIC_CARD_WLAN_EVENT_RECEIVED | in gelic_wl_driver_remove()