1 // SPDX-License-Identifier: GPL-2.0
2 /******************************************************************************
4 * This file contains wireless extension handlers.
6 * This is part of rtl8180 OpenSource driver.
7 * Copyright (C) Andrea Merello 2004-2005 <andrea.merello@gmail.com>
9 * Parts of this driver are based on the GPL part
10 * of the official realtek driver.
12 * Parts of this driver are based on the rtl8180 driver skeleton
13 * from Patric Schenke & Andres Salomon.
15 * Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver.
17 * We want to thank the Authors of those projects and the Ndiswrapper
20 *****************************************************************************/
22 #include <linux/string.h>
24 #include "r8192U_hw.h"
26 #include "ieee80211/dot11d.h"
27 #include "r8192U_wx.h"
30 static const u32 rtl8180_rates[] = {1000000, 2000000, 5500000, 11000000,
31 6000000, 9000000, 12000000, 18000000, 24000000, 36000000, 48000000, 54000000};
37 static int r8192_wx_get_freq(struct net_device *dev,
38 struct iw_request_info *a,
39 union iwreq_data *wrqu, char *b)
41 struct r8192_priv *priv = ieee80211_priv(dev);
43 return ieee80211_wx_get_freq(priv->ieee80211, a, wrqu, b);
46 static int r8192_wx_get_mode(struct net_device *dev, struct iw_request_info *a,
47 union iwreq_data *wrqu, char *b)
49 struct r8192_priv *priv = ieee80211_priv(dev);
51 return ieee80211_wx_get_mode(priv->ieee80211, a, wrqu, b);
54 static int r8192_wx_get_rate(struct net_device *dev,
55 struct iw_request_info *info,
56 union iwreq_data *wrqu, char *extra)
58 struct r8192_priv *priv = ieee80211_priv(dev);
60 return ieee80211_wx_get_rate(priv->ieee80211, info, wrqu, extra);
63 static int r8192_wx_set_rate(struct net_device *dev,
64 struct iw_request_info *info,
65 union iwreq_data *wrqu, char *extra)
68 struct r8192_priv *priv = ieee80211_priv(dev);
70 mutex_lock(&priv->wx_mutex);
72 ret = ieee80211_wx_set_rate(priv->ieee80211, info, wrqu, extra);
74 mutex_unlock(&priv->wx_mutex);
79 static int r8192_wx_set_rts(struct net_device *dev,
80 struct iw_request_info *info,
81 union iwreq_data *wrqu, char *extra)
84 struct r8192_priv *priv = ieee80211_priv(dev);
86 mutex_lock(&priv->wx_mutex);
88 ret = ieee80211_wx_set_rts(priv->ieee80211, info, wrqu, extra);
90 mutex_unlock(&priv->wx_mutex);
95 static int r8192_wx_get_rts(struct net_device *dev,
96 struct iw_request_info *info,
97 union iwreq_data *wrqu, char *extra)
99 struct r8192_priv *priv = ieee80211_priv(dev);
101 return ieee80211_wx_get_rts(priv->ieee80211, info, wrqu, extra);
104 static int r8192_wx_set_power(struct net_device *dev,
105 struct iw_request_info *info,
106 union iwreq_data *wrqu, char *extra)
109 struct r8192_priv *priv = ieee80211_priv(dev);
111 mutex_lock(&priv->wx_mutex);
113 ret = ieee80211_wx_set_power(priv->ieee80211, info, wrqu, extra);
115 mutex_unlock(&priv->wx_mutex);
120 static int r8192_wx_get_power(struct net_device *dev,
121 struct iw_request_info *info,
122 union iwreq_data *wrqu, char *extra)
124 struct r8192_priv *priv = ieee80211_priv(dev);
126 return ieee80211_wx_get_power(priv->ieee80211, info, wrqu, extra);
129 static int r8192_wx_force_reset(struct net_device *dev,
130 struct iw_request_info *info,
131 union iwreq_data *wrqu, char *extra)
133 struct r8192_priv *priv = ieee80211_priv(dev);
135 mutex_lock(&priv->wx_mutex);
137 netdev_dbg(dev, "%s(): force reset ! extra is %d\n", __func__, *extra);
138 priv->force_reset = *extra;
139 mutex_unlock(&priv->wx_mutex);
143 static int r8192_wx_set_rawtx(struct net_device *dev,
144 struct iw_request_info *info,
145 union iwreq_data *wrqu, char *extra)
147 struct r8192_priv *priv = ieee80211_priv(dev);
150 mutex_lock(&priv->wx_mutex);
152 ret = ieee80211_wx_set_rawtx(priv->ieee80211, info, wrqu, extra);
154 mutex_unlock(&priv->wx_mutex);
159 static int r8192_wx_set_crcmon(struct net_device *dev,
160 struct iw_request_info *info,
161 union iwreq_data *wrqu, char *extra)
163 struct r8192_priv *priv = ieee80211_priv(dev);
164 int *parms = (int *)extra;
165 int enable = (parms[0] > 0);
167 mutex_lock(&priv->wx_mutex);
174 DMESG("bad CRC in monitor mode are %s",
175 priv->crcmon ? "accepted" : "rejected");
177 mutex_unlock(&priv->wx_mutex);
182 static int r8192_wx_set_mode(struct net_device *dev, struct iw_request_info *a,
183 union iwreq_data *wrqu, char *b)
185 struct r8192_priv *priv = ieee80211_priv(dev);
188 mutex_lock(&priv->wx_mutex);
190 ret = ieee80211_wx_set_mode(priv->ieee80211, a, wrqu, b);
192 rtl8192_set_rxconf(dev);
194 mutex_unlock(&priv->wx_mutex);
198 struct iw_range_with_scan_capa {
199 /* Informative stuff (to choose between different interface) */
200 __u32 throughput; /* To give an idea... */
201 /* In theory this value should be the maximum benchmarked
202 * TCP/IP throughput, because with most of these devices the
203 * bit rate is meaningless (overhead an co) to estimate how
204 * fast the connection will go and pick the fastest one.
205 * I suggest people to play with Netperf or any benchmark...
208 /* NWID (or domain id) */
209 __u32 min_nwid; /* Minimal NWID we are able to set */
210 __u32 max_nwid; /* Maximal NWID we are able to set */
212 /* Old Frequency (backward compat - moved lower ) */
213 __u16 old_num_channels;
214 __u8 old_num_frequency;
216 /* Scan capabilities */
220 static int rtl8180_wx_get_range(struct net_device *dev,
221 struct iw_request_info *info,
222 union iwreq_data *wrqu, char *extra)
224 struct iw_range *range = (struct iw_range *)extra;
225 struct iw_range_with_scan_capa *tmp = (struct iw_range_with_scan_capa *)range;
226 struct r8192_priv *priv = ieee80211_priv(dev);
230 wrqu->data.length = sizeof(*range);
231 memset(range, 0, sizeof(*range));
233 /* Let's try to keep this struct in the same order as in
234 * linux/include/wireless.h
237 /* TODO: See what values we can set, and remove the ones we can't
238 * set, or fill them with some default data.
241 /* ~5 Mb/s real (802.11b) */
242 range->throughput = 5 * 1000 * 1000;
244 /* TODO: Not used in 802.11b? */
245 /* range->min_nwid; */ /* Minimal NWID we are able to set */
246 /* TODO: Not used in 802.11b? */
247 /* range->max_nwid; */ /* Maximal NWID we are able to set */
249 /* Old Frequency (backward compat - moved lower ) */
250 /* range->old_num_channels; */
251 /* range->old_num_frequency; */
252 /* range->old_freq[6]; */ /* Filler to keep "version" at the same offset */
253 if (priv->rf_set_sens)
254 range->sensitivity = priv->max_sens; /* signal level threshold range */
256 range->max_qual.qual = 100;
257 /* TODO: Find real max RSSI and stick here */
258 range->max_qual.level = 0;
259 range->max_qual.noise = 0x100 - 98;
260 range->max_qual.updated = 7; /* Updated all three */
262 range->avg_qual.qual = 92; /* > 8% missed beacons is 'bad' */
263 /* TODO: Find real 'good' to 'bad' threshold value for RSSI */
264 range->avg_qual.level = 0x100 - 78;
265 range->avg_qual.noise = 0;
266 range->avg_qual.updated = 7; /* Updated all three */
268 range->num_bitrates = RATE_COUNT;
270 for (i = 0; i < RATE_COUNT && i < IW_MAX_BITRATES; i++)
271 range->bitrate[i] = rtl8180_rates[i];
273 range->min_frag = MIN_FRAG_THRESHOLD;
274 range->max_frag = MAX_FRAG_THRESHOLD;
277 range->max_pmp = 5000000;
279 range->max_pmt = 65535*1000;
280 range->pmp_flags = IW_POWER_PERIOD;
281 range->pmt_flags = IW_POWER_TIMEOUT;
282 range->pm_capa = IW_POWER_PERIOD | IW_POWER_TIMEOUT | IW_POWER_ALL_R;
284 range->we_version_compiled = WIRELESS_EXT;
285 range->we_version_source = 16;
287 /* range->retry_capa; */ /* What retry options are supported */
288 /* range->retry_flags; */ /* How to decode max/min retry limit */
289 /* range->r_time_flags; */ /* How to decode max/min retry life */
290 /* range->min_retry; */ /* Minimal number of retries */
291 /* range->max_retry; */ /* Maximal number of retries */
292 /* range->min_r_time; */ /* Minimal retry lifetime */
293 /* range->max_r_time; */ /* Maximal retry lifetime */
295 for (i = 0, val = 0; i < 14; i++) {
296 /* Include only legal frequencies for some countries */
297 if ((GET_DOT11D_INFO(priv->ieee80211)->channel_map)[i+1]) {
298 range->freq[val].i = i + 1;
299 range->freq[val].m = ieee80211_wlan_frequencies[i] * 100000;
300 range->freq[val].e = 1;
303 /* FIXME: do we need to set anything for channels */
307 if (val == IW_MAX_FREQUENCIES)
310 range->num_frequency = val;
311 range->num_channels = val;
312 range->enc_capa = IW_ENC_CAPA_WPA|IW_ENC_CAPA_WPA2|
313 IW_ENC_CAPA_CIPHER_TKIP|IW_ENC_CAPA_CIPHER_CCMP;
314 tmp->scan_capa = 0x01;
318 static int r8192_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
319 union iwreq_data *wrqu, char *b)
321 struct r8192_priv *priv = ieee80211_priv(dev);
322 struct ieee80211_device *ieee = priv->ieee80211;
328 if (priv->ieee80211->LinkDetectInfo.bBusyTraffic)
330 if (wrqu->data.flags & IW_SCAN_THIS_ESSID) {
331 struct iw_scan_req *req = (struct iw_scan_req *)b;
333 if (req->essid_len) {
334 ieee->current_network.ssid_len = req->essid_len;
335 memcpy(ieee->current_network.ssid, req->essid, req->essid_len);
339 mutex_lock(&priv->wx_mutex);
340 if (priv->ieee80211->state != IEEE80211_LINKED) {
341 priv->ieee80211->scanning = 0;
342 ieee80211_softmac_scan_syncro(priv->ieee80211);
345 ret = ieee80211_wx_set_scan(priv->ieee80211, a, wrqu, b);
347 mutex_unlock(&priv->wx_mutex);
351 static int r8192_wx_get_scan(struct net_device *dev, struct iw_request_info *a,
352 union iwreq_data *wrqu, char *b)
355 struct r8192_priv *priv = ieee80211_priv(dev);
360 mutex_lock(&priv->wx_mutex);
362 ret = ieee80211_wx_get_scan(priv->ieee80211, a, wrqu, b);
364 mutex_unlock(&priv->wx_mutex);
369 static int r8192_wx_set_essid(struct net_device *dev,
370 struct iw_request_info *a,
371 union iwreq_data *wrqu, char *b)
373 struct r8192_priv *priv = ieee80211_priv(dev);
376 mutex_lock(&priv->wx_mutex);
378 ret = ieee80211_wx_set_essid(priv->ieee80211, a, wrqu, b);
380 mutex_unlock(&priv->wx_mutex);
385 static int r8192_wx_get_essid(struct net_device *dev,
386 struct iw_request_info *a,
387 union iwreq_data *wrqu, char *b)
390 struct r8192_priv *priv = ieee80211_priv(dev);
392 mutex_lock(&priv->wx_mutex);
394 ret = ieee80211_wx_get_essid(priv->ieee80211, a, wrqu, b);
396 mutex_unlock(&priv->wx_mutex);
401 static int r8192_wx_set_freq(struct net_device *dev, struct iw_request_info *a,
402 union iwreq_data *wrqu, char *b)
405 struct r8192_priv *priv = ieee80211_priv(dev);
407 mutex_lock(&priv->wx_mutex);
409 ret = ieee80211_wx_set_freq(priv->ieee80211, a, wrqu, b);
411 mutex_unlock(&priv->wx_mutex);
415 static int r8192_wx_get_name(struct net_device *dev,
416 struct iw_request_info *info,
417 union iwreq_data *wrqu, char *extra)
419 struct r8192_priv *priv = ieee80211_priv(dev);
421 return ieee80211_wx_get_name(priv->ieee80211, info, wrqu, extra);
424 static int r8192_wx_set_frag(struct net_device *dev,
425 struct iw_request_info *info,
426 union iwreq_data *wrqu, char *extra)
428 struct r8192_priv *priv = ieee80211_priv(dev);
430 if (wrqu->frag.disabled)
431 priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
433 if (wrqu->frag.value < MIN_FRAG_THRESHOLD ||
434 wrqu->frag.value > MAX_FRAG_THRESHOLD)
437 priv->ieee80211->fts = wrqu->frag.value & ~0x1;
443 static int r8192_wx_get_frag(struct net_device *dev,
444 struct iw_request_info *info,
445 union iwreq_data *wrqu, char *extra)
447 struct r8192_priv *priv = ieee80211_priv(dev);
449 wrqu->frag.value = priv->ieee80211->fts;
450 wrqu->frag.fixed = 0; /* no auto select */
451 wrqu->frag.disabled = (wrqu->frag.value == DEFAULT_FRAG_THRESHOLD);
456 static int r8192_wx_set_wap(struct net_device *dev,
457 struct iw_request_info *info,
458 union iwreq_data *awrq,
462 struct r8192_priv *priv = ieee80211_priv(dev);
463 /* struct sockaddr *temp = (struct sockaddr *)awrq; */
464 mutex_lock(&priv->wx_mutex);
466 ret = ieee80211_wx_set_wap(priv->ieee80211, info, awrq, extra);
468 mutex_unlock(&priv->wx_mutex);
473 static int r8192_wx_get_wap(struct net_device *dev,
474 struct iw_request_info *info,
475 union iwreq_data *wrqu, char *extra)
477 struct r8192_priv *priv = ieee80211_priv(dev);
479 return ieee80211_wx_get_wap(priv->ieee80211, info, wrqu, extra);
482 static int r8192_wx_get_enc(struct net_device *dev,
483 struct iw_request_info *info,
484 union iwreq_data *wrqu, char *key)
486 struct r8192_priv *priv = ieee80211_priv(dev);
488 return ieee80211_wx_get_encode(priv->ieee80211, info, wrqu, key);
491 static int r8192_wx_set_enc(struct net_device *dev,
492 struct iw_request_info *info,
493 union iwreq_data *wrqu, char *key)
495 struct r8192_priv *priv = ieee80211_priv(dev);
496 struct ieee80211_device *ieee = priv->ieee80211;
498 u32 hwkey[4] = {0, 0, 0, 0};
501 u8 zero_addr[4][6] = { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
502 {0x00, 0x00, 0x00, 0x00, 0x00, 0x01},
503 {0x00, 0x00, 0x00, 0x00, 0x00, 0x02},
504 {0x00, 0x00, 0x00, 0x00, 0x00, 0x03} };
510 mutex_lock(&priv->wx_mutex);
512 RT_TRACE(COMP_SEC, "Setting SW wep key");
513 ret = ieee80211_wx_set_encode(priv->ieee80211, info, wrqu, key);
515 mutex_unlock(&priv->wx_mutex);
517 /* sometimes, the length is zero while we do not type key value */
518 if (wrqu->encoding.length != 0) {
519 for (i = 0; i < 4; i++) {
520 hwkey[i] |= key[4*i+0]&mask;
521 if (i == 1 && (4*i+1) == wrqu->encoding.length)
523 if (i == 3 && (4*i+1) == wrqu->encoding.length)
525 hwkey[i] |= (key[4*i+1]&mask)<<8;
526 hwkey[i] |= (key[4*i+2]&mask)<<16;
527 hwkey[i] |= (key[4*i+3]&mask)<<24;
530 #define CONF_WEP40 0x4
531 #define CONF_WEP104 0x14
533 switch (wrqu->encoding.flags & IW_ENCODE_INDEX) {
535 key_idx = ieee->tx_keyidx;
553 if (wrqu->encoding.length == 0x5) {
554 ieee->pairwise_key_type = KEY_TYPE_WEP40;
555 EnableHWSecurityConfig8192(dev);
558 key_idx, /* EntryNo */
559 key_idx, /* KeyIndex */
560 KEY_TYPE_WEP40, /* KeyType */
563 hwkey); /* KeyContent */
564 } else if (wrqu->encoding.length == 0xd) {
565 ieee->pairwise_key_type = KEY_TYPE_WEP104;
566 EnableHWSecurityConfig8192(dev);
569 key_idx, /* EntryNo */
570 key_idx, /* KeyIndex */
571 KEY_TYPE_WEP104, /* KeyType */
574 hwkey); /* KeyContent */
576 netdev_warn(dev, "wrong type in WEP, not WEP40 and WEP104\n");
583 static int r8192_wx_set_scan_type(struct net_device *dev, struct iw_request_info *aa,
584 union iwreq_data *wrqu, char *p)
586 struct r8192_priv *priv = ieee80211_priv(dev);
587 int *parms = (int *)p;
590 priv->ieee80211->active_scan = mode;
595 static int r8192_wx_set_retry(struct net_device *dev,
596 struct iw_request_info *info,
597 union iwreq_data *wrqu, char *extra)
599 struct r8192_priv *priv = ieee80211_priv(dev);
602 mutex_lock(&priv->wx_mutex);
604 if (wrqu->retry.flags & IW_RETRY_LIFETIME ||
605 wrqu->retry.disabled){
609 if (!(wrqu->retry.flags & IW_RETRY_LIMIT)) {
614 if (wrqu->retry.value > R8180_MAX_RETRY) {
618 if (wrqu->retry.flags & IW_RETRY_MAX) {
619 priv->retry_rts = wrqu->retry.value;
620 DMESG("Setting retry for RTS/CTS data to %d", wrqu->retry.value);
623 priv->retry_data = wrqu->retry.value;
624 DMESG("Setting retry for non RTS/CTS data to %d", wrqu->retry.value);
628 * We might try to write directly the TX config register
629 * or to restart just the (R)TX process.
630 * I'm unsure if whole reset is really needed
635 mutex_unlock(&priv->wx_mutex);
640 static int r8192_wx_get_retry(struct net_device *dev,
641 struct iw_request_info *info,
642 union iwreq_data *wrqu, char *extra)
644 struct r8192_priv *priv = ieee80211_priv(dev);
646 wrqu->retry.disabled = 0; /* can't be disabled */
648 if ((wrqu->retry.flags & IW_RETRY_TYPE) ==
652 if (wrqu->retry.flags & IW_RETRY_MAX) {
653 wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_MAX;
654 wrqu->retry.value = priv->retry_rts;
656 wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_MIN;
657 wrqu->retry.value = priv->retry_data;
663 static int r8192_wx_get_sens(struct net_device *dev,
664 struct iw_request_info *info,
665 union iwreq_data *wrqu, char *extra)
667 struct r8192_priv *priv = ieee80211_priv(dev);
669 if (!priv->rf_set_sens)
670 return -1; /* we have not this support for this radio */
671 wrqu->sens.value = priv->sens;
675 static int r8192_wx_set_sens(struct net_device *dev,
676 struct iw_request_info *info,
677 union iwreq_data *wrqu, char *extra)
679 struct r8192_priv *priv = ieee80211_priv(dev);
682 mutex_lock(&priv->wx_mutex);
683 if (!priv->rf_set_sens) {
684 err = -1; /* we have not this support for this radio */
687 if (priv->rf_set_sens(dev, wrqu->sens.value) == 0)
688 priv->sens = wrqu->sens.value;
693 mutex_unlock(&priv->wx_mutex);
698 /* hw security need to reorganized. */
699 static int r8192_wx_set_enc_ext(struct net_device *dev,
700 struct iw_request_info *info,
701 union iwreq_data *wrqu, char *extra)
704 struct r8192_priv *priv = ieee80211_priv(dev);
705 struct ieee80211_device *ieee = priv->ieee80211;
707 mutex_lock(&priv->wx_mutex);
708 ret = ieee80211_wx_set_encode_ext(priv->ieee80211, info, wrqu, extra);
711 u8 broadcast_addr[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
714 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
715 struct iw_point *encoding = &wrqu->encoding;
716 u8 idx = 0, alg = 0, group = 0;
718 if ((encoding->flags & IW_ENCODE_DISABLED) || ext->alg == IW_ENCODE_ALG_NONE)
719 /* none is not allowed to use hwsec WB 2008.07.01 */
722 /* as IW_ENCODE_ALG_CCMP is defined to be 3 and KEY_TYPE_CCMP is defined to 4; */
723 alg = (ext->alg == IW_ENCODE_ALG_CCMP)?KEY_TYPE_CCMP:ext->alg;
724 idx = encoding->flags & IW_ENCODE_INDEX;
727 group = ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY;
729 if ((!group) || (IW_MODE_ADHOC == ieee->iw_mode) || (alg == KEY_TYPE_WEP40)) {
730 if ((ext->key_len == 13) && (alg == KEY_TYPE_WEP40))
731 alg = KEY_TYPE_WEP104;
732 ieee->pairwise_key_type = alg;
733 EnableHWSecurityConfig8192(dev);
735 memcpy((u8 *)key, ext->key, 16); /* we only get 16 bytes key.why? WB 2008.7.1 */
737 if ((alg & KEY_TYPE_WEP40) && (ieee->auth_mode != 2)) {
744 key); /* KeyContent */
746 ieee->group_key_type = alg;
751 broadcast_addr, /* MacAddr */
753 key); /* KeyContent */
754 } else { /* pairwise key */
759 (u8 *)ieee->ap_mac_addr,/* MacAddr */
761 key); /* KeyContent */
767 mutex_unlock(&priv->wx_mutex);
771 static int r8192_wx_set_auth(struct net_device *dev,
772 struct iw_request_info *info,
773 union iwreq_data *data, char *extra)
776 struct r8192_priv *priv = ieee80211_priv(dev);
778 mutex_lock(&priv->wx_mutex);
779 ret = ieee80211_wx_set_auth(priv->ieee80211, info, &(data->param), extra);
780 mutex_unlock(&priv->wx_mutex);
784 static int r8192_wx_set_mlme(struct net_device *dev,
785 struct iw_request_info *info,
786 union iwreq_data *wrqu, char *extra)
789 struct r8192_priv *priv = ieee80211_priv(dev);
791 mutex_lock(&priv->wx_mutex);
792 ret = ieee80211_wx_set_mlme(priv->ieee80211, info, wrqu, extra);
794 mutex_unlock(&priv->wx_mutex);
798 static int r8192_wx_set_gen_ie(struct net_device *dev,
799 struct iw_request_info *info,
800 union iwreq_data *data, char *extra)
803 struct r8192_priv *priv = ieee80211_priv(dev);
805 mutex_lock(&priv->wx_mutex);
806 ret = ieee80211_wx_set_gen_ie(priv->ieee80211, extra, data->data.length);
807 mutex_unlock(&priv->wx_mutex);
811 static int dummy(struct net_device *dev, struct iw_request_info *a,
812 union iwreq_data *wrqu, char *b)
817 static iw_handler r8192_wx_handlers[] = {
818 NULL, /* SIOCSIWCOMMIT */
819 r8192_wx_get_name, /* SIOCGIWNAME */
820 dummy, /* SIOCSIWNWID */
821 dummy, /* SIOCGIWNWID */
822 r8192_wx_set_freq, /* SIOCSIWFREQ */
823 r8192_wx_get_freq, /* SIOCGIWFREQ */
824 r8192_wx_set_mode, /* SIOCSIWMODE */
825 r8192_wx_get_mode, /* SIOCGIWMODE */
826 r8192_wx_set_sens, /* SIOCSIWSENS */
827 r8192_wx_get_sens, /* SIOCGIWSENS */
828 NULL, /* SIOCSIWRANGE */
829 rtl8180_wx_get_range, /* SIOCGIWRANGE */
830 NULL, /* SIOCSIWPRIV */
831 NULL, /* SIOCGIWPRIV */
832 NULL, /* SIOCSIWSTATS */
833 NULL, /* SIOCGIWSTATS */
834 dummy, /* SIOCSIWSPY */
835 dummy, /* SIOCGIWSPY */
836 NULL, /* SIOCGIWTHRSPY */
837 NULL, /* SIOCWIWTHRSPY */
838 r8192_wx_set_wap, /* SIOCSIWAP */
839 r8192_wx_get_wap, /* SIOCGIWAP */
840 r8192_wx_set_mlme, /* MLME-- */
841 dummy, /* SIOCGIWAPLIST -- deprecated */
842 r8192_wx_set_scan, /* SIOCSIWSCAN */
843 r8192_wx_get_scan, /* SIOCGIWSCAN */
844 r8192_wx_set_essid, /* SIOCSIWESSID */
845 r8192_wx_get_essid, /* SIOCGIWESSID */
846 dummy, /* SIOCSIWNICKN */
847 dummy, /* SIOCGIWNICKN */
848 NULL, /* -- hole -- */
849 NULL, /* -- hole -- */
850 r8192_wx_set_rate, /* SIOCSIWRATE */
851 r8192_wx_get_rate, /* SIOCGIWRATE */
852 r8192_wx_set_rts, /* SIOCSIWRTS */
853 r8192_wx_get_rts, /* SIOCGIWRTS */
854 r8192_wx_set_frag, /* SIOCSIWFRAG */
855 r8192_wx_get_frag, /* SIOCGIWFRAG */
856 dummy, /* SIOCSIWTXPOW */
857 dummy, /* SIOCGIWTXPOW */
858 r8192_wx_set_retry, /* SIOCSIWRETRY */
859 r8192_wx_get_retry, /* SIOCGIWRETRY */
860 r8192_wx_set_enc, /* SIOCSIWENCODE */
861 r8192_wx_get_enc, /* SIOCGIWENCODE */
862 r8192_wx_set_power, /* SIOCSIWPOWER */
863 r8192_wx_get_power, /* SIOCGIWPOWER */
866 r8192_wx_set_gen_ie, /* NULL, */ /* SIOCSIWGENIE */
867 NULL, /* SIOCSIWGENIE */
869 r8192_wx_set_auth,/* NULL, */ /* SIOCSIWAUTH */
870 NULL,/* r8192_wx_get_auth, */ /* NULL, */ /* SIOCSIWAUTH */
871 r8192_wx_set_enc_ext, /* SIOCSIWENCODEEXT */
872 NULL,/* r8192_wx_get_enc_ext, *//* NULL, */ /* SIOCSIWENCODEEXT */
873 NULL, /* SIOCSIWPMKSA */
879 static const struct iw_priv_args r8192_private_args[] = {
882 SIOCIWFIRSTPRIV + 0x0,
883 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc"
887 SIOCIWFIRSTPRIV + 0x1,
888 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan"
892 SIOCIWFIRSTPRIV + 0x2,
893 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rawtx"
896 SIOCIWFIRSTPRIV + 0x3,
897 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "forcereset"
903 static iw_handler r8192_private_handler[] = {
905 r8192_wx_set_scan_type,
907 r8192_wx_force_reset,
910 struct iw_statistics *r8192_get_wireless_stats(struct net_device *dev)
912 struct r8192_priv *priv = ieee80211_priv(dev);
913 struct ieee80211_device *ieee = priv->ieee80211;
914 struct iw_statistics *wstats = &priv->wstats;
919 if (ieee->state < IEEE80211_LINKED) {
920 wstats->qual.qual = 0;
921 wstats->qual.level = 0;
922 wstats->qual.noise = 0;
923 wstats->qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
927 tmp_level = (&ieee->current_network)->stats.rssi;
928 tmp_qual = (&ieee->current_network)->stats.signal;
929 tmp_noise = (&ieee->current_network)->stats.noise;
931 wstats->qual.level = tmp_level;
932 wstats->qual.qual = tmp_qual;
933 wstats->qual.noise = tmp_noise;
934 wstats->qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
938 const struct iw_handler_def r8192_wx_handlers_def = {
939 .standard = r8192_wx_handlers,
940 .num_standard = ARRAY_SIZE(r8192_wx_handlers),
941 .private = r8192_private_handler,
942 .num_private = ARRAY_SIZE(r8192_private_handler),
943 .num_private_args = sizeof(r8192_private_args) / sizeof(struct iw_priv_args),
944 .get_wireless_stats = r8192_get_wireless_stats,
945 .private_args = (struct iw_priv_args *)r8192_private_args,