1 /******************************************************************************
3 * This file contains wireless extension handlers.
5 * This is part of rtl8180 OpenSource driver.
6 * Copyright (C) Andrea Merello 2004-2005 <andrea.merello@gmail.com>
7 * Released under the terms of GPL (General Public Licence)
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"
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);
144 static int r8192_wx_set_rawtx(struct net_device *dev,
145 struct iw_request_info *info,
146 union iwreq_data *wrqu, char *extra)
148 struct r8192_priv *priv = ieee80211_priv(dev);
151 mutex_lock(&priv->wx_mutex);
153 ret = ieee80211_wx_set_rawtx(priv->ieee80211, info, wrqu, extra);
155 mutex_unlock(&priv->wx_mutex);
161 static int r8192_wx_set_crcmon(struct net_device *dev,
162 struct iw_request_info *info,
163 union iwreq_data *wrqu, char *extra)
165 struct r8192_priv *priv = ieee80211_priv(dev);
166 int *parms = (int *)extra;
167 int enable = (parms[0] > 0);
169 mutex_lock(&priv->wx_mutex);
176 DMESG("bad CRC in monitor mode are %s",
177 priv->crcmon ? "accepted" : "rejected");
179 mutex_unlock(&priv->wx_mutex);
184 static int r8192_wx_set_mode(struct net_device *dev, struct iw_request_info *a,
185 union iwreq_data *wrqu, char *b)
187 struct r8192_priv *priv = ieee80211_priv(dev);
190 mutex_lock(&priv->wx_mutex);
192 ret = ieee80211_wx_set_mode(priv->ieee80211, a, wrqu, b);
194 rtl8192_set_rxconf(dev);
196 mutex_unlock(&priv->wx_mutex);
200 struct iw_range_with_scan_capa {
201 /* Informative stuff (to choose between different interface) */
202 __u32 throughput; /* To give an idea... */
203 /* In theory this value should be the maximum benchmarked
204 * TCP/IP throughput, because with most of these devices the
205 * bit rate is meaningless (overhead an co) to estimate how
206 * fast the connection will go and pick the fastest one.
207 * I suggest people to play with Netperf or any benchmark...
210 /* NWID (or domain id) */
211 __u32 min_nwid; /* Minimal NWID we are able to set */
212 __u32 max_nwid; /* Maximal NWID we are able to set */
214 /* Old Frequency (backward compat - moved lower ) */
215 __u16 old_num_channels;
216 __u8 old_num_frequency;
218 /* Scan capabilities */
221 static int rtl8180_wx_get_range(struct net_device *dev,
222 struct iw_request_info *info,
223 union iwreq_data *wrqu, char *extra)
225 struct iw_range *range = (struct iw_range *)extra;
226 struct iw_range_with_scan_capa *tmp = (struct iw_range_with_scan_capa *)range;
227 struct r8192_priv *priv = ieee80211_priv(dev);
231 wrqu->data.length = sizeof(*range);
232 memset(range, 0, sizeof(*range));
234 /* Let's try to keep this struct in the same order as in
235 * linux/include/wireless.h
238 /* TODO: See what values we can set, and remove the ones we can't
239 * set, or fill them with some default data.
242 /* ~5 Mb/s real (802.11b) */
243 range->throughput = 5 * 1000 * 1000;
245 /* TODO: Not used in 802.11b? */
246 /* range->min_nwid; */ /* Minimal NWID we are able to set */
247 /* TODO: Not used in 802.11b? */
248 /* range->max_nwid; */ /* Maximal NWID we are able to set */
250 /* Old Frequency (backward compat - moved lower ) */
251 /* range->old_num_channels; */
252 /* range->old_num_frequency; */
253 /* range->old_freq[6]; */ /* Filler to keep "version" at the same offset */
254 if (priv->rf_set_sens != NULL)
255 range->sensitivity = priv->max_sens; /* signal level threshold range */
257 range->max_qual.qual = 100;
258 /* TODO: Find real max RSSI and stick here */
259 range->max_qual.level = 0;
260 range->max_qual.noise = 0x100 - 98;
261 range->max_qual.updated = 7; /* Updated all three */
263 range->avg_qual.qual = 92; /* > 8% missed beacons is 'bad' */
264 /* TODO: Find real 'good' to 'bad' threshold value for RSSI */
265 range->avg_qual.level = 0x100 - 78;
266 range->avg_qual.noise = 0;
267 range->avg_qual.updated = 7; /* Updated all three */
269 range->num_bitrates = RATE_COUNT;
271 for (i = 0; i < RATE_COUNT && i < IW_MAX_BITRATES; i++)
272 range->bitrate[i] = rtl8180_rates[i];
274 range->min_frag = MIN_FRAG_THRESHOLD;
275 range->max_frag = MAX_FRAG_THRESHOLD;
278 range->max_pmp = 5000000;
280 range->max_pmt = 65535*1000;
281 range->pmp_flags = IW_POWER_PERIOD;
282 range->pmt_flags = IW_POWER_TIMEOUT;
283 range->pm_capa = IW_POWER_PERIOD | IW_POWER_TIMEOUT | IW_POWER_ALL_R;
285 range->we_version_compiled = WIRELESS_EXT;
286 range->we_version_source = 16;
288 /* range->retry_capa; */ /* What retry options are supported */
289 /* range->retry_flags; */ /* How to decode max/min retry limit */
290 /* range->r_time_flags; */ /* How to decode max/min retry life */
291 /* range->min_retry; */ /* Minimal number of retries */
292 /* range->max_retry; */ /* Maximal number of retries */
293 /* range->min_r_time; */ /* Minimal retry lifetime */
294 /* range->max_r_time; */ /* Maximal retry lifetime */
296 for (i = 0, val = 0; i < 14; i++) {
298 /* Include only legal frequencies for some countries */
299 if ((GET_DOT11D_INFO(priv->ieee80211)->channel_map)[i+1]) {
300 range->freq[val].i = i + 1;
301 range->freq[val].m = ieee80211_wlan_frequencies[i] * 100000;
302 range->freq[val].e = 1;
305 /* FIXME: do we need to set anything for channels */
309 if (val == IW_MAX_FREQUENCIES)
312 range->num_frequency = val;
313 range->num_channels = val;
314 range->enc_capa = IW_ENC_CAPA_WPA|IW_ENC_CAPA_WPA2|
315 IW_ENC_CAPA_CIPHER_TKIP|IW_ENC_CAPA_CIPHER_CCMP;
316 tmp->scan_capa = 0x01;
320 static int r8192_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
321 union iwreq_data *wrqu, char *b)
323 struct r8192_priv *priv = ieee80211_priv(dev);
324 struct ieee80211_device *ieee = priv->ieee80211;
330 if (priv->ieee80211->LinkDetectInfo.bBusyTraffic)
332 if (wrqu->data.flags & IW_SCAN_THIS_ESSID) {
333 struct iw_scan_req *req = (struct iw_scan_req *)b;
335 if (req->essid_len) {
336 ieee->current_network.ssid_len = req->essid_len;
337 memcpy(ieee->current_network.ssid, req->essid, req->essid_len);
341 mutex_lock(&priv->wx_mutex);
342 if (priv->ieee80211->state != IEEE80211_LINKED) {
343 priv->ieee80211->scanning = 0;
344 ieee80211_softmac_scan_syncro(priv->ieee80211);
347 ret = ieee80211_wx_set_scan(priv->ieee80211, a, wrqu, b);
349 mutex_unlock(&priv->wx_mutex);
354 static int r8192_wx_get_scan(struct net_device *dev, struct iw_request_info *a,
355 union iwreq_data *wrqu, char *b)
359 struct r8192_priv *priv = ieee80211_priv(dev);
364 mutex_lock(&priv->wx_mutex);
366 ret = ieee80211_wx_get_scan(priv->ieee80211, a, wrqu, b);
368 mutex_unlock(&priv->wx_mutex);
373 static int r8192_wx_set_essid(struct net_device *dev,
374 struct iw_request_info *a,
375 union iwreq_data *wrqu, char *b)
377 struct r8192_priv *priv = ieee80211_priv(dev);
380 mutex_lock(&priv->wx_mutex);
382 ret = ieee80211_wx_set_essid(priv->ieee80211, a, wrqu, b);
384 mutex_unlock(&priv->wx_mutex);
389 static int r8192_wx_get_essid(struct net_device *dev,
390 struct iw_request_info *a,
391 union iwreq_data *wrqu, char *b)
394 struct r8192_priv *priv = ieee80211_priv(dev);
396 mutex_lock(&priv->wx_mutex);
398 ret = ieee80211_wx_get_essid(priv->ieee80211, a, wrqu, b);
400 mutex_unlock(&priv->wx_mutex);
405 static int r8192_wx_set_freq(struct net_device *dev, struct iw_request_info *a,
406 union iwreq_data *wrqu, char *b)
409 struct r8192_priv *priv = ieee80211_priv(dev);
411 mutex_lock(&priv->wx_mutex);
413 ret = ieee80211_wx_set_freq(priv->ieee80211, a, wrqu, b);
415 mutex_unlock(&priv->wx_mutex);
419 static int r8192_wx_get_name(struct net_device *dev,
420 struct iw_request_info *info,
421 union iwreq_data *wrqu, char *extra)
423 struct r8192_priv *priv = ieee80211_priv(dev);
425 return ieee80211_wx_get_name(priv->ieee80211, info, wrqu, extra);
428 static int r8192_wx_set_frag(struct net_device *dev,
429 struct iw_request_info *info,
430 union iwreq_data *wrqu, char *extra)
432 struct r8192_priv *priv = ieee80211_priv(dev);
434 if (wrqu->frag.disabled)
435 priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
437 if (wrqu->frag.value < MIN_FRAG_THRESHOLD ||
438 wrqu->frag.value > MAX_FRAG_THRESHOLD)
441 priv->ieee80211->fts = wrqu->frag.value & ~0x1;
448 static int r8192_wx_get_frag(struct net_device *dev,
449 struct iw_request_info *info,
450 union iwreq_data *wrqu, char *extra)
452 struct r8192_priv *priv = ieee80211_priv(dev);
454 wrqu->frag.value = priv->ieee80211->fts;
455 wrqu->frag.fixed = 0; /* no auto select */
456 wrqu->frag.disabled = (wrqu->frag.value == DEFAULT_FRAG_THRESHOLD);
462 static int r8192_wx_set_wap(struct net_device *dev,
463 struct iw_request_info *info,
464 union iwreq_data *awrq,
469 struct r8192_priv *priv = ieee80211_priv(dev);
470 /* struct sockaddr *temp = (struct sockaddr *)awrq; */
471 mutex_lock(&priv->wx_mutex);
473 ret = ieee80211_wx_set_wap(priv->ieee80211, info, awrq, extra);
475 mutex_unlock(&priv->wx_mutex);
481 static int r8192_wx_get_wap(struct net_device *dev,
482 struct iw_request_info *info,
483 union iwreq_data *wrqu, char *extra)
485 struct r8192_priv *priv = ieee80211_priv(dev);
487 return ieee80211_wx_get_wap(priv->ieee80211, info, wrqu, extra);
490 static int r8192_wx_get_enc(struct net_device *dev,
491 struct iw_request_info *info,
492 union iwreq_data *wrqu, char *key)
494 struct r8192_priv *priv = ieee80211_priv(dev);
496 return ieee80211_wx_get_encode(priv->ieee80211, info, wrqu, key);
499 static int r8192_wx_set_enc(struct net_device *dev,
500 struct iw_request_info *info,
501 union iwreq_data *wrqu, char *key)
503 struct r8192_priv *priv = ieee80211_priv(dev);
504 struct ieee80211_device *ieee = priv->ieee80211;
506 u32 hwkey[4] = {0, 0, 0, 0};
509 u8 zero_addr[4][6] = { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
510 {0x00, 0x00, 0x00, 0x00, 0x00, 0x01},
511 {0x00, 0x00, 0x00, 0x00, 0x00, 0x02},
512 {0x00, 0x00, 0x00, 0x00, 0x00, 0x03} };
518 mutex_lock(&priv->wx_mutex);
520 RT_TRACE(COMP_SEC, "Setting SW wep key");
521 ret = ieee80211_wx_set_encode(priv->ieee80211, info, wrqu, key);
523 mutex_unlock(&priv->wx_mutex);
527 /* sometimes, the length is zero while we do not type key value */
528 if (wrqu->encoding.length != 0) {
530 for (i = 0; i < 4; i++) {
531 hwkey[i] |= key[4*i+0]&mask;
532 if (i == 1 && (4*i+1) == wrqu->encoding.length)
534 if (i == 3 && (4*i+1) == wrqu->encoding.length)
536 hwkey[i] |= (key[4*i+1]&mask)<<8;
537 hwkey[i] |= (key[4*i+2]&mask)<<16;
538 hwkey[i] |= (key[4*i+3]&mask)<<24;
541 #define CONF_WEP40 0x4
542 #define CONF_WEP104 0x14
544 switch (wrqu->encoding.flags & IW_ENCODE_INDEX) {
546 key_idx = ieee->tx_keyidx;
564 if (wrqu->encoding.length == 0x5) {
565 ieee->pairwise_key_type = KEY_TYPE_WEP40;
566 EnableHWSecurityConfig8192(dev);
569 key_idx, /* EntryNo */
570 key_idx, /* KeyIndex */
571 KEY_TYPE_WEP40, /* KeyType */
574 hwkey); /* KeyContent */
578 else if (wrqu->encoding.length == 0xd) {
579 ieee->pairwise_key_type = KEY_TYPE_WEP104;
580 EnableHWSecurityConfig8192(dev);
583 key_idx, /* EntryNo */
584 key_idx, /* KeyIndex */
585 KEY_TYPE_WEP104, /* KeyType */
588 hwkey); /* KeyContent */
591 printk("wrong type in WEP, not WEP40 and WEP104\n");
600 static int r8192_wx_set_scan_type(struct net_device *dev, struct iw_request_info *aa,
601 union iwreq_data *wrqu, char *p)
604 struct r8192_priv *priv = ieee80211_priv(dev);
605 int *parms = (int *)p;
608 priv->ieee80211->active_scan = mode;
615 static int r8192_wx_set_retry(struct net_device *dev,
616 struct iw_request_info *info,
617 union iwreq_data *wrqu, char *extra)
619 struct r8192_priv *priv = ieee80211_priv(dev);
622 mutex_lock(&priv->wx_mutex);
624 if (wrqu->retry.flags & IW_RETRY_LIFETIME ||
625 wrqu->retry.disabled){
629 if (!(wrqu->retry.flags & IW_RETRY_LIMIT)) {
634 if (wrqu->retry.value > R8180_MAX_RETRY) {
638 if (wrqu->retry.flags & IW_RETRY_MAX) {
639 priv->retry_rts = wrqu->retry.value;
640 DMESG("Setting retry for RTS/CTS data to %d", wrqu->retry.value);
643 priv->retry_data = wrqu->retry.value;
644 DMESG("Setting retry for non RTS/CTS data to %d", wrqu->retry.value);
648 * We might try to write directly the TX config register
649 * or to restart just the (R)TX process.
650 * I'm unsure if whole reset is really needed
655 mutex_unlock(&priv->wx_mutex);
660 static int r8192_wx_get_retry(struct net_device *dev,
661 struct iw_request_info *info,
662 union iwreq_data *wrqu, char *extra)
664 struct r8192_priv *priv = ieee80211_priv(dev);
667 wrqu->retry.disabled = 0; /* can't be disabled */
669 if ((wrqu->retry.flags & IW_RETRY_TYPE) ==
673 if (wrqu->retry.flags & IW_RETRY_MAX) {
674 wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_MAX;
675 wrqu->retry.value = priv->retry_rts;
677 wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_MIN;
678 wrqu->retry.value = priv->retry_data;
684 static int r8192_wx_get_sens(struct net_device *dev,
685 struct iw_request_info *info,
686 union iwreq_data *wrqu, char *extra)
688 struct r8192_priv *priv = ieee80211_priv(dev);
690 if (priv->rf_set_sens == NULL)
691 return -1; /* we have not this support for this radio */
692 wrqu->sens.value = priv->sens;
696 static int r8192_wx_set_sens(struct net_device *dev,
697 struct iw_request_info *info,
698 union iwreq_data *wrqu, char *extra)
701 struct r8192_priv *priv = ieee80211_priv(dev);
704 mutex_lock(&priv->wx_mutex);
705 if (priv->rf_set_sens == NULL) {
706 err = -1; /* we have not this support for this radio */
709 if (priv->rf_set_sens(dev, wrqu->sens.value) == 0)
710 priv->sens = wrqu->sens.value;
715 mutex_unlock(&priv->wx_mutex);
720 /* hw security need to reorganized. */
721 static int r8192_wx_set_enc_ext(struct net_device *dev,
722 struct iw_request_info *info,
723 union iwreq_data *wrqu, char *extra)
726 struct r8192_priv *priv = ieee80211_priv(dev);
727 struct ieee80211_device *ieee = priv->ieee80211;
730 mutex_lock(&priv->wx_mutex);
731 ret = ieee80211_wx_set_encode_ext(priv->ieee80211, info, wrqu, extra);
734 u8 broadcast_addr[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
737 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
738 struct iw_point *encoding = &wrqu->encoding;
739 u8 idx = 0, alg = 0, group = 0;
741 if ((encoding->flags & IW_ENCODE_DISABLED) || ext->alg == IW_ENCODE_ALG_NONE)
742 /* none is not allowed to use hwsec WB 2008.07.01 */
745 /* as IW_ENCODE_ALG_CCMP is defined to be 3 and KEY_TYPE_CCMP is defined to 4; */
746 alg = (ext->alg == IW_ENCODE_ALG_CCMP)?KEY_TYPE_CCMP:ext->alg;
747 idx = encoding->flags & IW_ENCODE_INDEX;
750 group = ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY;
752 if ((!group) || (IW_MODE_ADHOC == ieee->iw_mode) || (alg == KEY_TYPE_WEP40)) {
753 if ((ext->key_len == 13) && (alg == KEY_TYPE_WEP40))
754 alg = KEY_TYPE_WEP104;
755 ieee->pairwise_key_type = alg;
756 EnableHWSecurityConfig8192(dev);
758 memcpy((u8 *)key, ext->key, 16); /* we only get 16 bytes key.why? WB 2008.7.1 */
760 if ((alg & KEY_TYPE_WEP40) && (ieee->auth_mode != 2)) {
768 key); /* KeyContent */
770 ieee->group_key_type = alg;
775 broadcast_addr, /* MacAddr */
777 key); /* KeyContent */
778 } else { /* pairwise key */
783 (u8 *)ieee->ap_mac_addr,/* MacAddr */
785 key); /* KeyContent */
793 mutex_unlock(&priv->wx_mutex);
797 static int r8192_wx_set_auth(struct net_device *dev,
798 struct iw_request_info *info,
799 union iwreq_data *data, char *extra)
802 struct r8192_priv *priv = ieee80211_priv(dev);
804 mutex_lock(&priv->wx_mutex);
805 ret = ieee80211_wx_set_auth(priv->ieee80211, info, &(data->param), extra);
806 mutex_unlock(&priv->wx_mutex);
810 static int r8192_wx_set_mlme(struct net_device *dev,
811 struct iw_request_info *info,
812 union iwreq_data *wrqu, char *extra)
816 struct r8192_priv *priv = ieee80211_priv(dev);
818 mutex_lock(&priv->wx_mutex);
819 ret = ieee80211_wx_set_mlme(priv->ieee80211, info, wrqu, extra);
821 mutex_unlock(&priv->wx_mutex);
825 static int r8192_wx_set_gen_ie(struct net_device *dev,
826 struct iw_request_info *info,
827 union iwreq_data *data, char *extra)
830 struct r8192_priv *priv = ieee80211_priv(dev);
832 mutex_lock(&priv->wx_mutex);
833 ret = ieee80211_wx_set_gen_ie(priv->ieee80211, extra, data->data.length);
834 mutex_unlock(&priv->wx_mutex);
840 static int dummy(struct net_device *dev, struct iw_request_info *a,
841 union iwreq_data *wrqu, char *b)
846 static iw_handler r8192_wx_handlers[] = {
847 NULL, /* SIOCSIWCOMMIT */
848 r8192_wx_get_name, /* SIOCGIWNAME */
849 dummy, /* SIOCSIWNWID */
850 dummy, /* SIOCGIWNWID */
851 r8192_wx_set_freq, /* SIOCSIWFREQ */
852 r8192_wx_get_freq, /* SIOCGIWFREQ */
853 r8192_wx_set_mode, /* SIOCSIWMODE */
854 r8192_wx_get_mode, /* SIOCGIWMODE */
855 r8192_wx_set_sens, /* SIOCSIWSENS */
856 r8192_wx_get_sens, /* SIOCGIWSENS */
857 NULL, /* SIOCSIWRANGE */
858 rtl8180_wx_get_range, /* SIOCGIWRANGE */
859 NULL, /* SIOCSIWPRIV */
860 NULL, /* SIOCGIWPRIV */
861 NULL, /* SIOCSIWSTATS */
862 NULL, /* SIOCGIWSTATS */
863 dummy, /* SIOCSIWSPY */
864 dummy, /* SIOCGIWSPY */
865 NULL, /* SIOCGIWTHRSPY */
866 NULL, /* SIOCWIWTHRSPY */
867 r8192_wx_set_wap, /* SIOCSIWAP */
868 r8192_wx_get_wap, /* SIOCGIWAP */
869 r8192_wx_set_mlme, /* MLME-- */
870 dummy, /* SIOCGIWAPLIST -- deprecated */
871 r8192_wx_set_scan, /* SIOCSIWSCAN */
872 r8192_wx_get_scan, /* SIOCGIWSCAN */
873 r8192_wx_set_essid, /* SIOCSIWESSID */
874 r8192_wx_get_essid, /* SIOCGIWESSID */
875 dummy, /* SIOCSIWNICKN */
876 dummy, /* SIOCGIWNICKN */
877 NULL, /* -- hole -- */
878 NULL, /* -- hole -- */
879 r8192_wx_set_rate, /* SIOCSIWRATE */
880 r8192_wx_get_rate, /* SIOCGIWRATE */
881 r8192_wx_set_rts, /* SIOCSIWRTS */
882 r8192_wx_get_rts, /* SIOCGIWRTS */
883 r8192_wx_set_frag, /* SIOCSIWFRAG */
884 r8192_wx_get_frag, /* SIOCGIWFRAG */
885 dummy, /* SIOCSIWTXPOW */
886 dummy, /* SIOCGIWTXPOW */
887 r8192_wx_set_retry, /* SIOCSIWRETRY */
888 r8192_wx_get_retry, /* SIOCGIWRETRY */
889 r8192_wx_set_enc, /* SIOCSIWENCODE */
890 r8192_wx_get_enc, /* SIOCGIWENCODE */
891 r8192_wx_set_power, /* SIOCSIWPOWER */
892 r8192_wx_get_power, /* SIOCGIWPOWER */
895 r8192_wx_set_gen_ie, /* NULL, */ /* SIOCSIWGENIE */
896 NULL, /* SIOCSIWGENIE */
898 r8192_wx_set_auth,/* NULL, */ /* SIOCSIWAUTH */
899 NULL,/* r8192_wx_get_auth, */ /* NULL, */ /* SIOCSIWAUTH */
900 r8192_wx_set_enc_ext, /* SIOCSIWENCODEEXT */
901 NULL,/* r8192_wx_get_enc_ext, *//* NULL, */ /* SIOCSIWENCODEEXT */
902 NULL, /* SIOCSIWPMKSA */
908 static const struct iw_priv_args r8192_private_args[] = {
911 SIOCIWFIRSTPRIV + 0x0,
912 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc"
916 SIOCIWFIRSTPRIV + 0x1,
917 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan"
921 SIOCIWFIRSTPRIV + 0x2,
922 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rawtx"
925 SIOCIWFIRSTPRIV + 0x3,
926 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "forcereset"
932 static iw_handler r8192_private_handler[] = {
934 r8192_wx_set_scan_type,
936 r8192_wx_force_reset,
939 struct iw_statistics *r8192_get_wireless_stats(struct net_device *dev)
941 struct r8192_priv *priv = ieee80211_priv(dev);
942 struct ieee80211_device *ieee = priv->ieee80211;
943 struct iw_statistics *wstats = &priv->wstats;
948 if (ieee->state < IEEE80211_LINKED) {
949 wstats->qual.qual = 0;
950 wstats->qual.level = 0;
951 wstats->qual.noise = 0;
952 wstats->qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
956 tmp_level = (&ieee->current_network)->stats.rssi;
957 tmp_qual = (&ieee->current_network)->stats.signal;
958 tmp_noise = (&ieee->current_network)->stats.noise;
960 wstats->qual.level = tmp_level;
961 wstats->qual.qual = tmp_qual;
962 wstats->qual.noise = tmp_noise;
963 wstats->qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
967 struct iw_handler_def r8192_wx_handlers_def = {
968 .standard = r8192_wx_handlers,
969 .num_standard = ARRAY_SIZE(r8192_wx_handlers),
970 .private = r8192_private_handler,
971 .num_private = ARRAY_SIZE(r8192_private_handler),
972 .num_private_args = sizeof(r8192_private_args) / sizeof(struct iw_priv_args),
973 .get_wireless_stats = r8192_get_wireless_stats,
974 .private_args = (struct iw_priv_args *)r8192_private_args,