Lines Matching +full:sense +full:- +full:freq
39 #define KEY_SIZE_WEP104 13 /* 104/128-bit WEP keys */
40 #define KEY_SIZE_WEP40 5 /* 40/64-bit WEP keys */
56 * prism54_mib_mode_helper - MIB change mode helper function
62 * mode-dependent mib values and does the mapping of the Linux
77 return -EINVAL; in prism54_mib_mode_helper()
80 priv->iw_mode = iw_mode; in prism54_mib_mode_helper()
105 return -EINVAL; in prism54_mib_mode_helper()
118 * prism54_mib_init - fill MIB cache with defaults
131 .addr = priv->device_psm_buffer in prism54_mib_init()
137 filter = CARD_DEFAULT_FILTER; /* (0) Do not filter un-encrypted data */ in prism54_mib_init()
154 /* This sets all of the mode-dependent values */ in prism54_mib_init()
169 mutex_lock(&priv->stats_lock); in prism54_update_stats()
176 priv->local_iwstatistics.qual.noise = r.u; in prism54_update_stats()
192 * link quality through a signal-noise in prism54_update_stats()
194 priv->local_iwstatistics.qual.level = bss2->rssi; in prism54_update_stats()
195 priv->local_iwstatistics.qual.qual = in prism54_update_stats()
196 bss2->rssi - priv->iwstatistics.qual.noise; in prism54_update_stats()
201 priv->local_iwstatistics.qual.updated = 0x7; in prism54_update_stats()
205 priv->local_iwstatistics.discard.code = r.u; in prism54_update_stats()
209 priv->local_iwstatistics.discard.retries = r.u; in prism54_update_stats()
211 mutex_unlock(&priv->stats_lock); in prism54_update_stats()
220 if (mutex_trylock(&priv->stats_lock)) { in prism54_get_wireless_stats()
221 memcpy(&priv->iwstatistics, &priv->local_iwstatistics, in prism54_get_wireless_stats()
224 priv->local_iwstatistics.qual.updated = 0; in prism54_get_wireless_stats()
225 mutex_unlock(&priv->stats_lock); in prism54_get_wireless_stats()
227 priv->iwstatistics.qual.updated = 0; in prism54_get_wireless_stats()
231 if ((priv->stats_timestamp == 0) || in prism54_get_wireless_stats()
232 time_after(jiffies, priv->stats_timestamp + 1 * HZ)) { in prism54_get_wireless_stats()
233 schedule_work(&priv->stats_work); in prism54_get_wireless_stats()
234 priv->stats_timestamp = jiffies; in prism54_get_wireless_stats()
237 return &priv->iwstatistics; in prism54_get_wireless_stats()
246 /* simply re-set the last set SSID, this should commit most stuff */ in prism54_commit()
249 * in Monitor mode does not make sense and isn't allowed for this in prism54_commit()
251 if (priv->iw_mode != IW_MODE_MONITOR) in prism54_commit()
276 capabilities = "IEEE 802.11b/g - FAA Support"; in prism54_get_name()
295 if (fwrq->m < 1000) in prism54_set_freq()
297 c = fwrq->m; in prism54_set_freq()
299 c = (fwrq->e == 1) ? channel_of_freq(fwrq->m / 100000) : 0; in prism54_set_freq()
301 rvalue = c ? mgt_set_request(priv, DOT11_OID_CHANNEL, 0, &c) : -EINVAL; in prism54_set_freq()
304 return (rvalue ? rvalue : -EINPROGRESS); in prism54_set_freq()
316 fwrq->i = r.u; in prism54_get_freq()
318 fwrq->m = r.u; in prism54_get_freq()
319 fwrq->e = 3; in prism54_get_freq()
334 "%s: %s() You passed a non-valid init_mode.\n", in prism54_set_mode()
335 priv->ndev->name, __func__); in prism54_set_mode()
336 return -EINVAL; in prism54_set_mode()
339 down_write(&priv->mib_sem); in prism54_set_mode()
342 up_write(&priv->mib_sem); in prism54_set_mode()
343 return -EOPNOTSUPP; in prism54_set_mode()
349 if ((*uwrq == IW_MODE_MASTER) && (priv->acl.policy != MAC_POLICY_OPEN)) in prism54_set_mode()
351 if (priv->wpa) in prism54_set_mode()
357 up_write(&priv->mib_sem); in prism54_set_mode()
358 return -EIO; in prism54_set_mode()
360 priv->ndev->type = (priv->iw_mode == IW_MODE_MONITOR) in prism54_set_mode()
361 ? priv->monitor_type : ARPHRD_ETHER; in prism54_set_mode()
362 up_write(&priv->mib_sem); in prism54_set_mode()
374 BUG_ON((priv->iw_mode < IW_MODE_AUTO) || (priv->iw_mode > in prism54_get_mode()
376 *uwrq = priv->iw_mode; in prism54_get_mode()
382 * emit data if (sensitivity > rssi - noise) (in dBm).
394 sens = vwrq->disabled ? 20 : vwrq->value; in prism54_set_sens()
409 vwrq->value = r.u; in prism54_get_sens()
410 vwrq->disabled = (vwrq->value == 0); in prism54_get_sens()
411 vwrq->fixed = 1; in prism54_get_sens()
424 struct obj_frequencies *freq; in prism54_get_range() local
428 dwrq->length = sizeof (struct iw_range); in prism54_get_range()
431 range->we_version_source = SUPPORTED_WIRELESS_EXT; in prism54_get_range()
432 range->we_version_compiled = WIRELESS_EXT; in prism54_get_range()
435 range->num_encoding_sizes = 3; in prism54_get_range()
437 range->encoding_size[0] = 5; in prism54_get_range()
439 range->encoding_size[1] = 13; in prism54_get_range()
440 /* 256 bits for WPA-PSK */ in prism54_get_range()
441 range->encoding_size[2] = 32; in prism54_get_range()
443 range->max_encoding_tokens = 4; in prism54_get_range()
446 range->max_qual.level = 0; in prism54_get_range()
447 range->max_qual.noise = 0; in prism54_get_range()
448 range->max_qual.qual = 0; in prism54_get_range()
450 range->avg_qual.level = -80; /* -80 dBm */ in prism54_get_range()
451 range->avg_qual.noise = 0; /* don't know what to put here */ in prism54_get_range()
452 range->avg_qual.qual = 0; in prism54_get_range()
454 range->sensitivity = 200; in prism54_get_range()
457 range->retry_capa = IW_RETRY_LIMIT | IW_RETRY_LIFETIME; in prism54_get_range()
458 range->retry_flags = IW_RETRY_LIMIT; in prism54_get_range()
459 range->r_time_flags = IW_RETRY_LIFETIME; in prism54_get_range()
462 range->min_retry = 1; in prism54_get_range()
463 range->max_retry = 65535; in prism54_get_range()
464 range->min_r_time = 1024; in prism54_get_range()
465 range->max_r_time = 65535 * 1024; in prism54_get_range()
468 range->txpower_capa = IW_TXPOW_DBM; in prism54_get_range()
471 range->event_capa[0] = (IW_EVENT_CAPA_K_0 | in prism54_get_range()
474 range->event_capa[1] = IW_EVENT_CAPA_K_1; in prism54_get_range()
475 range->event_capa[4] = IW_EVENT_CAPA_MASK(IWEVCUSTOM); in prism54_get_range()
477 range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | in prism54_get_range()
489 freq = r.ptr; in prism54_get_range()
491 range->num_channels = freq->nr; in prism54_get_range()
492 range->num_frequency = freq->nr; in prism54_get_range()
494 m = min(IW_MAX_FREQUENCIES, (int) freq->nr); in prism54_get_range()
496 range->freq[i].m = freq->mhz[i]; in prism54_get_range()
497 range->freq[i].e = 6; in prism54_get_range()
498 range->freq[i].i = channel_of_freq(freq->mhz[i]); in prism54_get_range()
500 kfree(freq); in prism54_get_range()
509 range->bitrate[i] = *data * 500000; in prism54_get_range()
513 range->num_bitrates = i; in prism54_get_range()
529 if (awrq->sa_family != ARPHRD_ETHER) in prism54_set_wap()
530 return -EINVAL; in prism54_set_wap()
533 memcpy(&bssid[0], awrq->sa_data, ETH_ALEN); in prism54_set_wap()
535 /* set the bssid -- does this make sense when in AP mode? */ in prism54_set_wap()
538 return (rvalue ? rvalue : -EINPROGRESS); /* Call commit handler */ in prism54_set_wap()
552 memcpy(awrq->sa_data, r.ptr, ETH_ALEN); in prism54_get_wap()
553 awrq->sa_family = ARPHRD_ETHER; in prism54_get_wap()
584 memcpy(iwe.u.ap_addr.sa_data, bss->address, ETH_ALEN); in prism54_translate_bss()
593 iwe.u.data.length = bss->ssid.length; in prism54_translate_bss()
597 &iwe, bss->ssid.octets); in prism54_translate_bss()
605 cap = bss->capinfo; in prism54_translate_bss()
626 /* Add frequency. (short) bss->channel is the frequency in MHz */ in prism54_translate_bss()
627 iwe.u.freq.m = bss->channel; in prism54_translate_bss()
628 iwe.u.freq.e = 6; in prism54_translate_bss()
634 iwe.u.qual.level = bss->rssi; in prism54_translate_bss()
637 iwe.u.qual.qual = bss->rssi - noise; in prism54_translate_bss()
643 wpa_ie_len = prism54_wpa_bss_ie_get(priv, bss->address, wpa_ie); in prism54_translate_bss()
663 if(bss->rates & mask) { in prism54_translate_bss()
672 if ((current_val - current_ev) > iwe_stream_lcp_len(info)) in prism54_translate_bss()
692 dwrq->length = 0; in prism54_get_scan()
703 * WE-14->WE-16, the buffer is limited to IW_SCAN_MAX_DATA bytes. in prism54_get_scan()
704 * Starting with WE-17, the buffer can be as big as needed. in prism54_get_scan()
712 for (i = 0; i < (int) bsslist->nr; i++) { in prism54_get_scan()
714 extra + dwrq->length, in prism54_get_scan()
715 &(bsslist->bsslist[i]), in prism54_get_scan()
719 if((extra + dwrq->length - current_ev) <= IW_EV_ADDR_LEN) { in prism54_get_scan()
721 rvalue = -E2BIG; in prism54_get_scan()
727 dwrq->length = (current_ev - extra); in prism54_get_scan()
728 dwrq->flags = 0; /* todo */ in prism54_get_scan()
743 if (dwrq->flags && dwrq->length) { in prism54_set_essid()
744 if (dwrq->length > 32) in prism54_set_essid()
745 return -E2BIG; in prism54_set_essid()
746 essid.length = dwrq->length; in prism54_set_essid()
747 memcpy(essid.octets, extra, dwrq->length); in prism54_set_essid()
751 if (priv->iw_mode != IW_MODE_MONITOR) in prism54_set_essid()
772 if (essid->length) { in prism54_get_essid()
773 dwrq->flags = 1; /* set ESSID to ON for Wireless Extensions */ in prism54_get_essid()
775 dwrq->length = min((u8)IW_ESSID_MAX_SIZE, essid->length); in prism54_get_essid()
777 dwrq->flags = 0; in prism54_get_essid()
778 dwrq->length = 0; in prism54_get_essid()
780 essid->octets[dwrq->length] = '\0'; in prism54_get_essid()
781 memcpy(extra, essid->octets, dwrq->length); in prism54_get_essid()
796 if (dwrq->length > IW_ESSID_MAX_SIZE) in prism54_set_nick()
797 return -E2BIG; in prism54_set_nick()
799 down_write(&priv->mib_sem); in prism54_set_nick()
800 memset(priv->nickname, 0, sizeof (priv->nickname)); in prism54_set_nick()
801 memcpy(priv->nickname, extra, dwrq->length); in prism54_set_nick()
802 up_write(&priv->mib_sem); in prism54_set_nick()
813 dwrq->length = 0; in prism54_get_nick()
815 down_read(&priv->mib_sem); in prism54_get_nick()
816 dwrq->length = strlen(priv->nickname); in prism54_get_nick()
817 memcpy(extra, priv->nickname, dwrq->length); in prism54_get_nick()
818 up_read(&priv->mib_sem); in prism54_get_nick()
837 if (vwrq->value == -1) { in prism54_set_rate()
849 rate = (u32) (vwrq->value / 500000); in prism54_set_rate()
857 if (vwrq->value == i) { in prism54_set_rate()
866 return -EINVAL; in prism54_set_rate()
873 if (vwrq->fixed) { in prism54_set_rate()
887 profile = -1; in prism54_set_rate()
911 vwrq->value = r.u * 500000; in prism54_get_rate()
920 vwrq->fixed = (data[0] != 0) && (data[1] == 0); in prism54_get_rate()
932 return mgt_set_request(priv, DOT11_OID_RTSTHRESH, 0, &vwrq->value); in prism54_set_rts()
945 vwrq->value = r.u; in prism54_get_rts()
956 return mgt_set_request(priv, DOT11_OID_FRAGTHRESH, 0, &vwrq->value); in prism54_set_frag()
968 vwrq->value = r.u; in prism54_get_frag()
989 if (vwrq->disabled) in prism54_set_retry()
991 return -EINVAL; in prism54_set_retry()
993 if (vwrq->flags & IW_RETRY_LIMIT) { in prism54_set_retry()
994 if (vwrq->flags & IW_RETRY_SHORT) in prism54_set_retry()
995 slimit = vwrq->value; in prism54_set_retry()
996 else if (vwrq->flags & IW_RETRY_LONG) in prism54_set_retry()
997 llimit = vwrq->value; in prism54_set_retry()
1000 slimit = vwrq->value; in prism54_set_retry()
1001 llimit = vwrq->value; in prism54_set_retry()
1004 if (vwrq->flags & IW_RETRY_LIFETIME) in prism54_set_retry()
1006 lifetime = vwrq->value / 1024; in prism54_set_retry()
1029 vwrq->disabled = 0; /* It cannot be disabled */ in prism54_get_retry()
1031 if ((vwrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) { in prism54_get_retry()
1035 vwrq->value = r.u * 1024; in prism54_get_retry()
1036 vwrq->flags = IW_RETRY_LIFETIME; in prism54_get_retry()
1037 } else if ((vwrq->flags & IW_RETRY_LONG)) { in prism54_get_retry()
1041 vwrq->value = r.u; in prism54_get_retry()
1042 vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_LONG; in prism54_get_retry()
1047 vwrq->value = r.u; in prism54_get_retry()
1048 vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_SHORT; in prism54_get_retry()
1067 if (dwrq->length > 0) { in prism54_set_encode()
1069 int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; in prism54_set_encode()
1077 if (!(dwrq->flags & IW_ENCODE_NOKEY)) { in prism54_set_encode()
1078 if (dwrq->length > KEY_SIZE_TKIP) { in prism54_set_encode()
1079 /* User-provided key data too big */ in prism54_set_encode()
1080 return -EINVAL; in prism54_set_encode()
1082 if (dwrq->length > KEY_SIZE_WEP104) { in prism54_set_encode()
1083 /* WPA-PSK TKIP */ in prism54_set_encode()
1086 } else if (dwrq->length > KEY_SIZE_WEP40) { in prism54_set_encode()
1094 memcpy(key.key, extra, dwrq->length); in prism54_set_encode()
1113 int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; in prism54_set_encode()
1120 if (!(dwrq->flags & IW_ENCODE_MODE)) { in prism54_set_encode()
1122 return -EINVAL; in prism54_set_encode()
1127 if (dwrq->flags & IW_ENCODE_DISABLED) { in prism54_set_encode()
1133 if (dwrq->flags & IW_ENCODE_OPEN) in prism54_set_encode()
1134 /* Encode but accept non-encoded packets. No auth */ in prism54_set_encode()
1136 if ((dwrq->flags & IW_ENCODE_RESTRICTED) || force) { in prism54_set_encode()
1137 /* Refuse non-encoded packets. Auth */ in prism54_set_encode()
1143 if ((dwrq->flags & IW_ENCODE_MODE) || force) { in prism54_set_encode()
1161 u32 devindex, index = (dwrq->flags & IW_ENCODE_INDEX) - 1; in prism54_get_encode()
1175 dwrq->flags = IW_ENCODE_RESTRICTED; in prism54_get_encode()
1178 dwrq->flags = IW_ENCODE_OPEN; in prism54_get_encode()
1180 dwrq->flags = IW_ENCODE_DISABLED; in prism54_get_encode()
1183 dwrq->flags = 0; in prism54_get_encode()
1189 if (index == -1 || index > 3) in prism54_get_encode()
1194 dwrq->length = key->length; in prism54_get_encode()
1195 memcpy(extra, key->key, dwrq->length); in prism54_get_encode()
1198 dwrq->flags |= devindex + 1; in prism54_get_encode()
1213 vwrq->value = (s32) r.u / 4; in prism54_get_txpower()
1214 vwrq->fixed = 1; in prism54_get_txpower()
1218 vwrq->disabled = 0; in prism54_get_txpower()
1228 s32 u = vwrq->value; in prism54_set_txpower()
1232 if (vwrq->disabled) { in prism54_set_txpower()
1236 priv->ndev->name, __func__); in prism54_set_txpower()
1237 return -ENOTSUPP; in prism54_set_txpower()
1238 } else if (vwrq->fixed) in prism54_set_txpower()
1244 priv->ndev->name, __func__); in prism54_set_txpower()
1245 return -ENOTSUPP; in prism54_set_txpower()
1257 if (data->length > MAX_WPA_IE_LEN || in prism54_set_genie()
1258 (data->length && extra == NULL)) in prism54_set_genie()
1259 return -EINVAL; in prism54_set_genie()
1261 memcpy(priv->wpa_ie, extra, data->length); in prism54_set_genie()
1262 priv->wpa_ie_len = data->length; in prism54_set_genie()
1264 alen = sizeof(*attach) + priv->wpa_ie_len; in prism54_set_genie()
1267 return -ENOMEM; in prism54_set_genie()
1274 attach->type = (WLAN_FC_TYPE_MGMT << 2) | in prism54_set_genie()
1276 attach->id = -1; in prism54_set_genie()
1277 attach->size = priv->wpa_ie_len; in prism54_set_genie()
1278 memcpy(attach->data, extra, priv->wpa_ie_len); in prism54_set_genie()
1281 priv->wpa_ie_len); in prism54_set_genie()
1283 attach->type = (WLAN_FC_TYPE_MGMT << 2) | in prism54_set_genie()
1287 priv->wpa_ie_len); in prism54_set_genie()
1290 ndev->name); in prism54_set_genie()
1303 int len = priv->wpa_ie_len; in prism54_get_genie()
1306 data->length = 0; in prism54_get_genie()
1310 if (data->length < len) in prism54_get_genie()
1311 return -E2BIG; in prism54_get_genie()
1313 data->length = len; in prism54_get_genie()
1314 memcpy(extra, priv->wpa_ie, len); in prism54_get_genie()
1324 struct iw_param *param = &wrqu->param; in prism54_set_auth()
1335 down_write(&priv->mib_sem); in prism54_set_auth()
1336 wpa = old_wpa = priv->wpa; in prism54_set_auth()
1337 up_write(&priv->mib_sem); in prism54_set_auth()
1352 switch (param->flags & IW_AUTH_INDEX) { in prism54_set_auth()
1360 if (param->value) { in prism54_set_auth()
1370 exunencrypt = 0; /* Do not filter un-encrypted data */ in prism54_set_auth()
1377 if (param->value & IW_AUTH_WPA_VERSION_DISABLED) { in prism54_set_auth()
1380 exunencrypt = 0; /* Do not filter un-encrypted data */ in prism54_set_auth()
1384 if (param->value & IW_AUTH_WPA_VERSION_WPA) in prism54_set_auth()
1386 else if (param->value & IW_AUTH_WPA_VERSION_WPA2) in prism54_set_auth()
1401 dot1x = param->value ? 0 : 0x01; in prism54_set_auth()
1405 privinvoked = param->value ? 1 : 0; in prism54_set_auth()
1409 exunencrypt = param->value ? 1 : 0; in prism54_set_auth()
1413 if (param->value & IW_AUTH_ALG_SHARED_KEY) { in prism54_set_auth()
1416 ret = -EINVAL; in prism54_set_auth()
1420 } else if (param->value & IW_AUTH_ALG_OPEN_SYSTEM) { in prism54_set_auth()
1423 ret = -EINVAL; in prism54_set_auth()
1429 return -EOPNOTSUPP; in prism54_set_auth()
1433 down_write(&priv->mib_sem); in prism54_set_auth()
1434 priv->wpa = wpa; in prism54_set_auth()
1435 up_write(&priv->mib_sem); in prism54_set_auth()
1451 struct iw_param *param = &wrqu->param; in prism54_get_auth()
1460 down_write(&priv->mib_sem); in prism54_get_auth()
1461 wpa = priv->wpa; in prism54_get_auth()
1462 up_write(&priv->mib_sem); in prism54_get_auth()
1464 switch (param->flags & IW_AUTH_INDEX) { in prism54_get_auth()
1471 ret = -EOPNOTSUPP; in prism54_get_auth()
1477 param->value = IW_AUTH_WPA_VERSION_WPA; in prism54_get_auth()
1480 param->value = IW_AUTH_WPA_VERSION_WPA2; in prism54_get_auth()
1484 param->value = IW_AUTH_WPA_VERSION_DISABLED; in prism54_get_auth()
1492 param->value = r.u > 0 ? 1 : 0; in prism54_get_auth()
1500 param->value = IW_AUTH_ALG_OPEN_SYSTEM; in prism54_get_auth()
1504 param->value = IW_AUTH_ALG_SHARED_KEY; in prism54_get_auth()
1508 param->value = 0; in prism54_get_auth()
1515 param->value = wpa > 0 ? 1 : 0; in prism54_get_auth()
1521 param->value = r.u > 0 ? 1 : 0; in prism54_get_auth()
1527 param->value = r.u > 0 ? 1 : 0; in prism54_get_auth()
1531 return -EOPNOTSUPP; in prism54_get_auth()
1542 struct iw_point *encoding = &wrqu->encoding; in prism54_set_encodeext()
1544 int idx, alg = ext->alg, set_key = 1; in prism54_set_encodeext()
1553 idx = (encoding->flags & IW_ENCODE_INDEX) - 1; in prism54_set_encodeext()
1556 return -EINVAL; in prism54_set_encodeext()
1564 if (encoding->flags & IW_ENCODE_DISABLED) in prism54_set_encodeext()
1567 if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { in prism54_set_encodeext()
1572 set_key = ext->key_len > 0 ? 1 : 0; in prism54_set_encodeext()
1581 if (ext->key_len > KEY_SIZE_WEP104) { in prism54_set_encodeext()
1582 ret = -EINVAL; in prism54_set_encodeext()
1585 if (ext->key_len > KEY_SIZE_WEP40) in prism54_set_encodeext()
1591 if (ext->key_len > KEY_SIZE_TKIP) { in prism54_set_encodeext()
1592 ret = -EINVAL; in prism54_set_encodeext()
1599 return -EINVAL; in prism54_set_encodeext()
1604 memcpy(key.key, ext->key, ext->key_len); in prism54_set_encodeext()
1613 if (encoding->flags & IW_ENCODE_DISABLED) { in prism54_set_encodeext()
1619 if (encoding->flags & IW_ENCODE_OPEN) { in prism54_set_encodeext()
1620 /* Encode but accept non-encoded packets. No auth */ in prism54_set_encodeext()
1623 if (encoding->flags & IW_ENCODE_RESTRICTED) { in prism54_set_encodeext()
1624 /* Refuse non-encoded packets. Auth */ in prism54_set_encodeext()
1631 if (encoding->flags & IW_ENCODE_MODE) { in prism54_set_encodeext()
1651 struct iw_point *encoding = &wrqu->encoding; in prism54_get_encodeext()
1671 max_key_len = encoding->length - sizeof(*ext); in prism54_get_encodeext()
1673 return -EINVAL; in prism54_get_encodeext()
1675 idx = (encoding->flags & IW_ENCODE_INDEX) - 1; in prism54_get_encodeext()
1678 return -EINVAL; in prism54_get_encodeext()
1686 encoding->flags = idx + 1; in prism54_get_encodeext()
1692 wrqu->encoding.flags |= IW_ENCODE_RESTRICTED; in prism54_get_encodeext()
1696 wrqu->encoding.flags |= IW_ENCODE_OPEN; in prism54_get_encodeext()
1700 down_write(&priv->mib_sem); in prism54_get_encodeext()
1701 wpa = priv->wpa; in prism54_get_encodeext()
1702 up_write(&priv->mib_sem); in prism54_get_encodeext()
1706 ext->alg = IW_ENCODE_ALG_NONE; in prism54_get_encodeext()
1707 ext->key_len = 0; in prism54_get_encodeext()
1708 wrqu->encoding.flags |= IW_ENCODE_DISABLED; in prism54_get_encodeext()
1716 if (max_key_len < key->length) { in prism54_get_encodeext()
1717 ret = -E2BIG; in prism54_get_encodeext()
1720 memcpy(ext->key, key->key, key->length); in prism54_get_encodeext()
1721 ext->key_len = key->length; in prism54_get_encodeext()
1723 switch (key->type) { in prism54_get_encodeext()
1725 ext->alg = IW_ENCODE_ALG_TKIP; in prism54_get_encodeext()
1729 ext->alg = IW_ENCODE_ALG_WEP; in prism54_get_encodeext()
1732 wrqu->encoding.flags |= IW_ENCODE_ENABLED; in prism54_get_encodeext()
1755 enum oid_num_t n = dwrq->flags; in prism54_get_oid()
1758 dwrq->length = mgt_response_to_str(n, &r, extra); in prism54_get_oid()
1777 u32 oid = dwrq->flags; in prism54_set_raw()
1785 mutex_init(&acl->lock); in prism54_acl_init()
1786 INIT_LIST_HEAD(&acl->mac_list); in prism54_acl_init()
1787 acl->size = 0; in prism54_acl_init()
1788 acl->policy = MAC_POLICY_OPEN; in prism54_acl_init()
1797 mutex_lock(&acl->lock); in prism54_clear_mac()
1799 if (acl->size == 0) { in prism54_clear_mac()
1800 mutex_unlock(&acl->lock); in prism54_clear_mac()
1804 for (ptr = acl->mac_list.next, next = ptr->next; in prism54_clear_mac()
1805 ptr != &acl->mac_list; ptr = next, next = ptr->next) { in prism54_clear_mac()
1810 acl->size = 0; in prism54_clear_mac()
1811 mutex_unlock(&acl->lock); in prism54_clear_mac()
1825 struct islpci_acl *acl = &priv->acl; in prism54_add_mac()
1829 if (addr->sa_family != ARPHRD_ETHER) in prism54_add_mac()
1830 return -EOPNOTSUPP; in prism54_add_mac()
1834 return -ENOMEM; in prism54_add_mac()
1836 memcpy(entry->addr, addr->sa_data, ETH_ALEN); in prism54_add_mac()
1838 if (mutex_lock_interruptible(&acl->lock)) { in prism54_add_mac()
1840 return -ERESTARTSYS; in prism54_add_mac()
1842 list_add_tail(&entry->_list, &acl->mac_list); in prism54_add_mac()
1843 acl->size++; in prism54_add_mac()
1844 mutex_unlock(&acl->lock); in prism54_add_mac()
1854 struct islpci_acl *acl = &priv->acl; in prism54_del_mac()
1858 if (addr->sa_family != ARPHRD_ETHER) in prism54_del_mac()
1859 return -EOPNOTSUPP; in prism54_del_mac()
1861 if (mutex_lock_interruptible(&acl->lock)) in prism54_del_mac()
1862 return -ERESTARTSYS; in prism54_del_mac()
1863 list_for_each_entry(entry, &acl->mac_list, _list) { in prism54_del_mac()
1864 if (ether_addr_equal(entry->addr, addr->sa_data)) { in prism54_del_mac()
1865 list_del(&entry->_list); in prism54_del_mac()
1866 acl->size--; in prism54_del_mac()
1868 mutex_unlock(&acl->lock); in prism54_del_mac()
1872 mutex_unlock(&acl->lock); in prism54_del_mac()
1873 return -EINVAL; in prism54_del_mac()
1881 struct islpci_acl *acl = &priv->acl; in prism54_get_mac()
1885 dwrq->length = 0; in prism54_get_mac()
1887 if (mutex_lock_interruptible(&acl->lock)) in prism54_get_mac()
1888 return -ERESTARTSYS; in prism54_get_mac()
1890 list_for_each_entry(entry, &acl->mac_list, _list) { in prism54_get_mac()
1891 memcpy(dst->sa_data, entry->addr, ETH_ALEN); in prism54_get_mac()
1892 dst->sa_family = ARPHRD_ETHER; in prism54_get_mac()
1893 dwrq->length++; in prism54_get_mac()
1896 mutex_unlock(&acl->lock); in prism54_get_mac()
1909 struct islpci_acl *acl = &priv->acl; in prism54_set_policy()
1915 return -EINVAL; in prism54_set_policy()
1917 down_write(&priv->mib_sem); in prism54_set_policy()
1919 acl->policy = *uwrq; in prism54_set_policy()
1922 if ((priv->iw_mode == IW_MODE_MASTER) && in prism54_set_policy()
1923 (acl->policy != MAC_POLICY_OPEN)) in prism54_set_policy()
1927 if (priv->wpa) in prism54_set_policy()
1932 up_write(&priv->mib_sem); in prism54_set_policy()
1933 return -EIO; in prism54_set_policy()
1935 up_write(&priv->mib_sem); in prism54_set_policy()
1945 struct islpci_acl *acl = &priv->acl; in prism54_get_policy()
1947 *uwrq = acl->policy; in prism54_get_policy()
1960 if (mutex_lock_interruptible(&acl->lock)) in prism54_mac_accept()
1961 return -ERESTARTSYS; in prism54_mac_accept()
1963 if (acl->policy == MAC_POLICY_OPEN) { in prism54_mac_accept()
1964 mutex_unlock(&acl->lock); in prism54_mac_accept()
1968 list_for_each_entry(entry, &acl->mac_list, _list) { in prism54_mac_accept()
1969 if (memcmp(entry->addr, mac, ETH_ALEN) == 0) { in prism54_mac_accept()
1974 res = (acl->policy == MAC_POLICY_ACCEPT) ? !res : res; in prism54_mac_accept()
1975 mutex_unlock(&acl->lock); in prism54_mac_accept()
1989 return -ENOMEM; in prism54_kick_all()
1992 mlme->id = 0; in prism54_kick_all()
2008 if (addr->sa_family != ARPHRD_ETHER) in prism54_kick_mac()
2009 return -EOPNOTSUPP; in prism54_kick_mac()
2013 return -ENOMEM; in prism54_kick_mac()
2016 memcpy(mlme->address, addr->sa_data, ETH_ALEN); in prism54_kick_mac()
2017 mlme->id = -1; in prism54_kick_mac()
2035 ((priv->iw_mode == IW_MODE_MASTER) ? "from" : "to"), in format_event()
2036 mlme->address, in format_event()
2037 (error ? (mlme->code ? " : REJECTED " : " : ACCEPTED ") in format_event()
2038 : ""), mlme->code); in format_event()
2057 wireless_send_event(priv->ndev, IWEVCUSTOM, &wrqu, memptr); in send_formatted_event()
2075 wireless_send_event(priv->ndev, IWEVCUSTOM, &wrqu, memptr); in send_simple_event()
2086 if (priv->iw_mode == IW_MODE_INFRA) { in link_changed()
2120 mutex_lock(&priv->wpa_lock); in prism54_wpa_bss_ie_add()
2123 list_for_each(ptr, &priv->bss_wpa_list) { in prism54_wpa_bss_ie_add()
2125 if (memcmp(bss->bssid, bssid, ETH_ALEN) == 0) { in prism54_wpa_bss_ie_add()
2126 list_move(&bss->list, &priv->bss_wpa_list); in prism54_wpa_bss_ie_add()
2135 if (priv->num_bss_wpa >= MAX_BSS_WPA_IE_COUNT) { in prism54_wpa_bss_ie_add()
2136 bss = list_entry(priv->bss_wpa_list.prev, in prism54_wpa_bss_ie_add()
2138 list_del(&bss->list); in prism54_wpa_bss_ie_add()
2142 priv->num_bss_wpa++; in prism54_wpa_bss_ie_add()
2145 memcpy(bss->bssid, bssid, ETH_ALEN); in prism54_wpa_bss_ie_add()
2146 list_add(&bss->list, &priv->bss_wpa_list); in prism54_wpa_bss_ie_add()
2151 memcpy(bss->wpa_ie, wpa_ie, wpa_ie_len); in prism54_wpa_bss_ie_add()
2152 bss->wpa_ie_len = wpa_ie_len; in prism54_wpa_bss_ie_add()
2153 bss->last_update = jiffies; in prism54_wpa_bss_ie_add()
2160 while (priv->num_bss_wpa > 0) { in prism54_wpa_bss_ie_add()
2161 bss = list_entry(priv->bss_wpa_list.prev, in prism54_wpa_bss_ie_add()
2163 if (!time_after(jiffies, bss->last_update + 60 * HZ)) in prism54_wpa_bss_ie_add()
2166 list_del(&bss->list); in prism54_wpa_bss_ie_add()
2167 priv->num_bss_wpa--; in prism54_wpa_bss_ie_add()
2171 mutex_unlock(&priv->wpa_lock); in prism54_wpa_bss_ie_add()
2181 mutex_lock(&priv->wpa_lock); in prism54_wpa_bss_ie_get()
2183 list_for_each(ptr, &priv->bss_wpa_list) { in prism54_wpa_bss_ie_get()
2185 if (memcmp(bss->bssid, bssid, ETH_ALEN) == 0) in prism54_wpa_bss_ie_get()
2190 len = bss->wpa_ie_len; in prism54_wpa_bss_ie_get()
2191 memcpy(wpa_ie, bss->wpa_ie, len); in prism54_wpa_bss_ie_get()
2193 mutex_unlock(&priv->wpa_lock); in prism54_wpa_bss_ie_get()
2201 INIT_LIST_HEAD(&priv->bss_wpa_list); in prism54_wpa_bss_ie_init()
2202 mutex_init(&priv->wpa_lock); in prism54_wpa_bss_ie_init()
2210 list_for_each_entry_safe(bss, n, &priv->bss_wpa_list, list) { in prism54_wpa_bss_ie_clean()
2222 if (!priv->wpa) in prism54_process_bss_data()
2246 if (((mlme->state == DOT11_STATE_AUTHING) || in handle_request()
2247 (mlme->state == DOT11_STATE_ASSOCING)) in handle_request()
2252 mlme->code = prism54_mac_accept(&priv->acl, in handle_request()
2253 mlme->address) ? 0 : 1; in handle_request()
2280 len = mlmeex->size; in prism54_process_trap_helper()
2281 payload = pos = mlmeex->data; in prism54_process_trap_helper()
2286 prism54_process_bss_data(priv, oid, mlmeex->address, in prism54_process_trap_helper()
2294 link_changed(priv->ndev, (u32) *data); in prism54_process_trap_helper()
2337 * is backward compatible layout-wise with "struct obj_mlme". in prism54_process_trap_helper()
2348 if (priv->iw_mode != IW_MODE_MASTER in prism54_process_trap_helper()
2349 && mlmeex->state != DOT11_STATE_AUTHING) in prism54_process_trap_helper()
2357 memcpy(&confirm->address, mlmeex->address, ETH_ALEN); in prism54_process_trap_helper()
2359 mlmeex->address); in prism54_process_trap_helper()
2360 confirm->id = -1; /* or mlmeex->id ? */ in prism54_process_trap_helper()
2361 confirm->state = 0; /* not used */ in prism54_process_trap_helper()
2362 confirm->code = 0; in prism54_process_trap_helper()
2363 confirm->size = 6; in prism54_process_trap_helper()
2364 confirm->data[0] = 0x00; in prism54_process_trap_helper()
2365 confirm->data[1] = 0x00; in prism54_process_trap_helper()
2366 confirm->data[2] = 0x02; in prism54_process_trap_helper()
2367 confirm->data[3] = 0x00; in prism54_process_trap_helper()
2368 confirm->data[4] = 0x00; in prism54_process_trap_helper()
2369 confirm->data[5] = 0x00; in prism54_process_trap_helper()
2386 if (priv->iw_mode != IW_MODE_MASTER in prism54_process_trap_helper()
2387 && mlmeex->state != DOT11_STATE_ASSOCING) in prism54_process_trap_helper()
2395 memcpy(&confirm->address, mlmeex->address, ETH_ALEN); in prism54_process_trap_helper()
2397 confirm->id = ((struct obj_mlmeex *)mlme)->id; in prism54_process_trap_helper()
2398 confirm->state = 0; /* not used */ in prism54_process_trap_helper()
2399 confirm->code = 0; in prism54_process_trap_helper()
2401 wpa_ie_len = prism54_wpa_bss_ie_get(priv, mlmeex->address, wpa_ie); in prism54_process_trap_helper()
2405 mlmeex->address); in prism54_process_trap_helper()
2410 confirm->size = wpa_ie_len; in prism54_process_trap_helper()
2411 memcpy(&confirm->data, wpa_ie, wpa_ie_len); in prism54_process_trap_helper()
2423 if (priv->iw_mode != IW_MODE_MASTER in prism54_process_trap_helper()
2424 && mlmeex->state != DOT11_STATE_ASSOCING) in prism54_process_trap_helper()
2432 memcpy(&confirm->address, mlmeex->address, ETH_ALEN); in prism54_process_trap_helper()
2434 confirm->id = mlmeex->id; in prism54_process_trap_helper()
2435 confirm->state = 0; /* not used */ in prism54_process_trap_helper()
2436 confirm->code = 0; in prism54_process_trap_helper()
2438 wpa_ie_len = prism54_wpa_bss_ie_get(priv, mlmeex->address, wpa_ie); in prism54_process_trap_helper()
2442 mlmeex->address); in prism54_process_trap_helper()
2447 confirm->size = wpa_ie_len; in prism54_process_trap_helper()
2448 memcpy(&confirm->data, wpa_ie, wpa_ie_len); in prism54_process_trap_helper()
2457 return -EINVAL; in prism54_process_trap_helper()
2472 struct net_device *ndev = frame->ndev; in prism54_process_trap()
2473 enum oid_num_t n = mgt_oidtonum(frame->header->oid); in prism54_process_trap()
2476 prism54_process_trap_helper(netdev_priv(ndev), n, frame->data); in prism54_process_trap()
2486 if (ndev->addr_len != 6) in prism54_set_mac_address()
2487 return -EINVAL; in prism54_set_mac_address()
2489 &((struct sockaddr *) addr)->sa_data); in prism54_set_mac_address()
2491 memcpy(priv->ndev->dev_addr, in prism54_set_mac_address()
2492 &((struct sockaddr *) addr)->sa_data, ETH_ALEN); in prism54_set_mac_address()
2515 down_write(&priv->mib_sem); in prism54_set_wpa()
2516 priv->wpa = *uwrq; in prism54_set_wpa()
2518 switch (priv->wpa) { in prism54_set_wpa()
2522 filter = 0; /* Do not filter un-encrypted data */ in prism54_set_wpa()
2525 printk("%s: Disabling WPA\n", ndev->name); in prism54_set_wpa()
2529 printk("%s: Enabling WPA\n", ndev->name); in prism54_set_wpa()
2532 up_write(&priv->mib_sem); in prism54_set_wpa()
2548 *uwrq = priv->wpa; in prism54_get_wpa()
2557 priv->monitor_type = in prism54_set_prismhdr()
2559 if (priv->iw_mode == IW_MODE_MONITOR) in prism54_set_prismhdr()
2560 priv->ndev->type = priv->monitor_type; in prism54_set_prismhdr()
2570 *uwrq = (priv->monitor_type == ARPHRD_IEEE80211_PRISM); in prism54_get_prismhdr()
2580 priv->priv_oid = *uwrq; in prism54_debug_oid()
2581 printk("%s: oid 0x%08X\n", ndev->name, *uwrq); in prism54_debug_oid()
2592 int ret = -EIO; in prism54_debug_get_oid()
2594 printk("%s: get_oid 0x%08X\n", ndev->name, priv->priv_oid); in prism54_debug_get_oid()
2595 data->length = 0; in prism54_debug_get_oid()
2599 islpci_mgt_transaction(priv->ndev, PIMFOR_OP_GET, in prism54_debug_get_oid()
2600 priv->priv_oid, extra, 256, in prism54_debug_get_oid()
2602 printk("%s: ret: %i\n", ndev->name, ret); in prism54_debug_get_oid()
2604 || response->header->operation == PIMFOR_OP_ERROR) { in prism54_debug_get_oid()
2608 printk("%s: EIO\n", ndev->name); in prism54_debug_get_oid()
2609 ret = -EIO; in prism54_debug_get_oid()
2612 data->length = response->header->length; in prism54_debug_get_oid()
2613 memcpy(extra, response->data, data->length); in prism54_debug_get_oid()
2615 printk("%s: len: %i\n", ndev->name, data->length); in prism54_debug_get_oid()
2630 printk("%s: set_oid 0x%08X\tlen: %d\n", ndev->name, priv->priv_oid, in prism54_debug_set_oid()
2631 data->length); in prism54_debug_set_oid()
2635 islpci_mgt_transaction(priv->ndev, PIMFOR_OP_SET, in prism54_debug_set_oid()
2636 priv->priv_oid, extra, data->length, in prism54_debug_set_oid()
2638 printk("%s: ret: %i\n", ndev->name, ret); in prism54_debug_set_oid()
2640 || response->header->operation == PIMFOR_OP_ERROR) { in prism54_debug_set_oid()
2644 printk("%s: EIO\n", ndev->name); in prism54_debug_set_oid()
2645 ret = -EIO; in prism54_debug_set_oid()
2648 response_op = response->header->operation; in prism54_debug_set_oid()
2649 printk("%s: response_op: %i\n", ndev->name, in prism54_debug_set_oid()
2655 return (ret ? ret : -EINPROGRESS); in prism54_debug_set_oid()
2667 down_write(&priv->mib_sem); in prism54_set_spy()
2670 if ((uwrq->data.length == 0) && (priv->spy_data.spy_number > 0)) in prism54_set_spy()
2673 else if ((uwrq->data.length > 0) && (priv->spy_data.spy_number == 0)) in prism54_set_spy()
2679 up_write(&priv->mib_sem); in prism54_set_spy()
2707 (iw_handler) NULL, /* -- hole -- */
2715 (iw_handler) NULL, /* -- hole -- */
2716 (iw_handler) NULL, /* -- hole -- */
2731 NULL, /* -- hole -- */
2732 NULL, /* -- hole -- */
2809 /* --- sub-ioctls handlers --- */
2818 /* --- sub-ioctls definitions --- */