24 #include "ieee80211/dot11d.h"
27 6000000, 9000000, 12000000, 18000000, 24000000, 36000000, 48000000, 54000000};
29 #define RATE_COUNT ARRAY_SIZE(rtl8180_rates)
32 {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 36, 40, 44, 48, 52, 56, 60, 64}, 19},
33 {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, 11},
34 {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 36, 40, 44, 48, 52, 56, 60, 64}, 21},
35 {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 36, 40, 44, 48, 52, 56, 60, 64}, 21},
36 {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 36, 40, 44, 48, 52, 56, 60, 64}, 21},
37 {{14, 36, 40, 44, 48, 52, 56, 60, 64}, 9},
38 {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 36, 40, 44, 48, 52, 56, 60, 64}, 22},
39 {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 36, 40, 44, 48, 52, 56, 60, 64}, 21},
40 {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 34, 38, 42, 46}, 17},
41 {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}, 14}
66 priv->
key0[0] = tkey[0];
67 priv->
key0[1] = tkey[1];
68 priv->
key0[2] = tkey[2];
69 priv->
key0[3] = tkey[3] & 0xff;
70 DMESG(
"Setting wep key to %x %x %x %x",
71 tkey[0], tkey[1], tkey[2], tkey[3]);
81 int *
parms = (
int *)b;
90 DMESG(
"setting beacon interval to %x", bi);
92 priv->
ieee80211->current_network.beacon_interval =
bi;
104 struct r8180_priv *priv = ieee80211_priv(dev);
110 static int r8180_wx_get_rate(
struct net_device *dev,
114 struct r8180_priv *priv = ieee80211_priv(dev);
120 static int r8180_wx_set_rate(
struct net_device *dev,
125 struct r8180_priv *priv = ieee80211_priv(dev);
141 static int r8180_wx_set_crcmon(
struct net_device *dev,
145 struct r8180_priv *priv = ieee80211_priv(dev);
146 int *parms = (
int *)extra;
147 int enable = (parms[0] > 0);
161 DMESG(
"bad CRC in monitor mode are %s",
162 priv->
crcmon ?
"accepted" :
"rejected");
164 if (prev != priv->
crcmon && priv->
up) {
178 struct r8180_priv *priv = ieee80211_priv(dev);
223 static int rtl8180_wx_get_range(
struct net_device *dev,
228 struct r8180_priv *priv = ieee80211_priv(dev);
232 wrqu->
data.length =
sizeof(*range);
233 memset(range, 0,
sizeof(*range));
285 for (i = 0, val = 0; i < 14; i++) {
313 struct r8180_priv *priv = ieee80211_priv(dev);
341 printk(
"Now traffic is busy, please try later!\n");
360 struct r8180_priv *priv = ieee80211_priv(dev);
373 static int r8180_wx_set_essid(
struct net_device *dev,
377 struct r8180_priv *priv = ieee80211_priv(dev);
395 static int r8180_wx_get_essid(
struct net_device *dev,
400 struct r8180_priv *priv = ieee80211_priv(dev);
416 struct r8180_priv *priv = ieee80211_priv(dev);
431 static int r8180_wx_get_name(
struct net_device *dev,
435 struct r8180_priv *priv = ieee80211_priv(dev);
439 static int r8180_wx_set_frag(
struct net_device *dev,
443 struct r8180_priv *priv = ieee80211_priv(dev);
448 if (wrqu->
frag.disabled)
462 static int r8180_wx_get_frag(
struct net_device *dev,
466 struct r8180_priv *priv = ieee80211_priv(dev);
469 wrqu->
frag.fixed = 0;
476 static int r8180_wx_set_wap(
struct net_device *dev,
482 struct r8180_priv *priv = ieee80211_priv(dev);
497 static int r8180_wx_get_wap(
struct net_device *dev,
501 struct r8180_priv *priv = ieee80211_priv(dev);
507 static int r8180_wx_set_enc(
struct net_device *dev,
511 struct r8180_priv *priv = ieee80211_priv(dev);
522 DMESG(
"Setting SW wep key");
531 static int r8180_wx_get_enc(
struct net_device *dev,
535 struct r8180_priv *priv = ieee80211_priv(dev);
544 struct r8180_priv *priv = ieee80211_priv(dev);
545 int *parms = (
int*)p;
556 static int r8180_wx_set_retry(
struct net_device *dev,
560 struct r8180_priv *priv = ieee80211_priv(dev);
569 wrqu->
retry.disabled) {
584 DMESG(
"Setting retry for RTS/CTS data to %d", wrqu->
retry.value);
588 DMESG(
"Setting retry for non RTS/CTS data to %d", wrqu->
retry.value);
604 static int r8180_wx_get_retry(
struct net_device *dev,
608 struct r8180_priv *priv = ieee80211_priv(dev);
611 wrqu->
retry.disabled = 0;
628 static int r8180_wx_get_sens(
struct net_device *dev,
632 struct r8180_priv *priv = ieee80211_priv(dev);
640 static int r8180_wx_set_sens(
struct net_device *dev,
645 struct r8180_priv *priv = ieee80211_priv(dev);
669 static int r8180_wx_set_rawtx(
struct net_device *dev,
673 struct r8180_priv *priv = ieee80211_priv(dev);
689 static int r8180_wx_get_power(
struct net_device *dev,
694 struct r8180_priv *priv = ieee80211_priv(dev);
705 static int r8180_wx_set_power(
struct net_device *dev,
710 struct r8180_priv *priv = ieee80211_priv(dev);
717 printk(
"=>>>>>>>>>>=============================>set power:%d, %d!\n", wrqu->
power.disabled, wrqu->
power.flags);
718 if (wrqu->
power.disabled == 0) {
721 wrqu->
power.value = 1000;
731 static int r8180_wx_set_rts(
struct net_device *dev,
735 struct r8180_priv *priv = ieee80211_priv(dev);
741 if (wrqu->
rts.disabled)
748 priv->
rts = wrqu->
rts.value;
753 static int r8180_wx_get_rts(
struct net_device *dev,
757 struct r8180_priv *priv = ieee80211_priv(dev);
761 wrqu->
rts.value = priv->
rts;
763 wrqu->
rts.disabled = (wrqu->
rts.value == 0);
773 static int r8180_wx_get_iwmode(
struct net_device *dev,
777 struct r8180_priv *priv = ieee80211_priv(dev);
799 static int r8180_wx_set_iwmode(
struct net_device *dev,
803 struct r8180_priv *priv = ieee80211_priv(dev);
805 int *
param = (
int *)extra;
819 }
else if (*param == 2) {
823 }
else if (*param == 3) {
844 static int r8180_wx_get_preamble(
struct net_device *dev,
848 struct r8180_priv *priv = ieee80211_priv(dev);
861 static int r8180_wx_set_preamble(
struct net_device *dev,
865 struct r8180_priv *priv = ieee80211_priv(dev);
873 if (*extra < 0 || *extra > 2)
884 static int r8180_wx_get_siglevel(
struct net_device *dev,
888 struct r8180_priv *priv = ieee80211_priv(dev);
895 *((
int *)extra) = priv->
wstats.qual.level;
903 static int r8180_wx_get_sigqual(
struct net_device *dev,
907 struct r8180_priv *priv = ieee80211_priv(dev);
914 *((
int *)extra) = priv->
wstats.qual.qual;
922 static int r8180_wx_reset_stats(
struct net_device *dev,
926 struct r8180_priv *priv = ieee80211_priv(dev);
929 priv->
stats.txrdu = 0;
930 priv->
stats.rxrdu = 0;
931 priv->
stats.rxnolast = 0;
932 priv->
stats.rxnodata = 0;
933 priv->
stats.rxnopointer = 0;
934 priv->
stats.txnperr = 0;
935 priv->
stats.txresumed = 0;
936 priv->
stats.rxerr = 0;
937 priv->
stats.rxoverflow = 0;
938 priv->
stats.rxint = 0;
940 priv->
stats.txnpokint = 0;
941 priv->
stats.txhpokint = 0;
942 priv->
stats.txhperr = 0;
943 priv->
stats.ints = 0;
944 priv->
stats.shints = 0;
945 priv->
stats.txoverflow = 0;
946 priv->
stats.rxdmafail = 0;
947 priv->
stats.txbeacon = 0;
948 priv->
stats.txbeaconerr = 0;
949 priv->
stats.txlpokint = 0;
950 priv->
stats.txlperr = 0;
951 priv->
stats.txretry = 0;
952 priv->
stats.rxcrcerrmin = 0 ;
953 priv->
stats.rxcrcerrmid = 0;
954 priv->
stats.rxcrcerrmax = 0;
955 priv->
stats.rxicverr = 0;
962 static int r8180_wx_radio_on(
struct net_device *dev,
966 struct r8180_priv *priv = ieee80211_priv(dev);
981 static int r8180_wx_radio_off(
struct net_device *dev,
985 struct r8180_priv *priv = ieee80211_priv(dev);
999 static int r8180_wx_get_channelplan(
struct net_device *dev,
1003 struct r8180_priv *priv = ieee80211_priv(dev);
1016 static int r8180_wx_set_channelplan(
struct net_device *dev,
1020 struct r8180_priv *priv = ieee80211_priv(dev);
1021 int *
val = (
int *)extra;
1023 printk(
"-----in fun %s\n", __func__);
1030 if (DefaultChannelPlan[*val].
Len != 0) {
1037 for (i = 1; i <= DefaultChannelPlan[*
val].
Len; i++)
1046 static int r8180_wx_get_version(
struct net_device *dev,
1050 struct r8180_priv *priv = ieee80211_priv(dev);
1054 strcpy(extra,
"1020.0808");
1062 static int r8180_wx_set_forcerate(
struct net_device *dev,
1066 struct r8180_priv *priv = ieee80211_priv(dev);
1071 printk(
"==============>%s(): forcerate is %d\n", __func__, forcerate);
1072 if ((forcerate == 2) || (forcerate == 4) || (forcerate == 11) || (forcerate == 22) || (forcerate == 12) ||
1073 (forcerate == 18) || (forcerate == 24) || (forcerate == 36) || (forcerate == 48) || (forcerate == 72) ||
1074 (forcerate == 96) || (forcerate == 108))
1078 }
else if (forcerate == 0) {
1080 printk(
"OK! return rate adaptive\n");
1082 printk(
"ERR: wrong rate\n");
1087 static int r8180_wx_set_enc_ext(
struct net_device *dev,
1092 struct r8180_priv *priv = ieee80211_priv(dev);
1105 static int r8180_wx_set_auth(
struct net_device *dev,
1109 struct r8180_priv *priv = ieee80211_priv(dev);
1121 static int r8180_wx_set_mlme(
struct net_device *dev,
1126 struct r8180_priv *priv = ieee80211_priv(dev);
1140 static int r8180_wx_set_gen_ie(
struct net_device *dev,
1145 struct r8180_priv *priv = ieee80211_priv(dev);
1172 rtl8180_wx_get_range,
1209 r8180_wx_set_gen_ie,
1213 r8180_wx_set_enc_ext,
1220 static const struct iw_priv_args r8180_private_args[] = {
1324 static iw_handler r8180_private_handler[] = {
1325 r8180_wx_set_crcmon,
1327 r8180_wx_set_beaconinterval,
1330 r8180_wx_set_scan_type,
1334 r8180_wx_set_iwmode,
1335 r8180_wx_get_iwmode,
1336 r8180_wx_set_preamble,
1337 r8180_wx_get_preamble,
1339 r8180_wx_get_siglevel,
1341 r8180_wx_get_sigqual,
1342 r8180_wx_reset_stats,
1346 r8180_wx_set_channelplan,
1347 r8180_wx_get_channelplan,
1349 r8180_wx_get_version,
1350 r8180_wx_set_forcerate,
1375 struct r8180_priv *priv = ieee80211_priv(dev);
1383 wstats->
qual.qual = 0;
1384 wstats->
qual.level = 0;
1385 wstats->
qual.noise = 0;
1394 wstats->
qual.level = tmp_level;
1395 wstats->
qual.qual = tmp_qual;
1396 wstats->
qual.noise = tmp_noise;
1402 .standard = r8180_wx_handlers,
1403 .num_standard =
ARRAY_SIZE(r8180_wx_handlers),
1404 .private = r8180_private_handler,
1405 .num_private =
ARRAY_SIZE(r8180_private_handler),
1406 .num_private_args =
sizeof(r8180_private_args) /
sizeof(
struct iw_priv_args),
1407 .get_wireless_stats = r8180_get_wireless_stats,
1408 .private_args = (
struct iw_priv_args *)r8180_private_args,