2 This file contains wireless extension handlers.
4 This is part of rtl8180 OpenSource driver.
5 Copyright (C) Andrea Merello 2004-2005 <andrea.merello@gmail.com>
6 Released under the terms of GPL (General Public Licence)
8 Parts of this driver are based on the GPL part
9 of the official realtek driver.
11 Parts of this driver are based on the rtl8180 driver skeleton
12 from Patric Schenke & Andres Salomon.
14 Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver.
16 We want to thank the Authors of those projects and the Ndiswrapper
20 #include <linux/string.h>
22 #include "r8192U_hw.h"
27 u32 rtl8180_rates[] = {1000000, 2000000, 5500000, 11000000,
28 6000000, 9000000, 12000000, 18000000, 24000000, 36000000, 48000000, 54000000};
35 static int r8192_wx_get_freq(struct net_device *dev,
36 struct iw_request_info *a,
37 union iwreq_data *wrqu, char *b)
39 struct r8192_priv *priv = ieee80211_priv(dev);
41 return ieee80211_wx_get_freq(priv->ieee80211, a, wrqu, b);
45 static int r8192_wx_get_mode(struct net_device *dev, struct iw_request_info *a,
46 union iwreq_data *wrqu, char *b)
48 struct r8192_priv *priv = ieee80211_priv(dev);
50 return ieee80211_wx_get_mode(priv->ieee80211, a, wrqu, b);
55 static int r8192_wx_get_rate(struct net_device *dev,
56 struct iw_request_info *info,
57 union iwreq_data *wrqu, char *extra)
59 struct r8192_priv *priv = ieee80211_priv(dev);
61 return ieee80211_wx_get_rate(priv->ieee80211, info, wrqu, extra);
66 static int r8192_wx_set_rate(struct net_device *dev,
67 struct iw_request_info *info,
68 union iwreq_data *wrqu, char *extra)
71 struct r8192_priv *priv = ieee80211_priv(dev);
75 ret = ieee80211_wx_set_rate(priv->ieee80211, info, wrqu, extra);
83 static int r8192_wx_set_rts(struct net_device *dev,
84 struct iw_request_info *info,
85 union iwreq_data *wrqu, char *extra)
88 struct r8192_priv *priv = ieee80211_priv(dev);
92 ret = ieee80211_wx_set_rts(priv->ieee80211, info, wrqu, extra);
99 static int r8192_wx_get_rts(struct net_device *dev,
100 struct iw_request_info *info,
101 union iwreq_data *wrqu, char *extra)
103 struct r8192_priv *priv = ieee80211_priv(dev);
105 return ieee80211_wx_get_rts(priv->ieee80211, info, wrqu, extra);
108 static int r8192_wx_set_power(struct net_device *dev,
109 struct iw_request_info *info,
110 union iwreq_data *wrqu, char *extra)
113 struct r8192_priv *priv = ieee80211_priv(dev);
117 ret = ieee80211_wx_set_power(priv->ieee80211, info, wrqu, extra);
124 static int r8192_wx_get_power(struct net_device *dev,
125 struct iw_request_info *info,
126 union iwreq_data *wrqu, char *extra)
128 struct r8192_priv *priv = ieee80211_priv(dev);
130 return ieee80211_wx_get_power(priv->ieee80211, info, wrqu, extra);
133 static int r8192_wx_force_reset(struct net_device *dev,
134 struct iw_request_info *info,
135 union iwreq_data *wrqu, char *extra)
137 struct r8192_priv *priv = ieee80211_priv(dev);
141 printk("%s(): force reset ! extra is %d\n", __func__, *extra);
142 priv->force_reset = *extra;
149 static int r8192_wx_set_rawtx(struct net_device *dev,
150 struct iw_request_info *info,
151 union iwreq_data *wrqu, char *extra)
153 struct r8192_priv *priv = ieee80211_priv(dev);
158 ret = ieee80211_wx_set_rawtx(priv->ieee80211, info, wrqu, extra);
166 static int r8192_wx_set_crcmon(struct net_device *dev,
167 struct iw_request_info *info,
168 union iwreq_data *wrqu, char *extra)
170 struct r8192_priv *priv = ieee80211_priv(dev);
171 int *parms = (int *)extra;
172 int enable = (parms[0] > 0);
173 short prev = priv->crcmon;
182 DMESG("bad CRC in monitor mode are %s",
183 priv->crcmon ? "accepted" : "rejected");
185 if (prev != priv->crcmon && priv->up) {
186 /* rtl8180_down(dev); */
187 /* rtl8180_up(dev); */
195 static int r8192_wx_set_mode(struct net_device *dev, struct iw_request_info *a,
196 union iwreq_data *wrqu, char *b)
198 struct r8192_priv *priv = ieee80211_priv(dev);
203 ret = ieee80211_wx_set_mode(priv->ieee80211, a, wrqu, b);
205 rtl8192_set_rxconf(dev);
211 struct iw_range_with_scan_capa {
212 /* Informative stuff (to choose between different interface) */
213 __u32 throughput; /* To give an idea... */
214 /* In theory this value should be the maximum benchmarked
215 * TCP/IP throughput, because with most of these devices the
216 * bit rate is meaningless (overhead an co) to estimate how
217 * fast the connection will go and pick the fastest one.
218 * I suggest people to play with Netperf or any benchmark...
221 /* NWID (or domain id) */
222 __u32 min_nwid; /* Minimal NWID we are able to set */
223 __u32 max_nwid; /* Maximal NWID we are able to set */
225 /* Old Frequency (backward compat - moved lower ) */
226 __u16 old_num_channels;
227 __u8 old_num_frequency;
229 /* Scan capabilities */
232 static int rtl8180_wx_get_range(struct net_device *dev,
233 struct iw_request_info *info,
234 union iwreq_data *wrqu, char *extra)
236 struct iw_range *range = (struct iw_range *)extra;
237 struct iw_range_with_scan_capa *tmp = (struct iw_range_with_scan_capa *)range;
238 struct r8192_priv *priv = ieee80211_priv(dev);
242 wrqu->data.length = sizeof(*range);
243 memset(range, 0, sizeof(*range));
245 /* Let's try to keep this struct in the same order as in
246 * linux/include/wireless.h
249 /* TODO: See what values we can set, and remove the ones we can't
250 * set, or fill them with some default data.
253 /* ~5 Mb/s real (802.11b) */
254 range->throughput = 5 * 1000 * 1000;
256 /* TODO: Not used in 802.11b? */
257 /* range->min_nwid; */ /* Minimal NWID we are able to set */
258 /* TODO: Not used in 802.11b? */
259 /* range->max_nwid; */ /* Maximal NWID we are able to set */
261 /* Old Frequency (backward compat - moved lower ) */
262 /* range->old_num_channels; */
263 /* range->old_num_frequency; */
264 /* range->old_freq[6]; */ /* Filler to keep "version" at the same offset */
265 if (priv->rf_set_sens != NULL)
266 range->sensitivity = priv->max_sens; /* signal level threshold range */
268 range->max_qual.qual = 100;
269 /* TODO: Find real max RSSI and stick here */
270 range->max_qual.level = 0;
271 range->max_qual.noise = -98;
272 range->max_qual.updated = 7; /* Updated all three */
274 range->avg_qual.qual = 92; /* > 8% missed beacons is 'bad' */
275 /* TODO: Find real 'good' to 'bad' threshold value for RSSI */
276 range->avg_qual.level = 20 + -98;
277 range->avg_qual.noise = 0;
278 range->avg_qual.updated = 7; /* Updated all three */
280 range->num_bitrates = RATE_COUNT;
282 for (i = 0; i < RATE_COUNT && i < IW_MAX_BITRATES; i++)
283 range->bitrate[i] = rtl8180_rates[i];
285 range->min_frag = MIN_FRAG_THRESHOLD;
286 range->max_frag = MAX_FRAG_THRESHOLD;
289 range->max_pmp = 5000000;
291 range->max_pmt = 65535*1000;
292 range->pmp_flags = IW_POWER_PERIOD;
293 range->pmt_flags = IW_POWER_TIMEOUT;
294 range->pm_capa = IW_POWER_PERIOD | IW_POWER_TIMEOUT | IW_POWER_ALL_R;
296 range->we_version_compiled = WIRELESS_EXT;
297 range->we_version_source = 16;
299 /* range->retry_capa; */ /* What retry options are supported */
300 /* range->retry_flags; */ /* How to decode max/min retry limit */
301 /* range->r_time_flags; */ /* How to decode max/min retry life */
302 /* range->min_retry; */ /* Minimal number of retries */
303 /* range->max_retry; */ /* Maximal number of retries */
304 /* range->min_r_time; */ /* Minimal retry lifetime */
305 /* range->max_r_time; */ /* Maximal retry lifetime */
308 for (i = 0, val = 0; i < 14; i++) {
310 /* Include only legal frequencies for some countries */
311 if ((GET_DOT11D_INFO(priv->ieee80211)->channel_map)[i+1]) {
312 range->freq[val].i = i + 1;
313 range->freq[val].m = ieee80211_wlan_frequencies[i] * 100000;
314 range->freq[val].e = 1;
317 /* FIXME: do we need to set anything for channels */
321 if (val == IW_MAX_FREQUENCIES)
324 range->num_frequency = val;
325 range->num_channels = val;
326 range->enc_capa = IW_ENC_CAPA_WPA|IW_ENC_CAPA_WPA2|
327 IW_ENC_CAPA_CIPHER_TKIP|IW_ENC_CAPA_CIPHER_CCMP;
328 tmp->scan_capa = 0x01;
333 static int r8192_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
334 union iwreq_data *wrqu, char *b)
336 struct r8192_priv *priv = ieee80211_priv(dev);
337 struct ieee80211_device *ieee = priv->ieee80211;
343 if (priv->ieee80211->LinkDetectInfo.bBusyTraffic == true)
345 if (wrqu->data.flags & IW_SCAN_THIS_ESSID) {
346 struct iw_scan_req *req = (struct iw_scan_req *)b;
347 if (req->essid_len) {
348 ieee->current_network.ssid_len = req->essid_len;
349 memcpy(ieee->current_network.ssid, req->essid, req->essid_len);
354 if (priv->ieee80211->state != IEEE80211_LINKED) {
355 priv->ieee80211->scanning = 0;
356 ieee80211_softmac_scan_syncro(priv->ieee80211);
359 ret = ieee80211_wx_set_scan(priv->ieee80211, a, wrqu, b);
366 static int r8192_wx_get_scan(struct net_device *dev, struct iw_request_info *a,
367 union iwreq_data *wrqu, char *b)
371 struct r8192_priv *priv = ieee80211_priv(dev);
378 ret = ieee80211_wx_get_scan(priv->ieee80211, a, wrqu, b);
385 static int r8192_wx_set_essid(struct net_device *dev,
386 struct iw_request_info *a,
387 union iwreq_data *wrqu, char *b)
389 struct r8192_priv *priv = ieee80211_priv(dev);
394 ret = ieee80211_wx_set_essid(priv->ieee80211, a, wrqu, b);
404 static int r8192_wx_get_essid(struct net_device *dev,
405 struct iw_request_info *a,
406 union iwreq_data *wrqu, char *b)
409 struct r8192_priv *priv = ieee80211_priv(dev);
413 ret = ieee80211_wx_get_essid(priv->ieee80211, a, wrqu, b);
421 static int r8192_wx_set_freq(struct net_device *dev, struct iw_request_info *a,
422 union iwreq_data *wrqu, char *b)
425 struct r8192_priv *priv = ieee80211_priv(dev);
429 ret = ieee80211_wx_set_freq(priv->ieee80211, a, wrqu, b);
435 static int r8192_wx_get_name(struct net_device *dev,
436 struct iw_request_info *info,
437 union iwreq_data *wrqu, char *extra)
439 struct r8192_priv *priv = ieee80211_priv(dev);
441 return ieee80211_wx_get_name(priv->ieee80211, info, wrqu, extra);
445 static int r8192_wx_set_frag(struct net_device *dev,
446 struct iw_request_info *info,
447 union iwreq_data *wrqu, char *extra)
449 struct r8192_priv *priv = ieee80211_priv(dev);
451 if (wrqu->frag.disabled)
452 priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
454 if (wrqu->frag.value < MIN_FRAG_THRESHOLD ||
455 wrqu->frag.value > MAX_FRAG_THRESHOLD)
458 priv->ieee80211->fts = wrqu->frag.value & ~0x1;
465 static int r8192_wx_get_frag(struct net_device *dev,
466 struct iw_request_info *info,
467 union iwreq_data *wrqu, char *extra)
469 struct r8192_priv *priv = ieee80211_priv(dev);
471 wrqu->frag.value = priv->ieee80211->fts;
472 wrqu->frag.fixed = 0; /* no auto select */
473 wrqu->frag.disabled = (wrqu->frag.value == DEFAULT_FRAG_THRESHOLD);
479 static int r8192_wx_set_wap(struct net_device *dev,
480 struct iw_request_info *info,
481 union iwreq_data *awrq,
486 struct r8192_priv *priv = ieee80211_priv(dev);
487 /* struct sockaddr *temp = (struct sockaddr *)awrq; */
490 ret = ieee80211_wx_set_wap(priv->ieee80211, info, awrq, extra);
499 static int r8192_wx_get_wap(struct net_device *dev,
500 struct iw_request_info *info,
501 union iwreq_data *wrqu, char *extra)
503 struct r8192_priv *priv = ieee80211_priv(dev);
505 return ieee80211_wx_get_wap(priv->ieee80211, info, wrqu, extra);
509 static int r8192_wx_get_enc(struct net_device *dev,
510 struct iw_request_info *info,
511 union iwreq_data *wrqu, char *key)
513 struct r8192_priv *priv = ieee80211_priv(dev);
515 return ieee80211_wx_get_encode(priv->ieee80211, info, wrqu, key);
518 static int r8192_wx_set_enc(struct net_device *dev,
519 struct iw_request_info *info,
520 union iwreq_data *wrqu, char *key)
522 struct r8192_priv *priv = ieee80211_priv(dev);
523 struct ieee80211_device *ieee = priv->ieee80211;
525 u32 hwkey[4] = {0, 0, 0, 0};
528 u8 zero_addr[4][6] = { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
529 {0x00, 0x00, 0x00, 0x00, 0x00, 0x01},
530 {0x00, 0x00, 0x00, 0x00, 0x00, 0x02},
531 {0x00, 0x00, 0x00, 0x00, 0x00, 0x03} };
539 RT_TRACE(COMP_SEC, "Setting SW wep key");
540 ret = ieee80211_wx_set_encode(priv->ieee80211, info, wrqu, key);
546 /* sometimes, the length is zero while we do not type key value */
547 if (wrqu->encoding.length != 0) {
549 for (i = 0; i < 4; i++) {
550 hwkey[i] |= key[4*i+0]&mask;
551 if (i == 1 && (4*i+1) == wrqu->encoding.length)
553 if (i == 3 && (4*i+1) == wrqu->encoding.length)
555 hwkey[i] |= (key[4*i+1]&mask)<<8;
556 hwkey[i] |= (key[4*i+2]&mask)<<16;
557 hwkey[i] |= (key[4*i+3]&mask)<<24;
560 #define CONF_WEP40 0x4
561 #define CONF_WEP104 0x14
563 switch (wrqu->encoding.flags & IW_ENCODE_INDEX) {
565 key_idx = ieee->tx_keyidx;
583 if (wrqu->encoding.length == 0x5) {
584 ieee->pairwise_key_type = KEY_TYPE_WEP40;
585 EnableHWSecurityConfig8192(dev);
588 key_idx, /* EntryNo */
589 key_idx, /* KeyIndex */
590 KEY_TYPE_WEP40, /* KeyType */
593 hwkey); /* KeyContent */
597 else if (wrqu->encoding.length == 0xd) {
598 ieee->pairwise_key_type = KEY_TYPE_WEP104;
599 EnableHWSecurityConfig8192(dev);
602 key_idx, /* EntryNo */
603 key_idx, /* KeyIndex */
604 KEY_TYPE_WEP104, /* KeyType */
607 hwkey); /* KeyContent */
610 printk("wrong type in WEP, not WEP40 and WEP104\n");
619 static int r8192_wx_set_scan_type(struct net_device *dev, struct iw_request_info *aa,
620 union iwreq_data *wrqu, char *p)
623 struct r8192_priv *priv = ieee80211_priv(dev);
624 int *parms = (int *)p;
627 priv->ieee80211->active_scan = mode;
634 static int r8192_wx_set_retry(struct net_device *dev,
635 struct iw_request_info *info,
636 union iwreq_data *wrqu, char *extra)
638 struct r8192_priv *priv = ieee80211_priv(dev);
643 if (wrqu->retry.flags & IW_RETRY_LIFETIME ||
644 wrqu->retry.disabled){
648 if (!(wrqu->retry.flags & IW_RETRY_LIMIT)) {
653 if (wrqu->retry.value > R8180_MAX_RETRY) {
657 if (wrqu->retry.flags & IW_RETRY_MAX) {
658 priv->retry_rts = wrqu->retry.value;
659 DMESG("Setting retry for RTS/CTS data to %d", wrqu->retry.value);
662 priv->retry_data = wrqu->retry.value;
663 DMESG("Setting retry for non RTS/CTS data to %d", wrqu->retry.value);
667 * We might try to write directly the TX config register
668 * or to restart just the (R)TX process.
669 * I'm unsure if whole reset is really needed
679 static int r8192_wx_get_retry(struct net_device *dev,
680 struct iw_request_info *info,
681 union iwreq_data *wrqu, char *extra)
683 struct r8192_priv *priv = ieee80211_priv(dev);
686 wrqu->retry.disabled = 0; /* can't be disabled */
688 if ((wrqu->retry.flags & IW_RETRY_TYPE) ==
692 if (wrqu->retry.flags & IW_RETRY_MAX) {
693 wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_MAX;
694 wrqu->retry.value = priv->retry_rts;
696 wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_MIN;
697 wrqu->retry.value = priv->retry_data;
704 static int r8192_wx_get_sens(struct net_device *dev,
705 struct iw_request_info *info,
706 union iwreq_data *wrqu, char *extra)
708 struct r8192_priv *priv = ieee80211_priv(dev);
710 if (priv->rf_set_sens == NULL)
711 return -1; /* we have not this support for this radio */
712 wrqu->sens.value = priv->sens;
717 static int r8192_wx_set_sens(struct net_device *dev,
718 struct iw_request_info *info,
719 union iwreq_data *wrqu, char *extra)
722 struct r8192_priv *priv = ieee80211_priv(dev);
726 if (priv->rf_set_sens == NULL) {
727 err = -1; /* we have not this support for this radio */
730 if (priv->rf_set_sens(dev, wrqu->sens.value) == 0)
731 priv->sens = wrqu->sens.value;
741 /* hw security need to reorganized. */
742 static int r8192_wx_set_enc_ext(struct net_device *dev,
743 struct iw_request_info *info,
744 union iwreq_data *wrqu, char *extra)
747 struct r8192_priv *priv = ieee80211_priv(dev);
748 struct ieee80211_device *ieee = priv->ieee80211;
752 ret = ieee80211_wx_set_encode_ext(priv->ieee80211, info, wrqu, extra);
755 u8 broadcast_addr[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
758 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
759 struct iw_point *encoding = &wrqu->encoding;
760 u8 idx = 0, alg = 0, group = 0;
761 if ((encoding->flags & IW_ENCODE_DISABLED) || ext->alg == IW_ENCODE_ALG_NONE)
762 /* none is not allowed to use hwsec WB 2008.07.01 */
765 /* as IW_ENCODE_ALG_CCMP is defined to be 3 and KEY_TYPE_CCMP is defined to 4; */
766 alg = (ext->alg == IW_ENCODE_ALG_CCMP)?KEY_TYPE_CCMP:ext->alg;
767 idx = encoding->flags & IW_ENCODE_INDEX;
770 group = ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY;
772 if ((!group) || (IW_MODE_ADHOC == ieee->iw_mode) || (alg == KEY_TYPE_WEP40)) {
773 if ((ext->key_len == 13) && (alg == KEY_TYPE_WEP40))
774 alg = KEY_TYPE_WEP104;
775 ieee->pairwise_key_type = alg;
776 EnableHWSecurityConfig8192(dev);
778 memcpy((u8 *)key, ext->key, 16); /* we only get 16 bytes key.why? WB 2008.7.1 */
780 if ((alg & KEY_TYPE_WEP40) && (ieee->auth_mode != 2)) {
788 key); /* KeyContent */
790 ieee->group_key_type = alg;
795 broadcast_addr, /* MacAddr */
797 key); /* KeyContent */
798 } else { /* pairwise key */
803 (u8 *)ieee->ap_mac_addr,/* MacAddr */
805 key); /* KeyContent */
817 static int r8192_wx_set_auth(struct net_device *dev,
818 struct iw_request_info *info,
819 union iwreq_data *data, char *extra)
822 struct r8192_priv *priv = ieee80211_priv(dev);
825 ret = ieee80211_wx_set_auth(priv->ieee80211, info, &(data->param), extra);
830 static int r8192_wx_set_mlme(struct net_device *dev,
831 struct iw_request_info *info,
832 union iwreq_data *wrqu, char *extra)
836 struct r8192_priv *priv = ieee80211_priv(dev);
839 ret = ieee80211_wx_set_mlme(priv->ieee80211, info, wrqu, extra);
845 static int r8192_wx_set_gen_ie(struct net_device *dev,
846 struct iw_request_info *info,
847 union iwreq_data *data, char *extra)
850 struct r8192_priv *priv = ieee80211_priv(dev);
853 ret = ieee80211_wx_set_gen_ie(priv->ieee80211, extra, data->data.length);
860 static int dummy(struct net_device *dev, struct iw_request_info *a,
861 union iwreq_data *wrqu, char *b)
867 static iw_handler r8192_wx_handlers[] = {
868 NULL, /* SIOCSIWCOMMIT */
869 r8192_wx_get_name, /* SIOCGIWNAME */
870 dummy, /* SIOCSIWNWID */
871 dummy, /* SIOCGIWNWID */
872 r8192_wx_set_freq, /* SIOCSIWFREQ */
873 r8192_wx_get_freq, /* SIOCGIWFREQ */
874 r8192_wx_set_mode, /* SIOCSIWMODE */
875 r8192_wx_get_mode, /* SIOCGIWMODE */
876 r8192_wx_set_sens, /* SIOCSIWSENS */
877 r8192_wx_get_sens, /* SIOCGIWSENS */
878 NULL, /* SIOCSIWRANGE */
879 rtl8180_wx_get_range, /* SIOCGIWRANGE */
880 NULL, /* SIOCSIWPRIV */
881 NULL, /* SIOCGIWPRIV */
882 NULL, /* SIOCSIWSTATS */
883 NULL, /* SIOCGIWSTATS */
884 dummy, /* SIOCSIWSPY */
885 dummy, /* SIOCGIWSPY */
886 NULL, /* SIOCGIWTHRSPY */
887 NULL, /* SIOCWIWTHRSPY */
888 r8192_wx_set_wap, /* SIOCSIWAP */
889 r8192_wx_get_wap, /* SIOCGIWAP */
890 r8192_wx_set_mlme, /* MLME-- */
891 dummy, /* SIOCGIWAPLIST -- deprecated */
892 r8192_wx_set_scan, /* SIOCSIWSCAN */
893 r8192_wx_get_scan, /* SIOCGIWSCAN */
894 r8192_wx_set_essid, /* SIOCSIWESSID */
895 r8192_wx_get_essid, /* SIOCGIWESSID */
896 dummy, /* SIOCSIWNICKN */
897 dummy, /* SIOCGIWNICKN */
898 NULL, /* -- hole -- */
899 NULL, /* -- hole -- */
900 r8192_wx_set_rate, /* SIOCSIWRATE */
901 r8192_wx_get_rate, /* SIOCGIWRATE */
902 r8192_wx_set_rts, /* SIOCSIWRTS */
903 r8192_wx_get_rts, /* SIOCGIWRTS */
904 r8192_wx_set_frag, /* SIOCSIWFRAG */
905 r8192_wx_get_frag, /* SIOCGIWFRAG */
906 dummy, /* SIOCSIWTXPOW */
907 dummy, /* SIOCGIWTXPOW */
908 r8192_wx_set_retry, /* SIOCSIWRETRY */
909 r8192_wx_get_retry, /* SIOCGIWRETRY */
910 r8192_wx_set_enc, /* SIOCSIWENCODE */
911 r8192_wx_get_enc, /* SIOCGIWENCODE */
912 r8192_wx_set_power, /* SIOCSIWPOWER */
913 r8192_wx_get_power, /* SIOCGIWPOWER */
916 r8192_wx_set_gen_ie, /* NULL, */ /* SIOCSIWGENIE */
917 NULL, /* SIOCSIWGENIE */
919 r8192_wx_set_auth,/* NULL, */ /* SIOCSIWAUTH */
920 NULL,/* r8192_wx_get_auth, */ /* NULL, */ /* SIOCSIWAUTH */
921 r8192_wx_set_enc_ext, /* SIOCSIWENCODEEXT */
922 NULL,/* r8192_wx_get_enc_ext, *//* NULL, */ /* SIOCSIWENCODEEXT */
923 NULL, /* SIOCSIWPMKSA */
929 static const struct iw_priv_args r8192_private_args[] = {
932 SIOCIWFIRSTPRIV + 0x0,
933 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc"
937 SIOCIWFIRSTPRIV + 0x1,
938 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan"
942 SIOCIWFIRSTPRIV + 0x2,
943 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rawtx"
946 SIOCIWFIRSTPRIV + 0x3,
947 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "forcereset"
954 static iw_handler r8192_private_handler[] = {
956 r8192_wx_set_scan_type,
958 r8192_wx_force_reset,
961 struct iw_statistics *r8192_get_wireless_stats(struct net_device *dev)
963 struct r8192_priv *priv = ieee80211_priv(dev);
964 struct ieee80211_device *ieee = priv->ieee80211;
965 struct iw_statistics *wstats = &priv->wstats;
970 if (ieee->state < IEEE80211_LINKED) {
971 wstats->qual.qual = 0;
972 wstats->qual.level = 0;
973 wstats->qual.noise = 0;
974 wstats->qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
978 tmp_level = (&ieee->current_network)->stats.rssi;
979 tmp_qual = (&ieee->current_network)->stats.signal;
980 tmp_noise = (&ieee->current_network)->stats.noise;
982 wstats->qual.level = tmp_level;
983 wstats->qual.qual = tmp_qual;
984 wstats->qual.noise = tmp_noise;
985 wstats->qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
990 struct iw_handler_def r8192_wx_handlers_def = {
991 .standard = r8192_wx_handlers,
992 .num_standard = ARRAY_SIZE(r8192_wx_handlers),
993 .private = r8192_private_handler,
994 .num_private = ARRAY_SIZE(r8192_private_handler),
995 .num_private_args = sizeof(r8192_private_args) / sizeof(struct iw_priv_args),
996 .get_wireless_stats = r8192_get_wireless_stats,
997 .private_args = (struct iw_priv_args *)r8192_private_args,