|
Lines 87-115
struct iw_priv_args privtab[] = {
Link Here
|
| 87 |
0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "radio_on" }, |
87 |
0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "radio_on" }, |
| 88 |
{ SHOW_CFG_VALUE, |
88 |
{ SHOW_CFG_VALUE, |
| 89 |
IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "show" }, |
89 |
IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "show" }, |
| 90 |
#if !defined(RT2860) && !defined(RT30xx) |
|
|
| 91 |
{ SHOW_ADHOC_ENTRY_INFO, |
| 92 |
0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "adhocEntry" }, |
| 93 |
#endif |
| 94 |
/* --- sub-ioctls relations --- */ |
90 |
/* --- sub-ioctls relations --- */ |
| 95 |
|
91 |
|
| 96 |
#ifdef DBG |
|
|
| 97 |
{ RTPRIV_IOCTL_BBP, |
| 98 |
IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, |
| 99 |
"bbp"}, |
| 100 |
{ RTPRIV_IOCTL_MAC, |
| 101 |
IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | 1024, |
| 102 |
"mac"}, |
| 103 |
#ifdef RT30xx |
| 104 |
{ RTPRIV_IOCTL_RF, |
| 105 |
IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, |
| 106 |
"rf"}, |
| 107 |
#endif // RT30xx // |
| 108 |
{ RTPRIV_IOCTL_E2P, |
| 109 |
IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | 1024, |
| 110 |
"e2p"}, |
| 111 |
#endif /* DBG */ |
| 112 |
|
| 113 |
{ RTPRIV_IOCTL_STATISTICS, |
92 |
{ RTPRIV_IOCTL_STATISTICS, |
| 114 |
0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, |
93 |
0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, |
| 115 |
"stat"}, |
94 |
"stat"}, |
|
Lines 173-201
INT Set_Wpa_Support(
Link Here
|
| 173 |
IN PRTMP_ADAPTER pAd, |
152 |
IN PRTMP_ADAPTER pAd, |
| 174 |
IN PUCHAR arg); |
153 |
IN PUCHAR arg); |
| 175 |
|
154 |
|
| 176 |
#ifdef DBG |
|
|
| 177 |
#if !defined(RT2860) && !defined(RT30xx) |
| 178 |
VOID RTMPIoctlBBP( |
| 179 |
IN PRTMP_ADAPTER pAdapter, |
| 180 |
IN struct iwreq *wrq); |
| 181 |
#endif |
| 182 |
|
| 183 |
VOID RTMPIoctlMAC( |
| 184 |
IN PRTMP_ADAPTER pAdapter, |
| 185 |
IN struct iwreq *wrq); |
| 186 |
|
| 187 |
VOID RTMPIoctlE2PROM( |
| 188 |
IN PRTMP_ADAPTER pAdapter, |
| 189 |
IN struct iwreq *wrq); |
| 190 |
|
| 191 |
#ifdef RT30xx |
| 192 |
VOID RTMPIoctlRF( |
| 193 |
IN PRTMP_ADAPTER pAdapter, |
| 194 |
IN struct iwreq *wrq); |
| 195 |
#endif // RT30xx // |
| 196 |
#endif // DBG // |
| 197 |
|
| 198 |
|
| 199 |
NDIS_STATUS RTMPWPANoneAddKeyProc( |
155 |
NDIS_STATUS RTMPWPANoneAddKeyProc( |
| 200 |
IN PRTMP_ADAPTER pAd, |
156 |
IN PRTMP_ADAPTER pAd, |
| 201 |
IN PVOID pBuf); |
157 |
IN PVOID pBuf); |
|
Lines 216-227
INT Set_ShortRetryLimit_Proc(
Link Here
|
| 216 |
IN PRTMP_ADAPTER pAdapter, |
172 |
IN PRTMP_ADAPTER pAdapter, |
| 217 |
IN PUCHAR arg); |
173 |
IN PUCHAR arg); |
| 218 |
|
174 |
|
| 219 |
#if !defined(RT2860) && !defined(RT30xx) |
|
|
| 220 |
INT Show_Adhoc_MacTable_Proc( |
| 221 |
IN PRTMP_ADAPTER pAd, |
| 222 |
IN PCHAR extra); |
| 223 |
#endif |
| 224 |
|
| 225 |
static struct { |
175 |
static struct { |
| 226 |
CHAR *name; |
176 |
CHAR *name; |
| 227 |
INT (*set_proc)(PRTMP_ADAPTER pAdapter, PUCHAR arg); |
177 |
INT (*set_proc)(PRTMP_ADAPTER pAdapter, PUCHAR arg); |
|
Lines 279-291
static struct {
Link Here
|
| 279 |
{"ForceGF", Set_ForceGF_Proc}, |
229 |
{"ForceGF", Set_ForceGF_Proc}, |
| 280 |
{"LongRetry", Set_LongRetryLimit_Proc}, |
230 |
{"LongRetry", Set_LongRetryLimit_Proc}, |
| 281 |
{"ShortRetry", Set_ShortRetryLimit_Proc}, |
231 |
{"ShortRetry", Set_ShortRetryLimit_Proc}, |
| 282 |
//2008/09/11:KH add to support efuse<-- |
232 |
#ifdef RT2870 |
| 283 |
#ifdef RT30xx |
|
|
| 284 |
{"efuseFreeNumber", set_eFuseGetFreeBlockCount_Proc}, |
233 |
{"efuseFreeNumber", set_eFuseGetFreeBlockCount_Proc}, |
| 285 |
{"efuseDump", set_eFusedump_Proc}, |
234 |
{"efuseDump", set_eFusedump_Proc}, |
| 286 |
{"efuseLoadFromBin", set_eFuseLoadFromBin_Proc}, |
235 |
{"efuseLoadFromBin", set_eFuseLoadFromBin_Proc}, |
| 287 |
#endif // RT30xx // |
236 |
#endif |
| 288 |
//2008/09/11:KH add to support efuse--> |
|
|
| 289 |
{NULL,} |
237 |
{NULL,} |
| 290 |
}; |
238 |
}; |
| 291 |
|
239 |
|
|
Lines 531-542
rt_ioctl_giwname(struct net_device *dev,
Link Here
|
| 531 |
char *name, char *extra) |
479 |
char *name, char *extra) |
| 532 |
{ |
480 |
{ |
| 533 |
// PRTMP_ADAPTER pAdapter = dev->ml_priv; |
481 |
// PRTMP_ADAPTER pAdapter = dev->ml_priv; |
| 534 |
#ifdef RT2860 |
482 |
strncpy(name, RT28xx_CHIP_NAME " Wireless", IFNAMSIZ); |
| 535 |
strncpy(name, "RT2860 Wireless", IFNAMSIZ); |
|
|
| 536 |
#endif |
| 537 |
#ifdef RT2870 |
| 538 |
strncpy(name, "RT2870 Wireless", IFNAMSIZ); |
| 539 |
#endif // RT2870 // |
| 540 |
return 0; |
483 |
return 0; |
| 541 |
} |
484 |
} |
| 542 |
|
485 |
|
|
Lines 577-614
int rt_ioctl_giwfreq(struct net_device *dev,
Link Here
|
| 577 |
struct iw_request_info *info, |
520 |
struct iw_request_info *info, |
| 578 |
struct iw_freq *freq, char *extra) |
521 |
struct iw_freq *freq, char *extra) |
| 579 |
{ |
522 |
{ |
| 580 |
VIRTUAL_ADAPTER *pVirtualAd = NULL; |
523 |
PRTMP_ADAPTER pAdapter = dev->ml_priv; |
| 581 |
#ifndef RT30xx |
524 |
UCHAR ch = pAdapter->CommonCfg.Channel; |
| 582 |
PRTMP_ADAPTER pAdapter = NULL; |
|
|
| 583 |
#endif |
| 584 |
#ifdef RT30xx |
| 585 |
PRTMP_ADAPTER pAdapter; |
| 586 |
#endif |
| 587 |
UCHAR ch; |
| 588 |
ULONG m; |
525 |
ULONG m; |
| 589 |
|
526 |
|
| 590 |
if (dev->priv_flags == INT_MAIN) |
|
|
| 591 |
{ |
| 592 |
pAdapter = dev->ml_priv; |
| 593 |
} |
| 594 |
else |
| 595 |
{ |
| 596 |
pVirtualAd = dev->ml_priv; |
| 597 |
#ifndef RT30xx |
| 598 |
if (pVirtualAd && pVirtualAd->RtmpDev) |
| 599 |
#endif |
| 600 |
pAdapter = pVirtualAd->RtmpDev->ml_priv; |
| 601 |
} |
| 602 |
|
| 603 |
if (pAdapter == NULL) |
| 604 |
{ |
| 605 |
/* if 1st open fail, pAd will be free; |
| 606 |
So the net_dev->ml_priv will be NULL in 2rd open */ |
| 607 |
return -ENETDOWN; |
| 608 |
} |
| 609 |
|
| 610 |
ch = pAdapter->CommonCfg.Channel; |
| 611 |
|
| 612 |
DBGPRINT(RT_DEBUG_TRACE,("==>rt_ioctl_giwfreq %d\n", ch)); |
527 |
DBGPRINT(RT_DEBUG_TRACE,("==>rt_ioctl_giwfreq %d\n", ch)); |
| 613 |
|
528 |
|
| 614 |
MAP_CHANNEL_ID_TO_KHZ(ch, m); |
529 |
MAP_CHANNEL_ID_TO_KHZ(ch, m); |
|
Lines 656-686
int rt_ioctl_giwmode(struct net_device *dev,
Link Here
|
| 656 |
struct iw_request_info *info, |
571 |
struct iw_request_info *info, |
| 657 |
__u32 *mode, char *extra) |
572 |
__u32 *mode, char *extra) |
| 658 |
{ |
573 |
{ |
| 659 |
#ifndef RT30xx |
|
|
| 660 |
PRTMP_ADAPTER pAdapter = NULL; |
| 661 |
VIRTUAL_ADAPTER *pVirtualAd = NULL; |
| 662 |
|
| 663 |
if (dev->priv_flags == INT_MAIN) |
| 664 |
{ |
| 665 |
pAdapter = dev->ml_priv; |
| 666 |
} |
| 667 |
else |
| 668 |
{ |
| 669 |
pVirtualAd = dev->ml_priv; |
| 670 |
if (pVirtualAd && pVirtualAd->RtmpDev) |
| 671 |
pAdapter = pVirtualAd->RtmpDev->ml_priv; |
| 672 |
} |
| 673 |
|
| 674 |
if (pAdapter == NULL) |
| 675 |
{ |
| 676 |
/* if 1st open fail, pAd will be free; |
| 677 |
So the net_dev->ml_priv will be NULL in 2rd open */ |
| 678 |
return -ENETDOWN; |
| 679 |
} |
| 680 |
#endif |
| 681 |
#ifdef RT30xx |
| 682 |
PRTMP_ADAPTER pAdapter = dev->ml_priv; |
574 |
PRTMP_ADAPTER pAdapter = dev->ml_priv; |
| 683 |
#endif |
|
|
| 684 |
|
575 |
|
| 685 |
if (ADHOC_ON(pAdapter)) |
576 |
if (ADHOC_ON(pAdapter)) |
| 686 |
*mode = IW_MODE_ADHOC; |
577 |
*mode = IW_MODE_ADHOC; |
|
Lines 724-760
int rt_ioctl_giwrange(struct net_device *dev,
Link Here
|
| 724 |
struct iw_request_info *info, |
615 |
struct iw_request_info *info, |
| 725 |
struct iw_point *data, char *extra) |
616 |
struct iw_point *data, char *extra) |
| 726 |
{ |
617 |
{ |
| 727 |
#ifndef RT30xx |
|
|
| 728 |
PRTMP_ADAPTER pAdapter = NULL; |
| 729 |
VIRTUAL_ADAPTER *pVirtualAd = NULL; |
| 730 |
#endif |
| 731 |
#ifdef RT30xx |
| 732 |
PRTMP_ADAPTER pAdapter = dev->ml_priv; |
618 |
PRTMP_ADAPTER pAdapter = dev->ml_priv; |
| 733 |
#endif |
|
|
| 734 |
struct iw_range *range = (struct iw_range *) extra; |
619 |
struct iw_range *range = (struct iw_range *) extra; |
| 735 |
u16 val; |
620 |
u16 val; |
| 736 |
int i; |
621 |
int i; |
| 737 |
|
622 |
|
| 738 |
#ifndef RT30xx |
|
|
| 739 |
if (dev->priv_flags == INT_MAIN) |
| 740 |
{ |
| 741 |
pAdapter = dev->ml_priv; |
| 742 |
} |
| 743 |
else |
| 744 |
{ |
| 745 |
pVirtualAd = dev->ml_priv; |
| 746 |
if (pVirtualAd && pVirtualAd->RtmpDev) |
| 747 |
pAdapter = pVirtualAd->RtmpDev->ml_priv; |
| 748 |
} |
| 749 |
|
| 750 |
if (pAdapter == NULL) |
| 751 |
{ |
| 752 |
/* if 1st open fail, pAd will be free; |
| 753 |
So the net_dev->ml_priv will be NULL in 2rd open */ |
| 754 |
return -ENETDOWN; |
| 755 |
} |
| 756 |
#endif |
| 757 |
|
| 758 |
DBGPRINT(RT_DEBUG_TRACE ,("===>rt_ioctl_giwrange\n")); |
623 |
DBGPRINT(RT_DEBUG_TRACE ,("===>rt_ioctl_giwrange\n")); |
| 759 |
data->length = sizeof(struct iw_range); |
624 |
data->length = sizeof(struct iw_range); |
| 760 |
memset(range, 0, sizeof(struct iw_range)); |
625 |
memset(range, 0, sizeof(struct iw_range)); |
|
Lines 820-830
int rt_ioctl_giwrange(struct net_device *dev,
Link Here
|
| 820 |
range->min_frag = 256; |
685 |
range->min_frag = 256; |
| 821 |
range->max_frag = 2346; |
686 |
range->max_frag = 2346; |
| 822 |
|
687 |
|
| 823 |
#if WIRELESS_EXT > 17 |
|
|
| 824 |
/* IW_ENC_CAPA_* bit field */ |
688 |
/* IW_ENC_CAPA_* bit field */ |
| 825 |
range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | |
689 |
range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | |
| 826 |
IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; |
690 |
IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; |
| 827 |
#endif |
|
|
| 828 |
|
691 |
|
| 829 |
return 0; |
692 |
return 0; |
| 830 |
} |
693 |
} |
|
Lines 873-903
int rt_ioctl_giwap(struct net_device *dev,
Link Here
|
| 873 |
struct iw_request_info *info, |
736 |
struct iw_request_info *info, |
| 874 |
struct sockaddr *ap_addr, char *extra) |
737 |
struct sockaddr *ap_addr, char *extra) |
| 875 |
{ |
738 |
{ |
| 876 |
#ifndef RT30xx |
|
|
| 877 |
PRTMP_ADAPTER pAdapter = NULL; |
| 878 |
VIRTUAL_ADAPTER *pVirtualAd = NULL; |
| 879 |
|
| 880 |
if (dev->priv_flags == INT_MAIN) |
| 881 |
{ |
| 882 |
pAdapter = dev->ml_priv; |
| 883 |
} |
| 884 |
else |
| 885 |
{ |
| 886 |
pVirtualAd = dev->ml_priv; |
| 887 |
if (pVirtualAd && pVirtualAd->RtmpDev) |
| 888 |
pAdapter = pVirtualAd->RtmpDev->ml_priv; |
| 889 |
} |
| 890 |
|
| 891 |
if (pAdapter == NULL) |
| 892 |
{ |
| 893 |
/* if 1st open fail, pAd will be free; |
| 894 |
So the net_dev->ml_priv will be NULL in 2rd open */ |
| 895 |
return -ENETDOWN; |
| 896 |
} |
| 897 |
#endif |
| 898 |
#ifdef RT30xx |
| 899 |
PRTMP_ADAPTER pAdapter = dev->ml_priv; |
739 |
PRTMP_ADAPTER pAdapter = dev->ml_priv; |
| 900 |
#endif |
|
|
| 901 |
|
740 |
|
| 902 |
if (INFRA_ON(pAdapter) || ADHOC_ON(pAdapter)) |
741 |
if (INFRA_ON(pAdapter) || ADHOC_ON(pAdapter)) |
| 903 |
{ |
742 |
{ |
|
Lines 994-1000
int rt_ioctl_iwaplist(struct net_device *dev,
Link Here
|
| 994 |
return 0; |
833 |
return 0; |
| 995 |
} |
834 |
} |
| 996 |
|
835 |
|
| 997 |
#ifdef SIOCGIWSCAN |
|
|
| 998 |
int rt_ioctl_siwscan(struct net_device *dev, |
836 |
int rt_ioctl_siwscan(struct net_device *dev, |
| 999 |
struct iw_request_info *info, |
837 |
struct iw_request_info *info, |
| 1000 |
struct iw_point *data, char *extra) |
838 |
struct iw_point *data, char *extra) |
|
Lines 1091-1099
int rt_ioctl_giwscan(struct net_device *dev,
Link Here
|
| 1091 |
char *current_ev = extra, *previous_ev = extra; |
929 |
char *current_ev = extra, *previous_ev = extra; |
| 1092 |
char *end_buf; |
930 |
char *end_buf; |
| 1093 |
char *current_val, custom[MAX_CUSTOM_LEN] = {0}; |
931 |
char *current_val, custom[MAX_CUSTOM_LEN] = {0}; |
| 1094 |
#ifndef IWEVGENIE |
|
|
| 1095 |
char idx; |
| 1096 |
#endif // IWEVGENIE // |
| 1097 |
struct iw_event iwe; |
932 |
struct iw_event iwe; |
| 1098 |
|
933 |
|
| 1099 |
if (RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) |
934 |
if (RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) |
|
Lines 1115-1139
int rt_ioctl_giwscan(struct net_device *dev,
Link Here
|
| 1115 |
return 0; |
950 |
return 0; |
| 1116 |
} |
951 |
} |
| 1117 |
|
952 |
|
| 1118 |
#if WIRELESS_EXT >= 17 |
|
|
| 1119 |
if (data->length > 0) |
953 |
if (data->length > 0) |
| 1120 |
end_buf = extra + data->length; |
954 |
end_buf = extra + data->length; |
| 1121 |
else |
955 |
else |
| 1122 |
end_buf = extra + IW_SCAN_MAX_DATA; |
956 |
end_buf = extra + IW_SCAN_MAX_DATA; |
| 1123 |
#else |
|
|
| 1124 |
end_buf = extra + IW_SCAN_MAX_DATA; |
| 1125 |
#endif |
| 1126 |
|
957 |
|
| 1127 |
for (i = 0; i < pAdapter->ScanTab.BssNr; i++) |
958 |
for (i = 0; i < pAdapter->ScanTab.BssNr; i++) |
| 1128 |
{ |
959 |
{ |
| 1129 |
if (current_ev >= end_buf) |
960 |
if (current_ev >= end_buf) |
| 1130 |
{ |
961 |
return -E2BIG; |
| 1131 |
#if WIRELESS_EXT >= 17 |
|
|
| 1132 |
return -E2BIG; |
| 1133 |
#else |
| 1134 |
break; |
| 1135 |
#endif |
| 1136 |
} |
| 1137 |
|
962 |
|
| 1138 |
//MAC address |
963 |
//MAC address |
| 1139 |
//================================ |
964 |
//================================ |
|
Lines 1144-1156
int rt_ioctl_giwscan(struct net_device *dev,
Link Here
|
| 1144 |
|
969 |
|
| 1145 |
previous_ev = current_ev; |
970 |
previous_ev = current_ev; |
| 1146 |
current_ev = iwe_stream_add_event(info, current_ev,end_buf, &iwe, IW_EV_ADDR_LEN); |
971 |
current_ev = iwe_stream_add_event(info, current_ev,end_buf, &iwe, IW_EV_ADDR_LEN); |
| 1147 |
#ifdef RT30xx |
|
|
| 1148 |
if (current_ev == previous_ev) |
972 |
if (current_ev == previous_ev) |
| 1149 |
#if WIRELESS_EXT >= 17 |
973 |
return -E2BIG; |
| 1150 |
return -E2BIG; |
|
|
| 1151 |
#else |
| 1152 |
break; |
| 1153 |
#endif |
| 1154 |
|
974 |
|
| 1155 |
/* |
975 |
/* |
| 1156 |
Protocol: |
976 |
Protocol: |
|
Lines 1224-1236
int rt_ioctl_giwscan(struct net_device *dev,
Link Here
|
| 1224 |
|
1044 |
|
| 1225 |
previous_ev = current_ev; |
1045 |
previous_ev = current_ev; |
| 1226 |
current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_ADDR_LEN); |
1046 |
current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_ADDR_LEN); |
| 1227 |
#endif /* RT30xx */ |
|
|
| 1228 |
if (current_ev == previous_ev) |
1047 |
if (current_ev == previous_ev) |
| 1229 |
#if WIRELESS_EXT >= 17 |
1048 |
return -E2BIG; |
| 1230 |
return -E2BIG; |
|
|
| 1231 |
#else |
| 1232 |
break; |
| 1233 |
#endif |
| 1234 |
|
1049 |
|
| 1235 |
//ESSID |
1050 |
//ESSID |
| 1236 |
//================================ |
1051 |
//================================ |
|
Lines 1242-1252
int rt_ioctl_giwscan(struct net_device *dev,
Link Here
|
| 1242 |
previous_ev = current_ev; |
1057 |
previous_ev = current_ev; |
| 1243 |
current_ev = iwe_stream_add_point(info, current_ev,end_buf, &iwe, pAdapter->ScanTab.BssEntry[i].Ssid); |
1058 |
current_ev = iwe_stream_add_point(info, current_ev,end_buf, &iwe, pAdapter->ScanTab.BssEntry[i].Ssid); |
| 1244 |
if (current_ev == previous_ev) |
1059 |
if (current_ev == previous_ev) |
| 1245 |
#if WIRELESS_EXT >= 17 |
1060 |
return -E2BIG; |
| 1246 |
return -E2BIG; |
|
|
| 1247 |
#else |
| 1248 |
break; |
| 1249 |
#endif |
| 1250 |
|
1061 |
|
| 1251 |
//Network Type |
1062 |
//Network Type |
| 1252 |
//================================ |
1063 |
//================================ |
|
Lines 1269-1279
int rt_ioctl_giwscan(struct net_device *dev,
Link Here
|
| 1269 |
previous_ev = current_ev; |
1080 |
previous_ev = current_ev; |
| 1270 |
current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_UINT_LEN); |
1081 |
current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_UINT_LEN); |
| 1271 |
if (current_ev == previous_ev) |
1082 |
if (current_ev == previous_ev) |
| 1272 |
#if WIRELESS_EXT >= 17 |
1083 |
return -E2BIG; |
| 1273 |
return -E2BIG; |
|
|
| 1274 |
#else |
| 1275 |
break; |
| 1276 |
#endif |
| 1277 |
|
1084 |
|
| 1278 |
//Channel and Frequency |
1085 |
//Channel and Frequency |
| 1279 |
//================================ |
1086 |
//================================ |
|
Lines 1289-1299
int rt_ioctl_giwscan(struct net_device *dev,
Link Here
|
| 1289 |
previous_ev = current_ev; |
1096 |
previous_ev = current_ev; |
| 1290 |
current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_FREQ_LEN); |
1097 |
current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_FREQ_LEN); |
| 1291 |
if (current_ev == previous_ev) |
1098 |
if (current_ev == previous_ev) |
| 1292 |
#if WIRELESS_EXT >= 17 |
1099 |
return -E2BIG; |
| 1293 |
return -E2BIG; |
|
|
| 1294 |
#else |
| 1295 |
break; |
| 1296 |
#endif |
| 1297 |
|
1100 |
|
| 1298 |
//Add quality statistics |
1101 |
//Add quality statistics |
| 1299 |
//================================ |
1102 |
//================================ |
|
Lines 1304-1314
int rt_ioctl_giwscan(struct net_device *dev,
Link Here
|
| 1304 |
set_quality(pAdapter, &iwe.u.qual, pAdapter->ScanTab.BssEntry[i].Rssi); |
1107 |
set_quality(pAdapter, &iwe.u.qual, pAdapter->ScanTab.BssEntry[i].Rssi); |
| 1305 |
current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_QUAL_LEN); |
1108 |
current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_QUAL_LEN); |
| 1306 |
if (current_ev == previous_ev) |
1109 |
if (current_ev == previous_ev) |
| 1307 |
#if WIRELESS_EXT >= 17 |
1110 |
return -E2BIG; |
| 1308 |
return -E2BIG; |
|
|
| 1309 |
#else |
| 1310 |
break; |
| 1311 |
#endif |
| 1312 |
|
1111 |
|
| 1313 |
//Encyption key |
1112 |
//Encyption key |
| 1314 |
//================================ |
1113 |
//================================ |
|
Lines 1322-1332
int rt_ioctl_giwscan(struct net_device *dev,
Link Here
|
| 1322 |
previous_ev = current_ev; |
1121 |
previous_ev = current_ev; |
| 1323 |
current_ev = iwe_stream_add_point(info, current_ev, end_buf,&iwe, (char *)pAdapter->SharedKey[BSS0][(iwe.u.data.flags & IW_ENCODE_INDEX)-1].Key); |
1122 |
current_ev = iwe_stream_add_point(info, current_ev, end_buf,&iwe, (char *)pAdapter->SharedKey[BSS0][(iwe.u.data.flags & IW_ENCODE_INDEX)-1].Key); |
| 1324 |
if (current_ev == previous_ev) |
1123 |
if (current_ev == previous_ev) |
| 1325 |
#if WIRELESS_EXT >= 17 |
1124 |
return -E2BIG; |
| 1326 |
return -E2BIG; |
|
|
| 1327 |
#else |
| 1328 |
break; |
| 1329 |
#endif |
| 1330 |
|
1125 |
|
| 1331 |
//Bit Rate |
1126 |
//Bit Rate |
| 1332 |
//================================ |
1127 |
//================================ |
|
Lines 1355-1368
int rt_ioctl_giwscan(struct net_device *dev,
Link Here
|
| 1355 |
if((current_val-current_ev)>IW_EV_LCP_LEN) |
1150 |
if((current_val-current_ev)>IW_EV_LCP_LEN) |
| 1356 |
current_ev = current_val; |
1151 |
current_ev = current_val; |
| 1357 |
else |
1152 |
else |
| 1358 |
#if WIRELESS_EXT >= 17 |
1153 |
return -E2BIG; |
| 1359 |
return -E2BIG; |
|
|
| 1360 |
#else |
| 1361 |
break; |
| 1362 |
#endif |
| 1363 |
} |
1154 |
} |
| 1364 |
|
1155 |
|
| 1365 |
#ifdef IWEVGENIE |
|
|
| 1366 |
//WPA IE |
1156 |
//WPA IE |
| 1367 |
if (pAdapter->ScanTab.BssEntry[i].WpaIE.IELen > 0) |
1157 |
if (pAdapter->ScanTab.BssEntry[i].WpaIE.IELen > 0) |
| 1368 |
{ |
1158 |
{ |
|
Lines 1374-1384
int rt_ioctl_giwscan(struct net_device *dev,
Link Here
|
| 1374 |
iwe.u.data.length = pAdapter->ScanTab.BssEntry[i].WpaIE.IELen; |
1164 |
iwe.u.data.length = pAdapter->ScanTab.BssEntry[i].WpaIE.IELen; |
| 1375 |
current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, custom); |
1165 |
current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, custom); |
| 1376 |
if (current_ev == previous_ev) |
1166 |
if (current_ev == previous_ev) |
| 1377 |
#if WIRELESS_EXT >= 17 |
1167 |
return -E2BIG; |
| 1378 |
return -E2BIG; |
|
|
| 1379 |
#else |
| 1380 |
break; |
| 1381 |
#endif |
| 1382 |
} |
1168 |
} |
| 1383 |
|
1169 |
|
| 1384 |
//WPA2 IE |
1170 |
//WPA2 IE |
|
Lines 1392-1445
int rt_ioctl_giwscan(struct net_device *dev,
Link Here
|
| 1392 |
iwe.u.data.length = pAdapter->ScanTab.BssEntry[i].RsnIE.IELen; |
1178 |
iwe.u.data.length = pAdapter->ScanTab.BssEntry[i].RsnIE.IELen; |
| 1393 |
current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, custom); |
1179 |
current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, custom); |
| 1394 |
if (current_ev == previous_ev) |
1180 |
if (current_ev == previous_ev) |
| 1395 |
#if WIRELESS_EXT >= 17 |
1181 |
return -E2BIG; |
| 1396 |
return -E2BIG; |
|
|
| 1397 |
#else |
| 1398 |
break; |
| 1399 |
#endif |
| 1400 |
} |
| 1401 |
#else |
| 1402 |
//WPA IE |
| 1403 |
//================================ |
| 1404 |
if (pAdapter->ScanTab.BssEntry[i].WpaIE.IELen > 0) |
| 1405 |
{ |
| 1406 |
NdisZeroMemory(&iwe, sizeof(iwe)); |
| 1407 |
memset(&custom[0], 0, MAX_CUSTOM_LEN); |
| 1408 |
iwe.cmd = IWEVCUSTOM; |
| 1409 |
iwe.u.data.length = (pAdapter->ScanTab.BssEntry[i].WpaIE.IELen * 2) + 7; |
| 1410 |
NdisMoveMemory(custom, "wpa_ie=", 7); |
| 1411 |
for (idx = 0; idx < pAdapter->ScanTab.BssEntry[i].WpaIE.IELen; idx++) |
| 1412 |
sprintf(custom + strlen(custom), "%02x", pAdapter->ScanTab.BssEntry[i].WpaIE.IE[idx]); |
| 1413 |
previous_ev = current_ev; |
| 1414 |
current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, custom); |
| 1415 |
if (current_ev == previous_ev) |
| 1416 |
#if WIRELESS_EXT >= 17 |
| 1417 |
return -E2BIG; |
| 1418 |
#else |
| 1419 |
break; |
| 1420 |
#endif |
| 1421 |
} |
| 1422 |
|
| 1423 |
//WPA2 IE |
| 1424 |
if (pAdapter->ScanTab.BssEntry[i].RsnIE.IELen > 0) |
| 1425 |
{ |
| 1426 |
NdisZeroMemory(&iwe, sizeof(iwe)); |
| 1427 |
memset(&custom[0], 0, MAX_CUSTOM_LEN); |
| 1428 |
iwe.cmd = IWEVCUSTOM; |
| 1429 |
iwe.u.data.length = (pAdapter->ScanTab.BssEntry[i].RsnIE.IELen * 2) + 7; |
| 1430 |
NdisMoveMemory(custom, "rsn_ie=", 7); |
| 1431 |
for (idx = 0; idx < pAdapter->ScanTab.BssEntry[i].RsnIE.IELen; idx++) |
| 1432 |
sprintf(custom + strlen(custom), "%02x", pAdapter->ScanTab.BssEntry[i].RsnIE.IE[idx]); |
| 1433 |
previous_ev = current_ev; |
| 1434 |
current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, custom); |
| 1435 |
if (current_ev == previous_ev) |
| 1436 |
#if WIRELESS_EXT >= 17 |
| 1437 |
return -E2BIG; |
| 1438 |
#else |
| 1439 |
break; |
| 1440 |
#endif |
| 1441 |
} |
1182 |
} |
| 1442 |
#endif // IWEVGENIE // |
|
|
| 1443 |
} |
1183 |
} |
| 1444 |
|
1184 |
|
| 1445 |
data->length = current_ev - extra; |
1185 |
data->length = current_ev - extra; |
|
Lines 1447-1453
int rt_ioctl_giwscan(struct net_device *dev,
Link Here
|
| 1447 |
DBGPRINT(RT_DEBUG_ERROR ,("===>rt_ioctl_giwscan. %d(%d) BSS returned, data->length = %d\n",i , pAdapter->ScanTab.BssNr, data->length)); |
1187 |
DBGPRINT(RT_DEBUG_ERROR ,("===>rt_ioctl_giwscan. %d(%d) BSS returned, data->length = %d\n",i , pAdapter->ScanTab.BssNr, data->length)); |
| 1448 |
return 0; |
1188 |
return 0; |
| 1449 |
} |
1189 |
} |
| 1450 |
#endif |
|
|
| 1451 |
|
1190 |
|
| 1452 |
int rt_ioctl_siwessid(struct net_device *dev, |
1191 |
int rt_ioctl_siwessid(struct net_device *dev, |
| 1453 |
struct iw_request_info *info, |
1192 |
struct iw_request_info *info, |
|
Lines 1494-1524
int rt_ioctl_giwessid(struct net_device *dev,
Link Here
|
| 1494 |
struct iw_request_info *info, |
1233 |
struct iw_request_info *info, |
| 1495 |
struct iw_point *data, char *essid) |
1234 |
struct iw_point *data, char *essid) |
| 1496 |
{ |
1235 |
{ |
| 1497 |
#ifndef RT30xx |
|
|
| 1498 |
PRTMP_ADAPTER pAdapter = NULL; |
| 1499 |
VIRTUAL_ADAPTER *pVirtualAd = NULL; |
| 1500 |
|
| 1501 |
if (dev->priv_flags == INT_MAIN) |
| 1502 |
{ |
| 1503 |
pAdapter = dev->ml_priv; |
| 1504 |
} |
| 1505 |
else |
| 1506 |
{ |
| 1507 |
pVirtualAd = dev->ml_priv; |
| 1508 |
if (pVirtualAd && pVirtualAd->RtmpDev) |
| 1509 |
pAdapter = pVirtualAd->RtmpDev->ml_priv; |
| 1510 |
} |
| 1511 |
|
| 1512 |
if (pAdapter == NULL) |
| 1513 |
{ |
| 1514 |
/* if 1st open fail, pAd will be free; |
| 1515 |
So the net_dev->ml_priv will be NULL in 2rd open */ |
| 1516 |
return -ENETDOWN; |
| 1517 |
} |
| 1518 |
#endif |
| 1519 |
#ifdef RT30xx |
| 1520 |
PRTMP_ADAPTER pAdapter = dev->ml_priv; |
1236 |
PRTMP_ADAPTER pAdapter = dev->ml_priv; |
| 1521 |
#endif |
|
|
| 1522 |
|
1237 |
|
| 1523 |
data->flags = 1; |
1238 |
data->flags = 1; |
| 1524 |
if (MONITOR_ON(pAdapter)) |
1239 |
if (MONITOR_ON(pAdapter)) |
|
Lines 1578-1608
int rt_ioctl_giwnickn(struct net_device *dev,
Link Here
|
| 1578 |
struct iw_request_info *info, |
1293 |
struct iw_request_info *info, |
| 1579 |
struct iw_point *data, char *nickname) |
1294 |
struct iw_point *data, char *nickname) |
| 1580 |
{ |
1295 |
{ |
| 1581 |
#ifndef RT30xx |
|
|
| 1582 |
PRTMP_ADAPTER pAdapter = NULL; |
| 1583 |
VIRTUAL_ADAPTER *pVirtualAd = NULL; |
| 1584 |
|
| 1585 |
if (dev->priv_flags == INT_MAIN) |
| 1586 |
{ |
| 1587 |
pAdapter = dev->ml_priv; |
| 1588 |
} |
| 1589 |
else |
| 1590 |
{ |
| 1591 |
pVirtualAd = dev->ml_priv; |
| 1592 |
if (pVirtualAd && pVirtualAd->RtmpDev) |
| 1593 |
pAdapter = pVirtualAd->RtmpDev->ml_priv; |
| 1594 |
} |
| 1595 |
|
| 1596 |
if (pAdapter == NULL) |
| 1597 |
{ |
| 1598 |
/* if 1st open fail, pAd will be free; |
| 1599 |
So the net_dev->ml_priv will be NULL in 2rd open */ |
| 1600 |
return -ENETDOWN; |
| 1601 |
} |
| 1602 |
#endif |
| 1603 |
#ifdef RT30xx |
| 1604 |
PRTMP_ADAPTER pAdapter = dev->ml_priv; |
1296 |
PRTMP_ADAPTER pAdapter = dev->ml_priv; |
| 1605 |
#endif |
|
|
| 1606 |
|
1297 |
|
| 1607 |
if (data->length > strlen(pAdapter->nickname) + 1) |
1298 |
if (data->length > strlen(pAdapter->nickname) + 1) |
| 1608 |
data->length = strlen(pAdapter->nickname) + 1; |
1299 |
data->length = strlen(pAdapter->nickname) + 1; |
|
Lines 1646-1676
int rt_ioctl_giwrts(struct net_device *dev,
Link Here
|
| 1646 |
struct iw_request_info *info, |
1337 |
struct iw_request_info *info, |
| 1647 |
struct iw_param *rts, char *extra) |
1338 |
struct iw_param *rts, char *extra) |
| 1648 |
{ |
1339 |
{ |
| 1649 |
#ifndef RT30xx |
|
|
| 1650 |
PRTMP_ADAPTER pAdapter = NULL; |
| 1651 |
VIRTUAL_ADAPTER *pVirtualAd = NULL; |
| 1652 |
|
| 1653 |
if (dev->priv_flags == INT_MAIN) |
| 1654 |
{ |
| 1655 |
pAdapter = dev->ml_priv; |
| 1656 |
} |
| 1657 |
else |
| 1658 |
{ |
| 1659 |
pVirtualAd = dev->ml_priv; |
| 1660 |
if (pVirtualAd && pVirtualAd->RtmpDev) |
| 1661 |
pAdapter = pVirtualAd->RtmpDev->ml_priv; |
| 1662 |
} |
| 1663 |
|
| 1664 |
if (pAdapter == NULL) |
| 1665 |
{ |
| 1666 |
/* if 1st open fail, pAd will be free; |
| 1667 |
So the net_dev->ml_priv will be NULL in 2rd open */ |
| 1668 |
return -ENETDOWN; |
| 1669 |
} |
| 1670 |
#endif |
| 1671 |
#ifdef RT30xx |
| 1672 |
PRTMP_ADAPTER pAdapter = dev->ml_priv; |
1340 |
PRTMP_ADAPTER pAdapter = dev->ml_priv; |
| 1673 |
#endif |
|
|
| 1674 |
|
1341 |
|
| 1675 |
//check if the interface is down |
1342 |
//check if the interface is down |
| 1676 |
if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) |
1343 |
if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) |
|
Lines 1702-1709
int rt_ioctl_siwfrag(struct net_device *dev,
Link Here
|
| 1702 |
|
1369 |
|
| 1703 |
if (frag->disabled) |
1370 |
if (frag->disabled) |
| 1704 |
val = MAX_FRAG_THRESHOLD; |
1371 |
val = MAX_FRAG_THRESHOLD; |
| 1705 |
else if (frag->value >= MIN_FRAG_THRESHOLD || frag->value <= MAX_FRAG_THRESHOLD) |
1372 |
else if (frag->value >= MIN_FRAG_THRESHOLD && frag->value <= MAX_FRAG_THRESHOLD) |
| 1706 |
val = __cpu_to_le16(frag->value & ~0x1); /* even numbers only */ |
1373 |
val = __cpu_to_le16(frag->value & ~0x1); /* even numbers only */ |
| 1707 |
else if (frag->value == 0) |
1374 |
else if (frag->value == 0) |
| 1708 |
val = MAX_FRAG_THRESHOLD; |
1375 |
val = MAX_FRAG_THRESHOLD; |
| 1709 |
else |
1376 |
else |
|
Lines 1717-1747
int rt_ioctl_giwfrag(struct net_device *dev,
Link Here
|
| 1717 |
struct iw_request_info *info, |
1384 |
struct iw_request_info *info, |
| 1718 |
struct iw_param *frag, char *extra) |
1385 |
struct iw_param *frag, char *extra) |
| 1719 |
{ |
1386 |
{ |
| 1720 |
#ifndef RT30xx |
|
|
| 1721 |
PRTMP_ADAPTER pAdapter = NULL; |
| 1722 |
VIRTUAL_ADAPTER *pVirtualAd = NULL; |
| 1723 |
|
| 1724 |
if (dev->priv_flags == INT_MAIN) |
| 1725 |
{ |
| 1726 |
pAdapter = dev->ml_priv; |
| 1727 |
} |
| 1728 |
else |
| 1729 |
{ |
| 1730 |
pVirtualAd = dev->ml_priv; |
| 1731 |
if (pVirtualAd && pVirtualAd->RtmpDev) |
| 1732 |
pAdapter = pVirtualAd->RtmpDev->ml_priv; |
| 1733 |
} |
| 1734 |
|
| 1735 |
if (pAdapter == NULL) |
| 1736 |
{ |
| 1737 |
/* if 1st open fail, pAd will be free; |
| 1738 |
So the net_dev->ml_priv will be NULL in 2rd open */ |
| 1739 |
return -ENETDOWN; |
| 1740 |
} |
| 1741 |
#endif |
| 1742 |
#ifdef RT30xx |
| 1743 |
PRTMP_ADAPTER pAdapter = dev->ml_priv; |
1387 |
PRTMP_ADAPTER pAdapter = dev->ml_priv; |
| 1744 |
#endif |
|
|
| 1745 |
|
1388 |
|
| 1746 |
//check if the interface is down |
1389 |
//check if the interface is down |
| 1747 |
if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) |
1390 |
if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) |
|
Lines 1781-1795
int rt_ioctl_siwencode(struct net_device *dev,
Link Here
|
| 1781 |
pAdapter->StaCfg.OrigWepStatus = pAdapter->StaCfg.WepStatus; |
1424 |
pAdapter->StaCfg.OrigWepStatus = pAdapter->StaCfg.WepStatus; |
| 1782 |
pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeOpen; |
1425 |
pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeOpen; |
| 1783 |
goto done; |
1426 |
goto done; |
| 1784 |
} |
1427 |
} else if ( |
| 1785 |
#ifndef RT30xx |
1428 |
(erq->flags & IW_ENCODE_RESTRICTED || erq->flags & IW_ENCODE_OPEN)) { |
| 1786 |
else if ((erq->length == 0) && |
|
|
| 1787 |
(erq->flags & IW_ENCODE_RESTRICTED || erq->flags & IW_ENCODE_OPEN)) |
| 1788 |
#endif |
| 1789 |
#ifdef RT30xx |
| 1790 |
else if (erq->flags & IW_ENCODE_RESTRICTED || erq->flags & IW_ENCODE_OPEN) |
| 1791 |
#endif |
| 1792 |
{ |
| 1793 |
STA_PORT_SECURED(pAdapter); |
1429 |
STA_PORT_SECURED(pAdapter); |
| 1794 |
pAdapter->StaCfg.PairCipher = Ndis802_11WEPEnabled; |
1430 |
pAdapter->StaCfg.PairCipher = Ndis802_11WEPEnabled; |
| 1795 |
pAdapter->StaCfg.GroupCipher = Ndis802_11WEPEnabled; |
1431 |
pAdapter->StaCfg.GroupCipher = Ndis802_11WEPEnabled; |
|
Lines 1799-1807
int rt_ioctl_siwencode(struct net_device *dev,
Link Here
|
| 1799 |
pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeShared; |
1435 |
pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeShared; |
| 1800 |
else |
1436 |
else |
| 1801 |
pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeOpen; |
1437 |
pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeOpen; |
| 1802 |
#ifndef RT30xx |
|
|
| 1803 |
goto done; |
| 1804 |
#endif |
| 1805 |
} |
1438 |
} |
| 1806 |
|
1439 |
|
| 1807 |
if (erq->length > 0) |
1440 |
if (erq->length > 0) |
|
Lines 1820-1831
int rt_ioctl_siwencode(struct net_device *dev,
Link Here
|
| 1820 |
//Using default key |
1453 |
//Using default key |
| 1821 |
keyIdx = pAdapter->StaCfg.DefaultKeyId; |
1454 |
keyIdx = pAdapter->StaCfg.DefaultKeyId; |
| 1822 |
} |
1455 |
} |
| 1823 |
#ifdef RT30xx |
|
|
| 1824 |
else |
1456 |
else |
| 1825 |
{ |
|
|
| 1826 |
pAdapter->StaCfg.DefaultKeyId=keyIdx; |
1457 |
pAdapter->StaCfg.DefaultKeyId=keyIdx; |
| 1827 |
} |
|
|
| 1828 |
#endif |
| 1829 |
|
1458 |
|
| 1830 |
NdisZeroMemory(pAdapter->SharedKey[BSS0][keyIdx].Key, 16); |
1459 |
NdisZeroMemory(pAdapter->SharedKey[BSS0][keyIdx].Key, 16); |
| 1831 |
|
1460 |
|
|
Lines 1877-1908
rt_ioctl_giwencode(struct net_device *dev,
Link Here
|
| 1877 |
struct iw_request_info *info, |
1506 |
struct iw_request_info *info, |
| 1878 |
struct iw_point *erq, char *key) |
1507 |
struct iw_point *erq, char *key) |
| 1879 |
{ |
1508 |
{ |
| 1880 |
#ifdef RT30xx |
|
|
| 1881 |
PRTMP_ADAPTER pAdapter = dev->ml_priv; |
1509 |
PRTMP_ADAPTER pAdapter = dev->ml_priv; |
| 1882 |
#endif |
|
|
| 1883 |
int kid; |
1510 |
int kid; |
| 1884 |
#ifndef RT30xx |
|
|
| 1885 |
PRTMP_ADAPTER pAdapter = NULL; |
| 1886 |
VIRTUAL_ADAPTER *pVirtualAd = NULL; |
| 1887 |
|
| 1888 |
if (dev->priv_flags == INT_MAIN) |
| 1889 |
{ |
| 1890 |
pAdapter = dev->ml_priv; |
| 1891 |
} |
| 1892 |
else |
| 1893 |
{ |
| 1894 |
pVirtualAd = dev->ml_priv; |
| 1895 |
if (pVirtualAd && pVirtualAd->RtmpDev) |
| 1896 |
pAdapter = pVirtualAd->RtmpDev->ml_priv; |
| 1897 |
} |
| 1898 |
|
| 1899 |
if (pAdapter == NULL) |
| 1900 |
{ |
| 1901 |
/* if 1st open fail, pAd will be free; |
| 1902 |
So the net_dev->ml_priv will be NULL in 2rd open */ |
| 1903 |
return -ENETDOWN; |
| 1904 |
} |
| 1905 |
#endif |
| 1906 |
|
1511 |
|
| 1907 |
//check if the interface is down |
1512 |
//check if the interface is down |
| 1908 |
if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) |
1513 |
if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) |
|
Lines 1959-1989
static int
Link Here
|
| 1959 |
rt_ioctl_setparam(struct net_device *dev, struct iw_request_info *info, |
1564 |
rt_ioctl_setparam(struct net_device *dev, struct iw_request_info *info, |
| 1960 |
void *w, char *extra) |
1565 |
void *w, char *extra) |
| 1961 |
{ |
1566 |
{ |
| 1962 |
VIRTUAL_ADAPTER *pVirtualAd = NULL; |
1567 |
PRTMP_ADAPTER pAdapter = dev->ml_priv; |
| 1963 |
PRTMP_ADAPTER pAdapter; |
1568 |
POS_COOKIE pObj = (POS_COOKIE)pAdapter->OS_Cookie; |
| 1964 |
POS_COOKIE pObj; |
|
|
| 1965 |
char *this_char = extra; |
1569 |
char *this_char = extra; |
| 1966 |
char *value; |
1570 |
char *value; |
| 1967 |
int Status=0; |
1571 |
int Status=0; |
| 1968 |
|
1572 |
|
| 1969 |
if (dev->priv_flags == INT_MAIN) |
|
|
| 1970 |
{ |
| 1971 |
pAdapter = dev->ml_priv; |
| 1972 |
} |
| 1973 |
else |
| 1974 |
{ |
| 1975 |
pVirtualAd = dev->ml_priv; |
| 1976 |
pAdapter = pVirtualAd->RtmpDev->ml_priv; |
| 1977 |
} |
| 1978 |
pObj = (POS_COOKIE) pAdapter->OS_Cookie; |
| 1979 |
|
| 1980 |
if (pAdapter == NULL) |
| 1981 |
{ |
| 1982 |
/* if 1st open fail, pAd will be free; |
| 1983 |
So the net_dev->ml_priv will be NULL in 2rd open */ |
| 1984 |
return -ENETDOWN; |
| 1985 |
} |
| 1986 |
|
| 1987 |
{ |
1573 |
{ |
| 1988 |
pObj->ioctl_if_type = INT_MAIN; |
1574 |
pObj->ioctl_if_type = INT_MAIN; |
| 1989 |
pObj->ioctl_if = MAIN_MBSSID; |
1575 |
pObj->ioctl_if = MAIN_MBSSID; |
|
Lines 2127-2153
rt_private_show(struct net_device *dev, struct iw_request_info *info,
Link Here
|
| 2127 |
struct iw_point *wrq, char *extra) |
1713 |
struct iw_point *wrq, char *extra) |
| 2128 |
{ |
1714 |
{ |
| 2129 |
INT Status = 0; |
1715 |
INT Status = 0; |
| 2130 |
VIRTUAL_ADAPTER *pVirtualAd = NULL; |
1716 |
PRTMP_ADAPTER pAd = dev->ml_priv; |
| 2131 |
PRTMP_ADAPTER pAd; |
1717 |
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; |
| 2132 |
POS_COOKIE pObj; |
|
|
| 2133 |
u32 subcmd = wrq->flags; |
1718 |
u32 subcmd = wrq->flags; |
| 2134 |
|
1719 |
|
| 2135 |
if (dev->priv_flags == INT_MAIN) |
|
|
| 2136 |
pAd = dev->ml_priv; |
| 2137 |
else |
| 2138 |
{ |
| 2139 |
pVirtualAd = dev->ml_priv; |
| 2140 |
pAd = pVirtualAd->RtmpDev->ml_priv; |
| 2141 |
} |
| 2142 |
pObj = (POS_COOKIE) pAd->OS_Cookie; |
| 2143 |
|
| 2144 |
if (pAd == NULL) |
| 2145 |
{ |
| 2146 |
/* if 1st open fail, pAd will be free; |
| 2147 |
So the net_dev->ml_priv will be NULL in 2rd open */ |
| 2148 |
return -ENETDOWN; |
| 2149 |
} |
| 2150 |
|
| 2151 |
if (extra == NULL) |
1720 |
if (extra == NULL) |
| 2152 |
{ |
1721 |
{ |
| 2153 |
wrq->length = 0; |
1722 |
wrq->length = 0; |
|
Lines 2265-2276
rt_private_show(struct net_device *dev, struct iw_request_info *info,
Link Here
|
| 2265 |
wrq->length = strlen(extra) + 1; // 1: size of '\0' |
1834 |
wrq->length = strlen(extra) + 1; // 1: size of '\0' |
| 2266 |
} |
1835 |
} |
| 2267 |
break; |
1836 |
break; |
| 2268 |
#if !defined(RT2860) && !defined(RT30xx) |
|
|
| 2269 |
case SHOW_ADHOC_ENTRY_INFO: |
| 2270 |
Show_Adhoc_MacTable_Proc(pAd, extra); |
| 2271 |
wrq->length = strlen(extra) + 1; // 1: size of '\0' |
| 2272 |
break; |
| 2273 |
#endif |
| 2274 |
default: |
1837 |
default: |
| 2275 |
DBGPRINT(RT_DEBUG_TRACE, ("%s - unknow subcmd = %d\n", __func__, subcmd)); |
1838 |
DBGPRINT(RT_DEBUG_TRACE, ("%s - unknow subcmd = %d\n", __func__, subcmd)); |
| 2276 |
break; |
1839 |
break; |
|
Lines 2279-2285
rt_private_show(struct net_device *dev, struct iw_request_info *info,
Link Here
|
| 2279 |
return Status; |
1842 |
return Status; |
| 2280 |
} |
1843 |
} |
| 2281 |
|
1844 |
|
| 2282 |
#ifdef SIOCSIWMLME |
|
|
| 2283 |
int rt_ioctl_siwmlme(struct net_device *dev, |
1845 |
int rt_ioctl_siwmlme(struct net_device *dev, |
| 2284 |
struct iw_request_info *info, |
1846 |
struct iw_request_info *info, |
| 2285 |
union iwreq_data *wrqu, |
1847 |
union iwreq_data *wrqu, |
|
Lines 2335-2343
int rt_ioctl_siwmlme(struct net_device *dev,
Link Here
|
| 2335 |
|
1897 |
|
| 2336 |
return 0; |
1898 |
return 0; |
| 2337 |
} |
1899 |
} |
| 2338 |
#endif // SIOCSIWMLME // |
|
|
| 2339 |
|
1900 |
|
| 2340 |
#if WIRELESS_EXT > 17 |
|
|
| 2341 |
int rt_ioctl_siwauth(struct net_device *dev, |
1901 |
int rt_ioctl_siwauth(struct net_device *dev, |
| 2342 |
struct iw_request_info *info, |
1902 |
struct iw_request_info *info, |
| 2343 |
union iwreq_data *wrqu, char *extra) |
1903 |
union iwreq_data *wrqu, char *extra) |
|
Lines 2626-2632
int rt_ioctl_siwencodeext(struct net_device *dev,
Link Here
|
| 2626 |
|
2186 |
|
| 2627 |
NdisZeroMemory(pAdapter->SharedKey[BSS0][keyIdx].Key, 16); |
2187 |
NdisZeroMemory(pAdapter->SharedKey[BSS0][keyIdx].Key, 16); |
| 2628 |
NdisMoveMemory(pAdapter->SharedKey[BSS0][keyIdx].Key, ext->key, ext->key_len); |
2188 |
NdisMoveMemory(pAdapter->SharedKey[BSS0][keyIdx].Key, ext->key, ext->key_len); |
| 2629 |
#ifndef RT30xx |
|
|
| 2630 |
if (pAdapter->StaCfg.GroupCipher == Ndis802_11GroupWEP40Enabled || |
2189 |
if (pAdapter->StaCfg.GroupCipher == Ndis802_11GroupWEP40Enabled || |
| 2631 |
pAdapter->StaCfg.GroupCipher == Ndis802_11GroupWEP104Enabled) |
2190 |
pAdapter->StaCfg.GroupCipher == Ndis802_11GroupWEP104Enabled) |
| 2632 |
{ |
2191 |
{ |
|
Lines 2641-2647
int rt_ioctl_siwencodeext(struct net_device *dev,
Link Here
|
| 2641 |
// Indicate Connected for GUI |
2200 |
// Indicate Connected for GUI |
| 2642 |
pAdapter->IndicateMediaState = NdisMediaStateConnected; |
2201 |
pAdapter->IndicateMediaState = NdisMediaStateConnected; |
| 2643 |
} |
2202 |
} |
| 2644 |
#endif |
|
|
| 2645 |
break; |
2203 |
break; |
| 2646 |
case IW_ENCODE_ALG_TKIP: |
2204 |
case IW_ENCODE_ALG_TKIP: |
| 2647 |
DBGPRINT(RT_DEBUG_TRACE, ("%s::IW_ENCODE_ALG_TKIP - keyIdx = %d, ext->key_len = %d\n", __func__, keyIdx, ext->key_len)); |
2205 |
DBGPRINT(RT_DEBUG_TRACE, ("%s::IW_ENCODE_ALG_TKIP - keyIdx = %d, ext->key_len = %d\n", __func__, keyIdx, ext->key_len)); |
|
Lines 2773-2779
rt_ioctl_giwencodeext(struct net_device *dev,
Link Here
|
| 2773 |
return 0; |
2331 |
return 0; |
| 2774 |
} |
2332 |
} |
| 2775 |
|
2333 |
|
| 2776 |
#ifdef SIOCSIWGENIE |
|
|
| 2777 |
int rt_ioctl_siwgenie(struct net_device *dev, |
2334 |
int rt_ioctl_siwgenie(struct net_device *dev, |
| 2778 |
struct iw_request_info *info, |
2335 |
struct iw_request_info *info, |
| 2779 |
union iwreq_data *wrqu, char *extra) |
2336 |
union iwreq_data *wrqu, char *extra) |
|
Lines 2797-2803
int rt_ioctl_siwgenie(struct net_device *dev,
Link Here
|
| 2797 |
|
2354 |
|
| 2798 |
return 0; |
2355 |
return 0; |
| 2799 |
} |
2356 |
} |
| 2800 |
#endif // SIOCSIWGENIE // |
|
|
| 2801 |
|
2357 |
|
| 2802 |
int rt_ioctl_giwgenie(struct net_device *dev, |
2358 |
int rt_ioctl_giwgenie(struct net_device *dev, |
| 2803 |
struct iw_request_info *info, |
2359 |
struct iw_request_info *info, |
|
Lines 2812-2818
int rt_ioctl_giwgenie(struct net_device *dev,
Link Here
|
| 2812 |
return 0; |
2368 |
return 0; |
| 2813 |
} |
2369 |
} |
| 2814 |
|
2370 |
|
| 2815 |
#ifdef SIOCSIWGENIE |
|
|
| 2816 |
if (pAd->StaCfg.WpaSupplicantUP == WPA_SUPPLICANT_ENABLE) |
2371 |
if (pAd->StaCfg.WpaSupplicantUP == WPA_SUPPLICANT_ENABLE) |
| 2817 |
{ |
2372 |
{ |
| 2818 |
if (wrqu->data.length < pAd->StaCfg.RSNIE_Len) |
2373 |
if (wrqu->data.length < pAd->StaCfg.RSNIE_Len) |
|
Lines 2822-2828
int rt_ioctl_giwgenie(struct net_device *dev,
Link Here
|
| 2822 |
memcpy(extra, &pAd->StaCfg.RSN_IE[0], pAd->StaCfg.RSNIE_Len); |
2377 |
memcpy(extra, &pAd->StaCfg.RSN_IE[0], pAd->StaCfg.RSNIE_Len); |
| 2823 |
} |
2378 |
} |
| 2824 |
else |
2379 |
else |
| 2825 |
#endif // SIOCSIWGENIE // |
|
|
| 2826 |
{ |
2380 |
{ |
| 2827 |
UCHAR RSNIe = IE_WPA; |
2381 |
UCHAR RSNIe = IE_WPA; |
| 2828 |
|
2382 |
|
|
Lines 2916-3054
int rt_ioctl_siwpmksa(struct net_device *dev,
Link Here
|
| 2916 |
|
2470 |
|
| 2917 |
return 0; |
2471 |
return 0; |
| 2918 |
} |
2472 |
} |
| 2919 |
#endif // #if WIRELESS_EXT > 17 |
|
|
| 2920 |
|
| 2921 |
#ifdef DBG |
| 2922 |
static int |
| 2923 |
rt_private_ioctl_bbp(struct net_device *dev, struct iw_request_info *info, |
| 2924 |
struct iw_point *wrq, char *extra) |
| 2925 |
{ |
| 2926 |
CHAR *this_char; |
| 2927 |
CHAR *value = NULL; |
| 2928 |
UCHAR regBBP = 0; |
| 2929 |
UINT32 bbpId; |
| 2930 |
UINT32 bbpValue; |
| 2931 |
BOOLEAN bIsPrintAllBBP = FALSE; |
| 2932 |
INT Status = 0; |
| 2933 |
PRTMP_ADAPTER pAdapter = dev->ml_priv; |
| 2934 |
|
| 2935 |
|
| 2936 |
memset(extra, 0x00, IW_PRIV_SIZE_MASK); |
| 2937 |
|
| 2938 |
if (wrq->length > 1) //No parameters. |
| 2939 |
{ |
| 2940 |
sprintf(extra, "\n"); |
| 2941 |
|
| 2942 |
//Parsing Read or Write |
| 2943 |
this_char = wrq->pointer; |
| 2944 |
DBGPRINT(RT_DEBUG_TRACE, ("this_char=%s\n", this_char)); |
| 2945 |
if (!*this_char) |
| 2946 |
goto next; |
| 2947 |
|
| 2948 |
if ((value = rtstrchr(this_char, '=')) != NULL) |
| 2949 |
*value++ = 0; |
| 2950 |
|
| 2951 |
if (!value || !*value) |
| 2952 |
{ //Read |
| 2953 |
DBGPRINT(RT_DEBUG_TRACE, ("this_char=%s, value=%s\n", this_char, value)); |
| 2954 |
if (sscanf(this_char, "%d", &(bbpId)) == 1) |
| 2955 |
{ |
| 2956 |
#ifndef RT30xx |
| 2957 |
if (bbpId <= 136) |
| 2958 |
#endif // RT30xx // |
| 2959 |
#ifdef RT30xx |
| 2960 |
if (bbpId <= 138) // edit by johnli, RF power sequence setup, add BBP R138 for ADC dynamic on/off control |
| 2961 |
#endif // RT30xx // |
| 2962 |
{ |
| 2963 |
{ |
| 2964 |
RTMP_BBP_IO_READ8_BY_REG_ID(pAdapter, bbpId, ®BBP); |
| 2965 |
} |
| 2966 |
sprintf(extra+strlen(extra), "R%02d[0x%02X]:%02X\n", bbpId, bbpId*2, regBBP); |
| 2967 |
wrq->length = strlen(extra) + 1; // 1: size of '\0' |
| 2968 |
DBGPRINT(RT_DEBUG_TRACE, ("msg=%s\n", extra)); |
| 2969 |
} |
| 2970 |
else |
| 2971 |
{//Invalid parametes, so default printk all bbp |
| 2972 |
bIsPrintAllBBP = TRUE; |
| 2973 |
goto next; |
| 2974 |
} |
| 2975 |
} |
| 2976 |
else |
| 2977 |
{ //Invalid parametes, so default printk all bbp |
| 2978 |
bIsPrintAllBBP = TRUE; |
| 2979 |
goto next; |
| 2980 |
} |
| 2981 |
} |
| 2982 |
else |
| 2983 |
{ //Write |
| 2984 |
if ((sscanf(this_char, "%d", &(bbpId)) == 1) && (sscanf(value, "%x", &(bbpValue)) == 1)) |
| 2985 |
{ |
| 2986 |
#ifndef RT30xx |
| 2987 |
if (bbpId <= 136) |
| 2988 |
#endif // RT30xx // |
| 2989 |
#ifdef RT30xx |
| 2990 |
if (bbpId <= 138) // edit by johnli, RF power sequence setup, add BBP R138 for ADC dynamic on/off control |
| 2991 |
#endif // RT30xx // |
| 2992 |
{ |
| 2993 |
{ |
| 2994 |
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAdapter, bbpId, bbpValue); |
| 2995 |
//Read it back for showing |
| 2996 |
RTMP_BBP_IO_READ8_BY_REG_ID(pAdapter, bbpId, ®BBP); |
| 2997 |
} |
| 2998 |
sprintf(extra+strlen(extra), "R%02d[0x%02X]:%02X\n", bbpId, bbpId*2, regBBP); |
| 2999 |
wrq->length = strlen(extra) + 1; // 1: size of '\0' |
| 3000 |
DBGPRINT(RT_DEBUG_TRACE, ("msg=%s\n", extra)); |
| 3001 |
} |
| 3002 |
else |
| 3003 |
{//Invalid parametes, so default printk all bbp |
| 3004 |
bIsPrintAllBBP = TRUE; |
| 3005 |
goto next; |
| 3006 |
} |
| 3007 |
} |
| 3008 |
else |
| 3009 |
{ //Invalid parametes, so default printk all bbp |
| 3010 |
bIsPrintAllBBP = TRUE; |
| 3011 |
goto next; |
| 3012 |
} |
| 3013 |
} |
| 3014 |
} |
| 3015 |
else |
| 3016 |
bIsPrintAllBBP = TRUE; |
| 3017 |
|
| 3018 |
next: |
| 3019 |
if (bIsPrintAllBBP) |
| 3020 |
{ |
| 3021 |
memset(extra, 0x00, IW_PRIV_SIZE_MASK); |
| 3022 |
sprintf(extra, "\n"); |
| 3023 |
#ifndef RT30xx |
| 3024 |
for (bbpId = 0; bbpId <= 136; bbpId++) |
| 3025 |
#endif // RT30xx // |
| 3026 |
#ifdef RT30xx |
| 3027 |
for (bbpId = 0; bbpId <= 138; bbpId++) // edit by johnli, RF power sequence setup, add BBP R138 for ADC dynamic on/off control |
| 3028 |
#endif // RT30xx // |
| 3029 |
{ |
| 3030 |
if (strlen(extra) >= (IW_PRIV_SIZE_MASK - 10)) |
| 3031 |
break; |
| 3032 |
RTMP_BBP_IO_READ8_BY_REG_ID(pAdapter, bbpId, ®BBP); |
| 3033 |
#ifndef RT30xx |
| 3034 |
sprintf(extra+strlen(extra), "R%02d[0x%02X]:%02X ", bbpId, bbpId*2, regBBP); |
| 3035 |
if (bbpId%5 == 4) |
| 3036 |
sprintf(extra+strlen(extra), "\n"); |
| 3037 |
#endif |
| 3038 |
#ifdef RT30xx |
| 3039 |
sprintf(extra+strlen(extra), "%03d = %02X\n", bbpId, regBBP); // edit by johnli, change display format |
| 3040 |
#endif |
| 3041 |
} |
| 3042 |
|
| 3043 |
wrq->length = strlen(extra) + 1; // 1: size of '\0' |
| 3044 |
DBGPRINT(RT_DEBUG_TRACE, ("wrq->length = %d\n", wrq->length)); |
| 3045 |
} |
| 3046 |
|
| 3047 |
DBGPRINT(RT_DEBUG_TRACE, ("<==rt_private_ioctl_bbp\n\n")); |
| 3048 |
|
| 3049 |
return Status; |
| 3050 |
} |
| 3051 |
#endif // DBG // |
| 3052 |
|
2473 |
|
| 3053 |
int rt_ioctl_siwrate(struct net_device *dev, |
2474 |
int rt_ioctl_siwrate(struct net_device *dev, |
| 3054 |
struct iw_request_info *info, |
2475 |
struct iw_request_info *info, |
|
Lines 3184-3202
static const iw_handler rt_handler[] =
Link Here
|
| 3184 |
(iw_handler) NULL, /* SIOCGIWTHRSPY */ |
2605 |
(iw_handler) NULL, /* SIOCGIWTHRSPY */ |
| 3185 |
(iw_handler) rt_ioctl_siwap, /* SIOCSIWAP */ |
2606 |
(iw_handler) rt_ioctl_siwap, /* SIOCSIWAP */ |
| 3186 |
(iw_handler) rt_ioctl_giwap, /* SIOCGIWAP */ |
2607 |
(iw_handler) rt_ioctl_giwap, /* SIOCGIWAP */ |
| 3187 |
#ifdef SIOCSIWMLME |
|
|
| 3188 |
(iw_handler) rt_ioctl_siwmlme, /* SIOCSIWMLME */ |
2608 |
(iw_handler) rt_ioctl_siwmlme, /* SIOCSIWMLME */ |
| 3189 |
#else |
|
|
| 3190 |
(iw_handler) NULL, /* SIOCSIWMLME */ |
| 3191 |
#endif // SIOCSIWMLME // |
| 3192 |
(iw_handler) rt_ioctl_iwaplist, /* SIOCGIWAPLIST */ |
2609 |
(iw_handler) rt_ioctl_iwaplist, /* SIOCGIWAPLIST */ |
| 3193 |
#ifdef SIOCGIWSCAN |
|
|
| 3194 |
(iw_handler) rt_ioctl_siwscan, /* SIOCSIWSCAN */ |
2610 |
(iw_handler) rt_ioctl_siwscan, /* SIOCSIWSCAN */ |
| 3195 |
(iw_handler) rt_ioctl_giwscan, /* SIOCGIWSCAN */ |
2611 |
(iw_handler) rt_ioctl_giwscan, /* SIOCGIWSCAN */ |
| 3196 |
#else |
|
|
| 3197 |
(iw_handler) NULL, /* SIOCSIWSCAN */ |
| 3198 |
(iw_handler) NULL, /* SIOCGIWSCAN */ |
| 3199 |
#endif /* SIOCGIWSCAN */ |
| 3200 |
(iw_handler) rt_ioctl_siwessid, /* SIOCSIWESSID */ |
2612 |
(iw_handler) rt_ioctl_siwessid, /* SIOCSIWESSID */ |
| 3201 |
(iw_handler) rt_ioctl_giwessid, /* SIOCGIWESSID */ |
2613 |
(iw_handler) rt_ioctl_giwessid, /* SIOCGIWESSID */ |
| 3202 |
(iw_handler) rt_ioctl_siwnickn, /* SIOCSIWNICKN */ |
2614 |
(iw_handler) rt_ioctl_siwnickn, /* SIOCSIWNICKN */ |
|
Lines 3219-3225
static const iw_handler rt_handler[] =
Link Here
|
| 3219 |
(iw_handler) NULL, /* SIOCGIWPOWER */ |
2631 |
(iw_handler) NULL, /* SIOCGIWPOWER */ |
| 3220 |
(iw_handler) NULL, /* -- hole -- */ |
2632 |
(iw_handler) NULL, /* -- hole -- */ |
| 3221 |
(iw_handler) NULL, /* -- hole -- */ |
2633 |
(iw_handler) NULL, /* -- hole -- */ |
| 3222 |
#if WIRELESS_EXT > 17 |
|
|
| 3223 |
(iw_handler) rt_ioctl_siwgenie, /* SIOCSIWGENIE */ |
2634 |
(iw_handler) rt_ioctl_siwgenie, /* SIOCSIWGENIE */ |
| 3224 |
(iw_handler) rt_ioctl_giwgenie, /* SIOCGIWGENIE */ |
2635 |
(iw_handler) rt_ioctl_giwgenie, /* SIOCGIWGENIE */ |
| 3225 |
(iw_handler) rt_ioctl_siwauth, /* SIOCSIWAUTH */ |
2636 |
(iw_handler) rt_ioctl_siwauth, /* SIOCSIWAUTH */ |
|
Lines 3227-3244
static const iw_handler rt_handler[] =
Link Here
|
| 3227 |
(iw_handler) rt_ioctl_siwencodeext, /* SIOCSIWENCODEEXT */ |
2638 |
(iw_handler) rt_ioctl_siwencodeext, /* SIOCSIWENCODEEXT */ |
| 3228 |
(iw_handler) rt_ioctl_giwencodeext, /* SIOCGIWENCODEEXT */ |
2639 |
(iw_handler) rt_ioctl_giwencodeext, /* SIOCGIWENCODEEXT */ |
| 3229 |
(iw_handler) rt_ioctl_siwpmksa, /* SIOCSIWPMKSA */ |
2640 |
(iw_handler) rt_ioctl_siwpmksa, /* SIOCSIWPMKSA */ |
| 3230 |
#endif |
|
|
| 3231 |
}; |
2641 |
}; |
| 3232 |
|
2642 |
|
| 3233 |
static const iw_handler rt_priv_handlers[] = { |
2643 |
static const iw_handler rt_priv_handlers[] = { |
| 3234 |
(iw_handler) NULL, /* + 0x00 */ |
2644 |
(iw_handler) NULL, /* + 0x00 */ |
| 3235 |
(iw_handler) NULL, /* + 0x01 */ |
2645 |
(iw_handler) NULL, /* + 0x01 */ |
| 3236 |
(iw_handler) rt_ioctl_setparam, /* + 0x02 */ |
2646 |
(iw_handler) rt_ioctl_setparam, /* + 0x02 */ |
| 3237 |
#ifdef DBG |
|
|
| 3238 |
(iw_handler) rt_private_ioctl_bbp, /* + 0x03 */ |
| 3239 |
#else |
| 3240 |
(iw_handler) NULL, /* + 0x03 */ |
2647 |
(iw_handler) NULL, /* + 0x03 */ |
| 3241 |
#endif |
|
|
| 3242 |
(iw_handler) NULL, /* + 0x04 */ |
2648 |
(iw_handler) NULL, /* + 0x04 */ |
| 3243 |
(iw_handler) NULL, /* + 0x05 */ |
2649 |
(iw_handler) NULL, /* + 0x05 */ |
| 3244 |
(iw_handler) NULL, /* + 0x06 */ |
2650 |
(iw_handler) NULL, /* + 0x06 */ |
|
Lines 3274-5161
const struct iw_handler_def rt28xx_iw_handler_def =
Link Here
|
| 3274 |
#endif |
2680 |
#endif |
| 3275 |
}; |
2681 |
}; |
| 3276 |
|
2682 |
|
| 3277 |
INT RTMPSetInformation( |
|
|
| 3278 |
IN PRTMP_ADAPTER pAdapter, |
| 3279 |
IN OUT struct ifreq *rq, |
| 3280 |
IN INT cmd) |
| 3281 |
{ |
| 3282 |
struct iwreq *wrq = (struct iwreq *) rq; |
| 3283 |
NDIS_802_11_SSID Ssid; |
| 3284 |
NDIS_802_11_MAC_ADDRESS Bssid; |
| 3285 |
RT_802_11_PHY_MODE PhyMode; |
| 3286 |
RT_802_11_STA_CONFIG StaConfig; |
| 3287 |
NDIS_802_11_RATES aryRates; |
| 3288 |
RT_802_11_PREAMBLE Preamble; |
| 3289 |
NDIS_802_11_WEP_STATUS WepStatus; |
| 3290 |
NDIS_802_11_AUTHENTICATION_MODE AuthMode = Ndis802_11AuthModeMax; |
| 3291 |
NDIS_802_11_NETWORK_INFRASTRUCTURE BssType; |
| 3292 |
NDIS_802_11_RTS_THRESHOLD RtsThresh; |
| 3293 |
NDIS_802_11_FRAGMENTATION_THRESHOLD FragThresh; |
| 3294 |
NDIS_802_11_POWER_MODE PowerMode; |
| 3295 |
PNDIS_802_11_KEY pKey = NULL; |
| 3296 |
PNDIS_802_11_WEP pWepKey =NULL; |
| 3297 |
PNDIS_802_11_REMOVE_KEY pRemoveKey = NULL; |
| 3298 |
NDIS_802_11_CONFIGURATION Config, *pConfig = NULL; |
| 3299 |
NDIS_802_11_NETWORK_TYPE NetType; |
| 3300 |
ULONG Now; |
| 3301 |
UINT KeyIdx = 0; |
| 3302 |
INT Status = NDIS_STATUS_SUCCESS, MaxPhyMode = PHY_11G; |
| 3303 |
ULONG PowerTemp; |
| 3304 |
BOOLEAN RadioState; |
| 3305 |
BOOLEAN StateMachineTouched = FALSE; |
| 3306 |
OID_SET_HT_PHYMODE HT_PhyMode; //11n ,kathy |
| 3307 |
PNDIS_802_11_PMKID pPmkId = NULL; |
| 3308 |
BOOLEAN IEEE8021xState = FALSE; |
| 3309 |
BOOLEAN IEEE8021x_required_keys = FALSE; |
| 3310 |
UCHAR wpa_supplicant_enable = 0; |
| 3311 |
|
| 3312 |
MaxPhyMode = PHY_11N_5G; |
| 3313 |
|
| 3314 |
DBGPRINT(RT_DEBUG_TRACE, ("-->RTMPSetInformation(), 0x%08x\n", cmd&0x7FFF)); |
| 3315 |
switch(cmd & 0x7FFF) { |
| 3316 |
case RT_OID_802_11_COUNTRY_REGION: |
| 3317 |
if (wrq->u.data.length < sizeof(UCHAR)) |
| 3318 |
Status = -EINVAL; |
| 3319 |
// Only avaliable when EEPROM not programming |
| 3320 |
else if (!(pAdapter->CommonCfg.CountryRegion & 0x80) && !(pAdapter->CommonCfg.CountryRegionForABand & 0x80)) |
| 3321 |
{ |
| 3322 |
ULONG Country; |
| 3323 |
UCHAR TmpPhy; |
| 3324 |
|
| 3325 |
Status = copy_from_user(&Country, wrq->u.data.pointer, wrq->u.data.length); |
| 3326 |
pAdapter->CommonCfg.CountryRegion = (UCHAR)(Country & 0x000000FF); |
| 3327 |
pAdapter->CommonCfg.CountryRegionForABand = (UCHAR)((Country >> 8) & 0x000000FF); |
| 3328 |
TmpPhy = pAdapter->CommonCfg.PhyMode; |
| 3329 |
pAdapter->CommonCfg.PhyMode = 0xff; |
| 3330 |
// Build all corresponding channel information |
| 3331 |
RTMPSetPhyMode(pAdapter, TmpPhy); |
| 3332 |
SetCommonHT(pAdapter); |
| 3333 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_COUNTRY_REGION (A:%d B/G:%d)\n", pAdapter->CommonCfg.CountryRegionForABand, |
| 3334 |
pAdapter->CommonCfg.CountryRegion)); |
| 3335 |
} |
| 3336 |
break; |
| 3337 |
case OID_802_11_BSSID_LIST_SCAN: |
| 3338 |
Now = jiffies; |
| 3339 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_BSSID_LIST_SCAN, TxCnt = %d \n", pAdapter->RalinkCounters.LastOneSecTotalTxCount)); |
| 3340 |
|
| 3341 |
if (MONITOR_ON(pAdapter)) |
| 3342 |
{ |
| 3343 |
DBGPRINT(RT_DEBUG_TRACE, ("!!! Driver is in Monitor Mode now !!!\n")); |
| 3344 |
break; |
| 3345 |
} |
| 3346 |
|
| 3347 |
//Benson add 20080527, when radio off, sta don't need to scan |
| 3348 |
if (RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_RADIO_OFF)) |
| 3349 |
break; |
| 3350 |
|
| 3351 |
if (RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) |
| 3352 |
{ |
| 3353 |
DBGPRINT(RT_DEBUG_TRACE, ("!!! Driver is scanning now !!!\n")); |
| 3354 |
pAdapter->StaCfg.bScanReqIsFromWebUI = TRUE; |
| 3355 |
Status = NDIS_STATUS_SUCCESS; |
| 3356 |
break; |
| 3357 |
} |
| 3358 |
|
| 3359 |
if (pAdapter->RalinkCounters.LastOneSecTotalTxCount > 100) |
| 3360 |
{ |
| 3361 |
DBGPRINT(RT_DEBUG_TRACE, ("!!! Link UP, ignore this set::OID_802_11_BSSID_LIST_SCAN\n")); |
| 3362 |
Status = NDIS_STATUS_SUCCESS; |
| 3363 |
pAdapter->StaCfg.ScanCnt = 99; // Prevent auto scan triggered by this OID |
| 3364 |
break; |
| 3365 |
} |
| 3366 |
|
| 3367 |
if ((OPSTATUS_TEST_FLAG(pAdapter, fOP_STATUS_MEDIA_STATE_CONNECTED)) && |
| 3368 |
((pAdapter->StaCfg.AuthMode == Ndis802_11AuthModeWPA) || |
| 3369 |
(pAdapter->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK) || |
| 3370 |
(pAdapter->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) || |
| 3371 |
(pAdapter->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK)) && |
| 3372 |
(pAdapter->StaCfg.PortSecured == WPA_802_1X_PORT_NOT_SECURED)) |
| 3373 |
{ |
| 3374 |
DBGPRINT(RT_DEBUG_TRACE, ("!!! Link UP, Port Not Secured! ignore this set::OID_802_11_BSSID_LIST_SCAN\n")); |
| 3375 |
Status = NDIS_STATUS_SUCCESS; |
| 3376 |
pAdapter->StaCfg.ScanCnt = 99; // Prevent auto scan triggered by this OID |
| 3377 |
break; |
| 3378 |
} |
| 3379 |
|
| 3380 |
|
| 3381 |
if (pAdapter->Mlme.CntlMachine.CurrState != CNTL_IDLE) |
| 3382 |
{ |
| 3383 |
RT28XX_MLME_RESET_STATE_MACHINE(pAdapter); |
| 3384 |
DBGPRINT(RT_DEBUG_TRACE, ("!!! MLME busy, reset MLME state machine !!!\n")); |
| 3385 |
} |
| 3386 |
|
| 3387 |
// tell CNTL state machine to call NdisMSetInformationComplete() after completing |
| 3388 |
// this request, because this request is initiated by NDIS. |
| 3389 |
pAdapter->MlmeAux.CurrReqIsFromNdis = FALSE; |
| 3390 |
// Reset allowed scan retries |
| 3391 |
pAdapter->StaCfg.ScanCnt = 0; |
| 3392 |
pAdapter->StaCfg.LastScanTime = Now; |
| 3393 |
|
| 3394 |
pAdapter->StaCfg.bScanReqIsFromWebUI = TRUE; |
| 3395 |
RTMP_SET_FLAG(pAdapter, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS); |
| 3396 |
MlmeEnqueue(pAdapter, |
| 3397 |
MLME_CNTL_STATE_MACHINE, |
| 3398 |
OID_802_11_BSSID_LIST_SCAN, |
| 3399 |
0, |
| 3400 |
NULL); |
| 3401 |
|
| 3402 |
Status = NDIS_STATUS_SUCCESS; |
| 3403 |
StateMachineTouched = TRUE; |
| 3404 |
break; |
| 3405 |
case OID_802_11_SSID: |
| 3406 |
if (wrq->u.data.length != sizeof(NDIS_802_11_SSID)) |
| 3407 |
Status = -EINVAL; |
| 3408 |
else |
| 3409 |
{ |
| 3410 |
PCHAR pSsidString = NULL; |
| 3411 |
Status = copy_from_user(&Ssid, wrq->u.data.pointer, wrq->u.data.length); |
| 3412 |
|
| 3413 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_SSID (Len=%d,Ssid=%s)\n", Ssid.SsidLength, Ssid.Ssid)); |
| 3414 |
if (Ssid.SsidLength > MAX_LEN_OF_SSID) |
| 3415 |
Status = -EINVAL; |
| 3416 |
else |
| 3417 |
{ |
| 3418 |
if (Ssid.SsidLength == 0) |
| 3419 |
{ |
| 3420 |
Set_SSID_Proc(pAdapter, ""); |
| 3421 |
} |
| 3422 |
else |
| 3423 |
{ |
| 3424 |
pSsidString = (CHAR *) kmalloc(MAX_LEN_OF_SSID+1, MEM_ALLOC_FLAG); |
| 3425 |
if (pSsidString) |
| 3426 |
{ |
| 3427 |
NdisZeroMemory(pSsidString, MAX_LEN_OF_SSID+1); |
| 3428 |
NdisMoveMemory(pSsidString, Ssid.Ssid, Ssid.SsidLength); |
| 3429 |
Set_SSID_Proc(pAdapter, pSsidString); |
| 3430 |
kfree(pSsidString); |
| 3431 |
} |
| 3432 |
else |
| 3433 |
Status = -ENOMEM; |
| 3434 |
} |
| 3435 |
} |
| 3436 |
} |
| 3437 |
break; |
| 3438 |
case OID_802_11_BSSID: |
| 3439 |
if (wrq->u.data.length != sizeof(NDIS_802_11_MAC_ADDRESS)) |
| 3440 |
Status = -EINVAL; |
| 3441 |
else |
| 3442 |
{ |
| 3443 |
Status = copy_from_user(&Bssid, wrq->u.data.pointer, wrq->u.data.length); |
| 3444 |
|
| 3445 |
// tell CNTL state machine to call NdisMSetInformationComplete() after completing |
| 3446 |
// this request, because this request is initiated by NDIS. |
| 3447 |
pAdapter->MlmeAux.CurrReqIsFromNdis = FALSE; |
| 3448 |
|
| 3449 |
// Prevent to connect AP again in STAMlmePeriodicExec |
| 3450 |
pAdapter->MlmeAux.AutoReconnectSsidLen= 32; |
| 3451 |
|
| 3452 |
// Reset allowed scan retries |
| 3453 |
pAdapter->StaCfg.ScanCnt = 0; |
| 3454 |
|
| 3455 |
if (pAdapter->Mlme.CntlMachine.CurrState != CNTL_IDLE) |
| 3456 |
{ |
| 3457 |
RT28XX_MLME_RESET_STATE_MACHINE(pAdapter); |
| 3458 |
DBGPRINT(RT_DEBUG_TRACE, ("!!! MLME busy, reset MLME state machine !!!\n")); |
| 3459 |
} |
| 3460 |
MlmeEnqueue(pAdapter, |
| 3461 |
MLME_CNTL_STATE_MACHINE, |
| 3462 |
OID_802_11_BSSID, |
| 3463 |
sizeof(NDIS_802_11_MAC_ADDRESS), |
| 3464 |
(VOID *)&Bssid); |
| 3465 |
Status = NDIS_STATUS_SUCCESS; |
| 3466 |
StateMachineTouched = TRUE; |
| 3467 |
|
| 3468 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_BSSID %02x:%02x:%02x:%02x:%02x:%02x\n", |
| 3469 |
Bssid[0], Bssid[1], Bssid[2], Bssid[3], Bssid[4], Bssid[5])); |
| 3470 |
} |
| 3471 |
break; |
| 3472 |
case RT_OID_802_11_RADIO: |
| 3473 |
if (wrq->u.data.length != sizeof(BOOLEAN)) |
| 3474 |
Status = -EINVAL; |
| 3475 |
else |
| 3476 |
{ |
| 3477 |
Status = copy_from_user(&RadioState, wrq->u.data.pointer, wrq->u.data.length); |
| 3478 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_RADIO (=%d)\n", RadioState)); |
| 3479 |
if (pAdapter->StaCfg.bSwRadio != RadioState) |
| 3480 |
{ |
| 3481 |
pAdapter->StaCfg.bSwRadio = RadioState; |
| 3482 |
if (pAdapter->StaCfg.bRadio != (pAdapter->StaCfg.bHwRadio && pAdapter->StaCfg.bSwRadio)) |
| 3483 |
{ |
| 3484 |
pAdapter->StaCfg.bRadio = (pAdapter->StaCfg.bHwRadio && pAdapter->StaCfg.bSwRadio); |
| 3485 |
if (pAdapter->StaCfg.bRadio == TRUE) |
| 3486 |
{ |
| 3487 |
MlmeRadioOn(pAdapter); |
| 3488 |
// Update extra information |
| 3489 |
pAdapter->ExtraInfo = EXTRA_INFO_CLEAR; |
| 3490 |
} |
| 3491 |
else |
| 3492 |
{ |
| 3493 |
MlmeRadioOff(pAdapter); |
| 3494 |
// Update extra information |
| 3495 |
pAdapter->ExtraInfo = SW_RADIO_OFF; |
| 3496 |
} |
| 3497 |
} |
| 3498 |
} |
| 3499 |
} |
| 3500 |
break; |
| 3501 |
case RT_OID_802_11_PHY_MODE: |
| 3502 |
if (wrq->u.data.length != sizeof(RT_802_11_PHY_MODE)) |
| 3503 |
Status = -EINVAL; |
| 3504 |
else |
| 3505 |
{ |
| 3506 |
Status = copy_from_user(&PhyMode, wrq->u.data.pointer, wrq->u.data.length); |
| 3507 |
if (PhyMode <= MaxPhyMode) |
| 3508 |
{ |
| 3509 |
RTMPSetPhyMode(pAdapter, PhyMode); |
| 3510 |
SetCommonHT(pAdapter); |
| 3511 |
} |
| 3512 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_PHY_MODE (=%d)\n", PhyMode)); |
| 3513 |
} |
| 3514 |
break; |
| 3515 |
case RT_OID_802_11_STA_CONFIG: |
| 3516 |
if (wrq->u.data.length != sizeof(RT_802_11_STA_CONFIG)) |
| 3517 |
Status = -EINVAL; |
| 3518 |
else |
| 3519 |
{ |
| 3520 |
Status = copy_from_user(&StaConfig, wrq->u.data.pointer, wrq->u.data.length); |
| 3521 |
pAdapter->CommonCfg.bEnableTxBurst = StaConfig.EnableTxBurst; |
| 3522 |
pAdapter->CommonCfg.UseBGProtection = StaConfig.UseBGProtection; |
| 3523 |
pAdapter->CommonCfg.bUseShortSlotTime = 1; // 2003-10-30 always SHORT SLOT capable |
| 3524 |
if ((pAdapter->CommonCfg.PhyMode != StaConfig.AdhocMode) && |
| 3525 |
(StaConfig.AdhocMode <= MaxPhyMode)) |
| 3526 |
{ |
| 3527 |
// allow dynamic change of "USE OFDM rate or not" in ADHOC mode |
| 3528 |
// if setting changed, need to reset current TX rate as well as BEACON frame format |
| 3529 |
#ifdef RT30xx |
| 3530 |
pAdapter->CommonCfg.PhyMode = StaConfig.AdhocMode; |
| 3531 |
#endif |
| 3532 |
if (pAdapter->StaCfg.BssType == BSS_ADHOC) |
| 3533 |
{ |
| 3534 |
#ifndef RT30xx |
| 3535 |
pAdapter->CommonCfg.PhyMode = StaConfig.AdhocMode; |
| 3536 |
#endif |
| 3537 |
RTMPSetPhyMode(pAdapter, PhyMode); |
| 3538 |
MlmeUpdateTxRates(pAdapter, FALSE, 0); |
| 3539 |
MakeIbssBeacon(pAdapter); // re-build BEACON frame |
| 3540 |
AsicEnableIbssSync(pAdapter); // copy to on-chip memory |
| 3541 |
} |
| 3542 |
} |
| 3543 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_SET_STA_CONFIG (Burst=%d, Protection=%ld,ShortSlot=%d\n", |
| 3544 |
pAdapter->CommonCfg.bEnableTxBurst, |
| 3545 |
pAdapter->CommonCfg.UseBGProtection, |
| 3546 |
pAdapter->CommonCfg.bUseShortSlotTime)); |
| 3547 |
} |
| 3548 |
break; |
| 3549 |
case OID_802_11_DESIRED_RATES: |
| 3550 |
if (wrq->u.data.length != sizeof(NDIS_802_11_RATES)) |
| 3551 |
Status = -EINVAL; |
| 3552 |
else |
| 3553 |
{ |
| 3554 |
Status = copy_from_user(&aryRates, wrq->u.data.pointer, wrq->u.data.length); |
| 3555 |
NdisZeroMemory(pAdapter->CommonCfg.DesireRate, MAX_LEN_OF_SUPPORTED_RATES); |
| 3556 |
NdisMoveMemory(pAdapter->CommonCfg.DesireRate, &aryRates, sizeof(NDIS_802_11_RATES)); |
| 3557 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_DESIRED_RATES (%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x)\n", |
| 3558 |
pAdapter->CommonCfg.DesireRate[0],pAdapter->CommonCfg.DesireRate[1], |
| 3559 |
pAdapter->CommonCfg.DesireRate[2],pAdapter->CommonCfg.DesireRate[3], |
| 3560 |
pAdapter->CommonCfg.DesireRate[4],pAdapter->CommonCfg.DesireRate[5], |
| 3561 |
pAdapter->CommonCfg.DesireRate[6],pAdapter->CommonCfg.DesireRate[7] )); |
| 3562 |
// Changing DesiredRate may affect the MAX TX rate we used to TX frames out |
| 3563 |
MlmeUpdateTxRates(pAdapter, FALSE, 0); |
| 3564 |
} |
| 3565 |
break; |
| 3566 |
case RT_OID_802_11_PREAMBLE: |
| 3567 |
if (wrq->u.data.length != sizeof(RT_802_11_PREAMBLE)) |
| 3568 |
Status = -EINVAL; |
| 3569 |
else |
| 3570 |
{ |
| 3571 |
Status = copy_from_user(&Preamble, wrq->u.data.pointer, wrq->u.data.length); |
| 3572 |
if (Preamble == Rt802_11PreambleShort) |
| 3573 |
{ |
| 3574 |
pAdapter->CommonCfg.TxPreamble = Preamble; |
| 3575 |
MlmeSetTxPreamble(pAdapter, Rt802_11PreambleShort); |
| 3576 |
} |
| 3577 |
else if ((Preamble == Rt802_11PreambleLong) || (Preamble == Rt802_11PreambleAuto)) |
| 3578 |
{ |
| 3579 |
// if user wants AUTO, initialize to LONG here, then change according to AP's |
| 3580 |
// capability upon association. |
| 3581 |
pAdapter->CommonCfg.TxPreamble = Preamble; |
| 3582 |
MlmeSetTxPreamble(pAdapter, Rt802_11PreambleLong); |
| 3583 |
} |
| 3584 |
else |
| 3585 |
{ |
| 3586 |
Status = -EINVAL; |
| 3587 |
break; |
| 3588 |
} |
| 3589 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_PREAMBLE (=%d)\n", Preamble)); |
| 3590 |
} |
| 3591 |
break; |
| 3592 |
case OID_802_11_WEP_STATUS: |
| 3593 |
if (wrq->u.data.length != sizeof(NDIS_802_11_WEP_STATUS)) |
| 3594 |
Status = -EINVAL; |
| 3595 |
else |
| 3596 |
{ |
| 3597 |
Status = copy_from_user(&WepStatus, wrq->u.data.pointer, wrq->u.data.length); |
| 3598 |
// Since TKIP, AES, WEP are all supported. It should not have any invalid setting |
| 3599 |
if (WepStatus <= Ndis802_11Encryption3KeyAbsent) |
| 3600 |
{ |
| 3601 |
if (pAdapter->StaCfg.WepStatus != WepStatus) |
| 3602 |
{ |
| 3603 |
// Config has changed |
| 3604 |
pAdapter->bConfigChanged = TRUE; |
| 3605 |
} |
| 3606 |
pAdapter->StaCfg.WepStatus = WepStatus; |
| 3607 |
pAdapter->StaCfg.OrigWepStatus = WepStatus; |
| 3608 |
pAdapter->StaCfg.PairCipher = WepStatus; |
| 3609 |
pAdapter->StaCfg.GroupCipher = WepStatus; |
| 3610 |
} |
| 3611 |
else |
| 3612 |
{ |
| 3613 |
Status = -EINVAL; |
| 3614 |
break; |
| 3615 |
} |
| 3616 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_WEP_STATUS (=%d)\n",WepStatus)); |
| 3617 |
} |
| 3618 |
break; |
| 3619 |
case OID_802_11_AUTHENTICATION_MODE: |
| 3620 |
if (wrq->u.data.length != sizeof(NDIS_802_11_AUTHENTICATION_MODE)) |
| 3621 |
Status = -EINVAL; |
| 3622 |
else |
| 3623 |
{ |
| 3624 |
Status = copy_from_user(&AuthMode, wrq->u.data.pointer, wrq->u.data.length); |
| 3625 |
if (AuthMode > Ndis802_11AuthModeMax) |
| 3626 |
{ |
| 3627 |
Status = -EINVAL; |
| 3628 |
break; |
| 3629 |
} |
| 3630 |
else |
| 3631 |
{ |
| 3632 |
if (pAdapter->StaCfg.AuthMode != AuthMode) |
| 3633 |
{ |
| 3634 |
// Config has changed |
| 3635 |
pAdapter->bConfigChanged = TRUE; |
| 3636 |
} |
| 3637 |
pAdapter->StaCfg.AuthMode = AuthMode; |
| 3638 |
} |
| 3639 |
pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_NOT_SECURED; |
| 3640 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_AUTHENTICATION_MODE (=%d) \n",pAdapter->StaCfg.AuthMode)); |
| 3641 |
} |
| 3642 |
break; |
| 3643 |
case OID_802_11_INFRASTRUCTURE_MODE: |
| 3644 |
if (wrq->u.data.length != sizeof(NDIS_802_11_NETWORK_INFRASTRUCTURE)) |
| 3645 |
Status = -EINVAL; |
| 3646 |
else |
| 3647 |
{ |
| 3648 |
Status = copy_from_user(&BssType, wrq->u.data.pointer, wrq->u.data.length); |
| 3649 |
|
| 3650 |
if (BssType == Ndis802_11IBSS) |
| 3651 |
Set_NetworkType_Proc(pAdapter, "Adhoc"); |
| 3652 |
else if (BssType == Ndis802_11Infrastructure) |
| 3653 |
Set_NetworkType_Proc(pAdapter, "Infra"); |
| 3654 |
else if (BssType == Ndis802_11Monitor) |
| 3655 |
Set_NetworkType_Proc(pAdapter, "Monitor"); |
| 3656 |
else |
| 3657 |
{ |
| 3658 |
Status = -EINVAL; |
| 3659 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_INFRASTRUCTURE_MODE (unknown)\n")); |
| 3660 |
} |
| 3661 |
} |
| 3662 |
break; |
| 3663 |
case OID_802_11_REMOVE_WEP: |
| 3664 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_REMOVE_WEP\n")); |
| 3665 |
if (wrq->u.data.length != sizeof(NDIS_802_11_KEY_INDEX)) |
| 3666 |
{ |
| 3667 |
Status = -EINVAL; |
| 3668 |
} |
| 3669 |
else |
| 3670 |
{ |
| 3671 |
KeyIdx = *(NDIS_802_11_KEY_INDEX *) wrq->u.data.pointer; |
| 3672 |
|
| 3673 |
if (KeyIdx & 0x80000000) |
| 3674 |
{ |
| 3675 |
// Should never set default bit when remove key |
| 3676 |
Status = -EINVAL; |
| 3677 |
} |
| 3678 |
else |
| 3679 |
{ |
| 3680 |
KeyIdx = KeyIdx & 0x0fffffff; |
| 3681 |
if (KeyIdx >= 4){ |
| 3682 |
Status = -EINVAL; |
| 3683 |
} |
| 3684 |
else |
| 3685 |
{ |
| 3686 |
pAdapter->SharedKey[BSS0][KeyIdx].KeyLen = 0; |
| 3687 |
pAdapter->SharedKey[BSS0][KeyIdx].CipherAlg = CIPHER_NONE; |
| 3688 |
AsicRemoveSharedKeyEntry(pAdapter, 0, (UCHAR)KeyIdx); |
| 3689 |
} |
| 3690 |
} |
| 3691 |
} |
| 3692 |
break; |
| 3693 |
case RT_OID_802_11_RESET_COUNTERS: |
| 3694 |
NdisZeroMemory(&pAdapter->WlanCounters, sizeof(COUNTER_802_11)); |
| 3695 |
NdisZeroMemory(&pAdapter->Counters8023, sizeof(COUNTER_802_3)); |
| 3696 |
NdisZeroMemory(&pAdapter->RalinkCounters, sizeof(COUNTER_RALINK)); |
| 3697 |
pAdapter->Counters8023.RxNoBuffer = 0; |
| 3698 |
pAdapter->Counters8023.GoodReceives = 0; |
| 3699 |
pAdapter->Counters8023.RxNoBuffer = 0; |
| 3700 |
#ifdef RT2870 |
| 3701 |
pAdapter->BulkOutComplete = 0; |
| 3702 |
pAdapter->BulkOutCompleteOther= 0; |
| 3703 |
pAdapter->BulkOutCompleteCancel = 0; |
| 3704 |
pAdapter->BulkOutReq = 0; |
| 3705 |
pAdapter->BulkInReq= 0; |
| 3706 |
pAdapter->BulkInComplete = 0; |
| 3707 |
pAdapter->BulkInCompleteFail = 0; |
| 3708 |
#endif // RT2870 // |
| 3709 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_RESET_COUNTERS \n")); |
| 3710 |
break; |
| 3711 |
case OID_802_11_RTS_THRESHOLD: |
| 3712 |
if (wrq->u.data.length != sizeof(NDIS_802_11_RTS_THRESHOLD)) |
| 3713 |
Status = -EINVAL; |
| 3714 |
else |
| 3715 |
{ |
| 3716 |
Status = copy_from_user(&RtsThresh, wrq->u.data.pointer, wrq->u.data.length); |
| 3717 |
if (RtsThresh > MAX_RTS_THRESHOLD) |
| 3718 |
Status = -EINVAL; |
| 3719 |
else |
| 3720 |
pAdapter->CommonCfg.RtsThreshold = (USHORT)RtsThresh; |
| 3721 |
} |
| 3722 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_RTS_THRESHOLD (=%ld)\n",RtsThresh)); |
| 3723 |
break; |
| 3724 |
case OID_802_11_FRAGMENTATION_THRESHOLD: |
| 3725 |
if (wrq->u.data.length != sizeof(NDIS_802_11_FRAGMENTATION_THRESHOLD)) |
| 3726 |
Status = -EINVAL; |
| 3727 |
else |
| 3728 |
{ |
| 3729 |
Status = copy_from_user(&FragThresh, wrq->u.data.pointer, wrq->u.data.length); |
| 3730 |
pAdapter->CommonCfg.bUseZeroToDisableFragment = FALSE; |
| 3731 |
if (FragThresh > MAX_FRAG_THRESHOLD || FragThresh < MIN_FRAG_THRESHOLD) |
| 3732 |
{ |
| 3733 |
if (FragThresh == 0) |
| 3734 |
{ |
| 3735 |
pAdapter->CommonCfg.FragmentThreshold = MAX_FRAG_THRESHOLD; |
| 3736 |
pAdapter->CommonCfg.bUseZeroToDisableFragment = TRUE; |
| 3737 |
} |
| 3738 |
else |
| 3739 |
Status = -EINVAL; |
| 3740 |
} |
| 3741 |
else |
| 3742 |
pAdapter->CommonCfg.FragmentThreshold = (USHORT)FragThresh; |
| 3743 |
} |
| 3744 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_FRAGMENTATION_THRESHOLD (=%ld) \n",FragThresh)); |
| 3745 |
break; |
| 3746 |
case OID_802_11_POWER_MODE: |
| 3747 |
if (wrq->u.data.length != sizeof(NDIS_802_11_POWER_MODE)) |
| 3748 |
Status = -EINVAL; |
| 3749 |
else |
| 3750 |
{ |
| 3751 |
Status = copy_from_user(&PowerMode, wrq->u.data.pointer, wrq->u.data.length); |
| 3752 |
if (PowerMode == Ndis802_11PowerModeCAM) |
| 3753 |
Set_PSMode_Proc(pAdapter, "CAM"); |
| 3754 |
else if (PowerMode == Ndis802_11PowerModeMAX_PSP) |
| 3755 |
Set_PSMode_Proc(pAdapter, "Max_PSP"); |
| 3756 |
else if (PowerMode == Ndis802_11PowerModeFast_PSP) |
| 3757 |
Set_PSMode_Proc(pAdapter, "Fast_PSP"); |
| 3758 |
else if (PowerMode == Ndis802_11PowerModeLegacy_PSP) |
| 3759 |
Set_PSMode_Proc(pAdapter, "Legacy_PSP"); |
| 3760 |
else |
| 3761 |
Status = -EINVAL; |
| 3762 |
} |
| 3763 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_POWER_MODE (=%d)\n",PowerMode)); |
| 3764 |
break; |
| 3765 |
case RT_OID_802_11_TX_POWER_LEVEL_1: |
| 3766 |
if (wrq->u.data.length < sizeof(ULONG)) |
| 3767 |
Status = -EINVAL; |
| 3768 |
else |
| 3769 |
{ |
| 3770 |
Status = copy_from_user(&PowerTemp, wrq->u.data.pointer, wrq->u.data.length); |
| 3771 |
if (PowerTemp > 100) |
| 3772 |
PowerTemp = 0xffffffff; // AUTO |
| 3773 |
pAdapter->CommonCfg.TxPowerDefault = PowerTemp; //keep current setting. |
| 3774 |
pAdapter->CommonCfg.TxPowerPercentage = pAdapter->CommonCfg.TxPowerDefault; |
| 3775 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_TX_POWER_LEVEL_1 (=%ld)\n", pAdapter->CommonCfg.TxPowerPercentage)); |
| 3776 |
} |
| 3777 |
break; |
| 3778 |
case OID_802_11_NETWORK_TYPE_IN_USE: |
| 3779 |
if (wrq->u.data.length != sizeof(NDIS_802_11_NETWORK_TYPE)) |
| 3780 |
Status = -EINVAL; |
| 3781 |
else |
| 3782 |
{ |
| 3783 |
Status = copy_from_user(&NetType, wrq->u.data.pointer, wrq->u.data.length); |
| 3784 |
|
| 3785 |
if (NetType == Ndis802_11DS) |
| 3786 |
RTMPSetPhyMode(pAdapter, PHY_11B); |
| 3787 |
else if (NetType == Ndis802_11OFDM24) |
| 3788 |
RTMPSetPhyMode(pAdapter, PHY_11BG_MIXED); |
| 3789 |
else if (NetType == Ndis802_11OFDM5) |
| 3790 |
RTMPSetPhyMode(pAdapter, PHY_11A); |
| 3791 |
else |
| 3792 |
Status = -EINVAL; |
| 3793 |
|
| 3794 |
if (Status == NDIS_STATUS_SUCCESS) |
| 3795 |
SetCommonHT(pAdapter); |
| 3796 |
|
| 3797 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_NETWORK_TYPE_IN_USE (=%d)\n",NetType)); |
| 3798 |
} |
| 3799 |
break; |
| 3800 |
// For WPA PSK PMK key |
| 3801 |
case RT_OID_802_11_ADD_WPA: |
| 3802 |
pKey = kmalloc(wrq->u.data.length, MEM_ALLOC_FLAG); |
| 3803 |
if(pKey == NULL) |
| 3804 |
{ |
| 3805 |
Status = -ENOMEM; |
| 3806 |
break; |
| 3807 |
} |
| 3808 |
|
| 3809 |
Status = copy_from_user(pKey, wrq->u.data.pointer, wrq->u.data.length); |
| 3810 |
if (pKey->Length != wrq->u.data.length) |
| 3811 |
{ |
| 3812 |
Status = -EINVAL; |
| 3813 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_ADD_WPA, Failed!!\n")); |
| 3814 |
} |
| 3815 |
else |
| 3816 |
{ |
| 3817 |
if ((pAdapter->StaCfg.AuthMode != Ndis802_11AuthModeWPAPSK) && |
| 3818 |
(pAdapter->StaCfg.AuthMode != Ndis802_11AuthModeWPA2PSK) && |
| 3819 |
(pAdapter->StaCfg.AuthMode != Ndis802_11AuthModeWPANone) ) |
| 3820 |
{ |
| 3821 |
Status = -EOPNOTSUPP; |
| 3822 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_ADD_WPA, Failed!! [AuthMode != WPAPSK/WPA2PSK/WPANONE]\n")); |
| 3823 |
} |
| 3824 |
else if ((pAdapter->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK) || |
| 3825 |
(pAdapter->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK) || |
| 3826 |
(pAdapter->StaCfg.AuthMode == Ndis802_11AuthModeWPANone) ) // Only for WPA PSK mode |
| 3827 |
{ |
| 3828 |
NdisMoveMemory(pAdapter->StaCfg.PMK, &pKey->KeyMaterial, pKey->KeyLength); |
| 3829 |
// Use RaConfig as PSK agent. |
| 3830 |
// Start STA supplicant state machine |
| 3831 |
if (pAdapter->StaCfg.AuthMode != Ndis802_11AuthModeWPANone) |
| 3832 |
pAdapter->StaCfg.WpaState = SS_START; |
| 3833 |
|
| 3834 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_ADD_WPA (id=0x%x, Len=%d-byte)\n", pKey->KeyIndex, pKey->KeyLength)); |
| 3835 |
} |
| 3836 |
else |
| 3837 |
{ |
| 3838 |
pAdapter->StaCfg.WpaState = SS_NOTUSE; |
| 3839 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_ADD_WPA (id=0x%x, Len=%d-byte)\n", pKey->KeyIndex, pKey->KeyLength)); |
| 3840 |
} |
| 3841 |
} |
| 3842 |
kfree(pKey); |
| 3843 |
break; |
| 3844 |
case OID_802_11_REMOVE_KEY: |
| 3845 |
pRemoveKey = kmalloc(wrq->u.data.length, MEM_ALLOC_FLAG); |
| 3846 |
if(pRemoveKey == NULL) |
| 3847 |
{ |
| 3848 |
Status = -ENOMEM; |
| 3849 |
break; |
| 3850 |
} |
| 3851 |
|
| 3852 |
Status = copy_from_user(pRemoveKey, wrq->u.data.pointer, wrq->u.data.length); |
| 3853 |
if (pRemoveKey->Length != wrq->u.data.length) |
| 3854 |
{ |
| 3855 |
Status = -EINVAL; |
| 3856 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_REMOVE_KEY, Failed!!\n")); |
| 3857 |
} |
| 3858 |
else |
| 3859 |
{ |
| 3860 |
if (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) |
| 3861 |
{ |
| 3862 |
RTMPWPARemoveKeyProc(pAdapter, pRemoveKey); |
| 3863 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_REMOVE_KEY, Remove WPA Key!!\n")); |
| 3864 |
} |
| 3865 |
else |
| 3866 |
{ |
| 3867 |
KeyIdx = pRemoveKey->KeyIndex; |
| 3868 |
|
| 3869 |
if (KeyIdx & 0x80000000) |
| 3870 |
{ |
| 3871 |
// Should never set default bit when remove key |
| 3872 |
Status = -EINVAL; |
| 3873 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_REMOVE_KEY, Failed!!(Should never set default bit when remove key)\n")); |
| 3874 |
} |
| 3875 |
else |
| 3876 |
{ |
| 3877 |
KeyIdx = KeyIdx & 0x0fffffff; |
| 3878 |
if (KeyIdx > 3) |
| 3879 |
{ |
| 3880 |
Status = -EINVAL; |
| 3881 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_REMOVE_KEY, Failed!!(KeyId[%d] out of range)\n", KeyIdx)); |
| 3882 |
} |
| 3883 |
else |
| 3884 |
{ |
| 3885 |
pAdapter->SharedKey[BSS0][KeyIdx].KeyLen = 0; |
| 3886 |
pAdapter->SharedKey[BSS0][KeyIdx].CipherAlg = CIPHER_NONE; |
| 3887 |
AsicRemoveSharedKeyEntry(pAdapter, 0, (UCHAR)KeyIdx); |
| 3888 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_REMOVE_KEY (id=0x%x, Len=%d-byte)\n", pRemoveKey->KeyIndex, pRemoveKey->Length)); |
| 3889 |
} |
| 3890 |
} |
| 3891 |
} |
| 3892 |
} |
| 3893 |
kfree(pRemoveKey); |
| 3894 |
break; |
| 3895 |
// New for WPA |
| 3896 |
case OID_802_11_ADD_KEY: |
| 3897 |
pKey = kmalloc(wrq->u.data.length, MEM_ALLOC_FLAG); |
| 3898 |
if(pKey == NULL) |
| 3899 |
{ |
| 3900 |
Status = -ENOMEM; |
| 3901 |
break; |
| 3902 |
} |
| 3903 |
Status = copy_from_user(pKey, wrq->u.data.pointer, wrq->u.data.length); |
| 3904 |
if (pKey->Length != wrq->u.data.length) |
| 3905 |
{ |
| 3906 |
Status = -EINVAL; |
| 3907 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_ADD_KEY, Failed!!\n")); |
| 3908 |
} |
| 3909 |
else |
| 3910 |
{ |
| 3911 |
RTMPAddKey(pAdapter, pKey); |
| 3912 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_ADD_KEY (id=0x%x, Len=%d-byte)\n", pKey->KeyIndex, pKey->KeyLength)); |
| 3913 |
} |
| 3914 |
kfree(pKey); |
| 3915 |
break; |
| 3916 |
case OID_802_11_CONFIGURATION: |
| 3917 |
if (wrq->u.data.length != sizeof(NDIS_802_11_CONFIGURATION)) |
| 3918 |
Status = -EINVAL; |
| 3919 |
else |
| 3920 |
{ |
| 3921 |
Status = copy_from_user(&Config, wrq->u.data.pointer, wrq->u.data.length); |
| 3922 |
pConfig = &Config; |
| 3923 |
|
| 3924 |
if ((pConfig->BeaconPeriod >= 20) && (pConfig->BeaconPeriod <=400)) |
| 3925 |
pAdapter->CommonCfg.BeaconPeriod = (USHORT) pConfig->BeaconPeriod; |
| 3926 |
|
| 3927 |
pAdapter->StaActive.AtimWin = (USHORT) pConfig->ATIMWindow; |
| 3928 |
MAP_KHZ_TO_CHANNEL_ID(pConfig->DSConfig, pAdapter->CommonCfg.Channel); |
| 3929 |
// |
| 3930 |
// Save the channel on MlmeAux for CntlOidRTBssidProc used. |
| 3931 |
// |
| 3932 |
pAdapter->MlmeAux.Channel = pAdapter->CommonCfg.Channel; |
| 3933 |
|
| 3934 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_CONFIGURATION (BeacnPeriod=%ld,AtimW=%ld,Ch=%d)\n", |
| 3935 |
pConfig->BeaconPeriod, pConfig->ATIMWindow, pAdapter->CommonCfg.Channel)); |
| 3936 |
// Config has changed |
| 3937 |
pAdapter->bConfigChanged = TRUE; |
| 3938 |
} |
| 3939 |
break; |
| 3940 |
case RT_OID_802_11_SET_HT_PHYMODE: |
| 3941 |
if (wrq->u.data.length != sizeof(OID_SET_HT_PHYMODE)) |
| 3942 |
Status = -EINVAL; |
| 3943 |
else |
| 3944 |
{ |
| 3945 |
POID_SET_HT_PHYMODE pHTPhyMode = &HT_PhyMode; |
| 3946 |
|
| 3947 |
Status = copy_from_user(&HT_PhyMode, wrq->u.data.pointer, wrq->u.data.length); |
| 3948 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::pHTPhyMode (PhyMode = %d,TransmitNo = %d, HtMode = %d, ExtOffset = %d , MCS = %d, BW = %d, STBC = %d, SHORTGI = %d) \n", |
| 3949 |
pHTPhyMode->PhyMode, pHTPhyMode->TransmitNo,pHTPhyMode->HtMode,pHTPhyMode->ExtOffset, |
| 3950 |
pHTPhyMode->MCS, pHTPhyMode->BW, pHTPhyMode->STBC, pHTPhyMode->SHORTGI)); |
| 3951 |
if (pAdapter->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) |
| 3952 |
RTMPSetHT(pAdapter, pHTPhyMode); |
| 3953 |
} |
| 3954 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_SET_HT_PHYMODE(MCS=%d,BW=%d,SGI=%d,STBC=%d)\n", |
| 3955 |
pAdapter->StaCfg.HTPhyMode.field.MCS, pAdapter->StaCfg.HTPhyMode.field.BW, pAdapter->StaCfg.HTPhyMode.field.ShortGI, |
| 3956 |
pAdapter->StaCfg.HTPhyMode.field.STBC)); |
| 3957 |
break; |
| 3958 |
case RT_OID_802_11_SET_APSD_SETTING: |
| 3959 |
if (wrq->u.data.length != sizeof(ULONG)) |
| 3960 |
Status = -EINVAL; |
| 3961 |
else |
| 3962 |
{ |
| 3963 |
ULONG apsd ; |
| 3964 |
Status = copy_from_user(&apsd, wrq->u.data.pointer, wrq->u.data.length); |
| 3965 |
|
| 3966 |
/*------------------------------------------------------------------- |
| 3967 |
|B31~B7 | B6~B5 | B4 | B3 | B2 | B1 | B0 | |
| 3968 |
--------------------------------------------------------------------- |
| 3969 |
| Rsvd | Max SP Len | AC_VO | AC_VI | AC_BK | AC_BE | APSD Capable | |
| 3970 |
---------------------------------------------------------------------*/ |
| 3971 |
pAdapter->CommonCfg.bAPSDCapable = (apsd & 0x00000001) ? TRUE : FALSE; |
| 3972 |
pAdapter->CommonCfg.bAPSDAC_BE = ((apsd & 0x00000002) >> 1) ? TRUE : FALSE; |
| 3973 |
pAdapter->CommonCfg.bAPSDAC_BK = ((apsd & 0x00000004) >> 2) ? TRUE : FALSE; |
| 3974 |
pAdapter->CommonCfg.bAPSDAC_VI = ((apsd & 0x00000008) >> 3) ? TRUE : FALSE; |
| 3975 |
pAdapter->CommonCfg.bAPSDAC_VO = ((apsd & 0x00000010) >> 4) ? TRUE : FALSE; |
| 3976 |
pAdapter->CommonCfg.MaxSPLength = (UCHAR)((apsd & 0x00000060) >> 5); |
| 3977 |
|
| 3978 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_SET_APSD_SETTING (apsd=0x%lx, APSDCap=%d, [BE,BK,VI,VO]=[%d/%d/%d/%d], MaxSPLen=%d)\n", apsd, pAdapter->CommonCfg.bAPSDCapable, |
| 3979 |
pAdapter->CommonCfg.bAPSDAC_BE, pAdapter->CommonCfg.bAPSDAC_BK, pAdapter->CommonCfg.bAPSDAC_VI, pAdapter->CommonCfg.bAPSDAC_VO, pAdapter->CommonCfg.MaxSPLength)); |
| 3980 |
} |
| 3981 |
break; |
| 3982 |
|
| 3983 |
case RT_OID_802_11_SET_APSD_PSM: |
| 3984 |
if (wrq->u.data.length != sizeof(ULONG)) |
| 3985 |
Status = -EINVAL; |
| 3986 |
else |
| 3987 |
{ |
| 3988 |
// Driver needs to notify AP when PSM changes |
| 3989 |
Status = copy_from_user(&pAdapter->CommonCfg.bAPSDForcePowerSave, wrq->u.data.pointer, wrq->u.data.length); |
| 3990 |
if (pAdapter->CommonCfg.bAPSDForcePowerSave != pAdapter->StaCfg.Psm) |
| 3991 |
{ |
| 3992 |
MlmeSetPsmBit(pAdapter, pAdapter->CommonCfg.bAPSDForcePowerSave); |
| 3993 |
RTMPSendNullFrame(pAdapter, pAdapter->CommonCfg.TxRate, TRUE); |
| 3994 |
} |
| 3995 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_SET_APSD_PSM (bAPSDForcePowerSave:%d)\n", pAdapter->CommonCfg.bAPSDForcePowerSave)); |
| 3996 |
} |
| 3997 |
break; |
| 3998 |
|
| 3999 |
case RT_OID_802_11_SET_WMM: |
| 4000 |
if (wrq->u.data.length != sizeof(BOOLEAN)) |
| 4001 |
Status = -EINVAL; |
| 4002 |
else |
| 4003 |
{ |
| 4004 |
Status = copy_from_user(&pAdapter->CommonCfg.bWmmCapable, wrq->u.data.pointer, wrq->u.data.length); |
| 4005 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_SET_WMM (=%d) \n", pAdapter->CommonCfg.bWmmCapable)); |
| 4006 |
} |
| 4007 |
break; |
| 4008 |
|
| 4009 |
case OID_802_11_DISASSOCIATE: |
| 4010 |
// |
| 4011 |
// Set NdisRadioStateOff to TRUE, instead of called MlmeRadioOff. |
| 4012 |
// Later on, NDIS_802_11_BSSID_LIST_EX->NumberOfItems should be 0 |
| 4013 |
// when query OID_802_11_BSSID_LIST. |
| 4014 |
// |
| 4015 |
// TRUE: NumberOfItems will set to 0. |
| 4016 |
// FALSE: NumberOfItems no change. |
| 4017 |
// |
| 4018 |
pAdapter->CommonCfg.NdisRadioStateOff = TRUE; |
| 4019 |
// Set to immediately send the media disconnect event |
| 4020 |
pAdapter->MlmeAux.CurrReqIsFromNdis = TRUE; |
| 4021 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_DISASSOCIATE \n")); |
| 4022 |
|
| 4023 |
if (INFRA_ON(pAdapter)) |
| 4024 |
{ |
| 4025 |
if (pAdapter->Mlme.CntlMachine.CurrState != CNTL_IDLE) |
| 4026 |
{ |
| 4027 |
RT28XX_MLME_RESET_STATE_MACHINE(pAdapter); |
| 4028 |
DBGPRINT(RT_DEBUG_TRACE, ("!!! MLME busy, reset MLME state machine !!!\n")); |
| 4029 |
} |
| 4030 |
|
| 4031 |
MlmeEnqueue(pAdapter, |
| 4032 |
MLME_CNTL_STATE_MACHINE, |
| 4033 |
OID_802_11_DISASSOCIATE, |
| 4034 |
0, |
| 4035 |
NULL); |
| 4036 |
|
| 4037 |
StateMachineTouched = TRUE; |
| 4038 |
} |
| 4039 |
break; |
| 4040 |
case RT_OID_802_11_SET_IMME_BA_CAP: |
| 4041 |
if (wrq->u.data.length != sizeof(OID_BACAP_STRUC)) |
| 4042 |
Status = -EINVAL; |
| 4043 |
else |
| 4044 |
{ |
| 4045 |
OID_BACAP_STRUC Orde ; |
| 4046 |
Status = copy_from_user(&Orde, wrq->u.data.pointer, wrq->u.data.length); |
| 4047 |
if (Orde.Policy > BA_NOTUSE) |
| 4048 |
{ |
| 4049 |
Status = NDIS_STATUS_INVALID_DATA; |
| 4050 |
} |
| 4051 |
else if (Orde.Policy == BA_NOTUSE) |
| 4052 |
{ |
| 4053 |
pAdapter->CommonCfg.BACapability.field.Policy = BA_NOTUSE; |
| 4054 |
pAdapter->CommonCfg.BACapability.field.MpduDensity = Orde.MpduDensity; |
| 4055 |
pAdapter->CommonCfg.DesiredHtPhy.MpduDensity = Orde.MpduDensity; |
| 4056 |
pAdapter->CommonCfg.DesiredHtPhy.AmsduEnable = Orde.AmsduEnable; |
| 4057 |
pAdapter->CommonCfg.DesiredHtPhy.AmsduSize= Orde.AmsduSize; |
| 4058 |
pAdapter->CommonCfg.DesiredHtPhy.MimoPs= Orde.MMPSmode; |
| 4059 |
pAdapter->CommonCfg.BACapability.field.MMPSmode = Orde.MMPSmode; |
| 4060 |
// UPdata to HT IE |
| 4061 |
pAdapter->CommonCfg.HtCapability.HtCapInfo.MimoPs = Orde.MMPSmode; |
| 4062 |
pAdapter->CommonCfg.HtCapability.HtCapInfo.AMsduSize = Orde.AmsduSize; |
| 4063 |
pAdapter->CommonCfg.HtCapability.HtCapParm.MpduDensity = Orde.MpduDensity; |
| 4064 |
} |
| 4065 |
else |
| 4066 |
{ |
| 4067 |
pAdapter->CommonCfg.BACapability.field.AutoBA = Orde.AutoBA; |
| 4068 |
pAdapter->CommonCfg.BACapability.field.Policy = IMMED_BA; // we only support immediate BA. |
| 4069 |
pAdapter->CommonCfg.BACapability.field.MpduDensity = Orde.MpduDensity; |
| 4070 |
pAdapter->CommonCfg.DesiredHtPhy.MpduDensity = Orde.MpduDensity; |
| 4071 |
pAdapter->CommonCfg.DesiredHtPhy.AmsduEnable = Orde.AmsduEnable; |
| 4072 |
pAdapter->CommonCfg.DesiredHtPhy.AmsduSize= Orde.AmsduSize; |
| 4073 |
pAdapter->CommonCfg.DesiredHtPhy.MimoPs = Orde.MMPSmode; |
| 4074 |
pAdapter->CommonCfg.BACapability.field.MMPSmode = Orde.MMPSmode; |
| 4075 |
|
| 4076 |
// UPdata to HT IE |
| 4077 |
pAdapter->CommonCfg.HtCapability.HtCapInfo.MimoPs = Orde.MMPSmode; |
| 4078 |
pAdapter->CommonCfg.HtCapability.HtCapInfo.AMsduSize = Orde.AmsduSize; |
| 4079 |
pAdapter->CommonCfg.HtCapability.HtCapParm.MpduDensity = Orde.MpduDensity; |
| 4080 |
|
| 4081 |
if (pAdapter->CommonCfg.BACapability.field.RxBAWinLimit > MAX_RX_REORDERBUF) |
| 4082 |
pAdapter->CommonCfg.BACapability.field.RxBAWinLimit = MAX_RX_REORDERBUF; |
| 4083 |
|
| 4084 |
} |
| 4085 |
|
| 4086 |
pAdapter->CommonCfg.REGBACapability.word = pAdapter->CommonCfg.BACapability.word; |
| 4087 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::(Orde.AutoBA = %d) (Policy=%d)(ReBAWinLimit=%d)(TxBAWinLimit=%d)(AutoMode=%d)\n",Orde.AutoBA, pAdapter->CommonCfg.BACapability.field.Policy, |
| 4088 |
pAdapter->CommonCfg.BACapability.field.RxBAWinLimit,pAdapter->CommonCfg.BACapability.field.TxBAWinLimit, pAdapter->CommonCfg.BACapability.field.AutoBA)); |
| 4089 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::(MimoPs = %d)(AmsduEnable = %d) (AmsduSize=%d)(MpduDensity=%d)\n",pAdapter->CommonCfg.DesiredHtPhy.MimoPs, pAdapter->CommonCfg.DesiredHtPhy.AmsduEnable, |
| 4090 |
pAdapter->CommonCfg.DesiredHtPhy.AmsduSize, pAdapter->CommonCfg.DesiredHtPhy.MpduDensity)); |
| 4091 |
} |
| 4092 |
|
| 4093 |
break; |
| 4094 |
case RT_OID_802_11_ADD_IMME_BA: |
| 4095 |
DBGPRINT(RT_DEBUG_TRACE, (" Set :: RT_OID_802_11_ADD_IMME_BA \n")); |
| 4096 |
if (wrq->u.data.length != sizeof(OID_ADD_BA_ENTRY)) |
| 4097 |
Status = -EINVAL; |
| 4098 |
else |
| 4099 |
{ |
| 4100 |
UCHAR index; |
| 4101 |
OID_ADD_BA_ENTRY BA; |
| 4102 |
MAC_TABLE_ENTRY *pEntry; |
| 4103 |
|
| 4104 |
Status = copy_from_user(&BA, wrq->u.data.pointer, wrq->u.data.length); |
| 4105 |
if (BA.TID > 15) |
| 4106 |
{ |
| 4107 |
Status = NDIS_STATUS_INVALID_DATA; |
| 4108 |
break; |
| 4109 |
} |
| 4110 |
else |
| 4111 |
{ |
| 4112 |
//BATableInsertEntry |
| 4113 |
//As ad-hoc mode, BA pair is not limited to only BSSID. so add via OID. |
| 4114 |
index = BA.TID; |
| 4115 |
// in ad hoc mode, when adding BA pair, we should insert this entry into MACEntry too |
| 4116 |
pEntry = MacTableLookup(pAdapter, BA.MACAddr); |
| 4117 |
if (!pEntry) |
| 4118 |
{ |
| 4119 |
DBGPRINT(RT_DEBUG_TRACE, ("RT_OID_802_11_ADD_IMME_BA. break on no connection.----:%x:%x\n", BA.MACAddr[4], BA.MACAddr[5])); |
| 4120 |
break; |
| 4121 |
} |
| 4122 |
if (BA.IsRecipient == FALSE) |
| 4123 |
{ |
| 4124 |
if (pEntry->bIAmBadAtheros == TRUE) |
| 4125 |
pAdapter->CommonCfg.BACapability.field.RxBAWinLimit = 0x10; |
| 4126 |
|
| 4127 |
BAOriSessionSetUp(pAdapter, pEntry, index, 0, 100, TRUE); |
| 4128 |
} |
| 4129 |
else |
| 4130 |
{ |
| 4131 |
//BATableInsertEntry(pAdapter, pEntry->Aid, BA.MACAddr, 0, 0xffff, BA.TID, BA.nMSDU, BA.IsRecipient); |
| 4132 |
} |
| 4133 |
|
| 4134 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_ADD_IMME_BA. Rec = %d. Mac = %x:%x:%x:%x:%x:%x . \n", |
| 4135 |
BA.IsRecipient, BA.MACAddr[0], BA.MACAddr[1], BA.MACAddr[2], BA.MACAddr[2] |
| 4136 |
, BA.MACAddr[4], BA.MACAddr[5])); |
| 4137 |
} |
| 4138 |
} |
| 4139 |
break; |
| 4140 |
|
| 4141 |
case RT_OID_802_11_TEAR_IMME_BA: |
| 4142 |
DBGPRINT(RT_DEBUG_TRACE, ("Set :: RT_OID_802_11_TEAR_IMME_BA \n")); |
| 4143 |
if (wrq->u.data.length != sizeof(OID_ADD_BA_ENTRY)) |
| 4144 |
Status = -EINVAL; |
| 4145 |
else |
| 4146 |
{ |
| 4147 |
POID_ADD_BA_ENTRY pBA; |
| 4148 |
MAC_TABLE_ENTRY *pEntry; |
| 4149 |
|
| 4150 |
pBA = kmalloc(wrq->u.data.length, MEM_ALLOC_FLAG); |
| 4151 |
|
| 4152 |
if (pBA == NULL) |
| 4153 |
{ |
| 4154 |
DBGPRINT(RT_DEBUG_TRACE, ("Set :: RT_OID_802_11_TEAR_IMME_BA kmalloc() can't allocate enough memory\n")); |
| 4155 |
Status = NDIS_STATUS_FAILURE; |
| 4156 |
} |
| 4157 |
else |
| 4158 |
{ |
| 4159 |
Status = copy_from_user(pBA, wrq->u.data.pointer, wrq->u.data.length); |
| 4160 |
DBGPRINT(RT_DEBUG_TRACE, ("Set :: RT_OID_802_11_TEAR_IMME_BA(TID=%d, bAllTid=%d)\n", pBA->TID, pBA->bAllTid)); |
| 4161 |
|
| 4162 |
if (!pBA->bAllTid && (pBA->TID > NUM_OF_TID)) |
| 4163 |
{ |
| 4164 |
Status = NDIS_STATUS_INVALID_DATA; |
| 4165 |
break; |
| 4166 |
} |
| 4167 |
|
| 4168 |
if (pBA->IsRecipient == FALSE) |
| 4169 |
{ |
| 4170 |
pEntry = MacTableLookup(pAdapter, pBA->MACAddr); |
| 4171 |
DBGPRINT(RT_DEBUG_TRACE, (" pBA->IsRecipient == FALSE\n")); |
| 4172 |
if (pEntry) |
| 4173 |
{ |
| 4174 |
DBGPRINT(RT_DEBUG_TRACE, (" pBA->pEntry\n")); |
| 4175 |
BAOriSessionTearDown(pAdapter, pEntry->Aid, pBA->TID, FALSE, TRUE); |
| 4176 |
} |
| 4177 |
else |
| 4178 |
DBGPRINT(RT_DEBUG_TRACE, ("Set :: Not found pEntry \n")); |
| 4179 |
} |
| 4180 |
else |
| 4181 |
{ |
| 4182 |
pEntry = MacTableLookup(pAdapter, pBA->MACAddr); |
| 4183 |
if (pEntry) |
| 4184 |
{ |
| 4185 |
BARecSessionTearDown( pAdapter, (UCHAR)pEntry->Aid, pBA->TID, TRUE); |
| 4186 |
} |
| 4187 |
else |
| 4188 |
DBGPRINT(RT_DEBUG_TRACE, ("Set :: Not found pEntry \n")); |
| 4189 |
} |
| 4190 |
kfree(pBA); |
| 4191 |
} |
| 4192 |
} |
| 4193 |
break; |
| 4194 |
// For WPA_SUPPLICANT to set static wep key |
| 4195 |
case OID_802_11_ADD_WEP: |
| 4196 |
pWepKey = kmalloc(wrq->u.data.length, MEM_ALLOC_FLAG); |
| 4197 |
|
| 4198 |
if(pWepKey == NULL) |
| 4199 |
{ |
| 4200 |
Status = -ENOMEM; |
| 4201 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_ADD_WEP, Failed!!\n")); |
| 4202 |
break; |
| 4203 |
} |
| 4204 |
Status = copy_from_user(pWepKey, wrq->u.data.pointer, wrq->u.data.length); |
| 4205 |
if (Status) |
| 4206 |
{ |
| 4207 |
Status = -EINVAL; |
| 4208 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_ADD_WEP, Failed (length mismatch)!!\n")); |
| 4209 |
} |
| 4210 |
else |
| 4211 |
{ |
| 4212 |
KeyIdx = pWepKey->KeyIndex & 0x0fffffff; |
| 4213 |
// KeyIdx must be 0 ~ 3 |
| 4214 |
if (KeyIdx > 4) |
| 4215 |
{ |
| 4216 |
Status = -EINVAL; |
| 4217 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_ADD_WEP, Failed (KeyIdx must be smaller than 4)!!\n")); |
| 4218 |
} |
| 4219 |
else |
| 4220 |
{ |
| 4221 |
UCHAR CipherAlg = 0; |
| 4222 |
PUCHAR Key; |
| 4223 |
|
| 4224 |
// set key material and key length |
| 4225 |
NdisZeroMemory(pAdapter->SharedKey[BSS0][KeyIdx].Key, 16); |
| 4226 |
pAdapter->SharedKey[BSS0][KeyIdx].KeyLen = (UCHAR) pWepKey->KeyLength; |
| 4227 |
NdisMoveMemory(pAdapter->SharedKey[BSS0][KeyIdx].Key, &pWepKey->KeyMaterial, pWepKey->KeyLength); |
| 4228 |
|
| 4229 |
switch(pWepKey->KeyLength) |
| 4230 |
{ |
| 4231 |
case 5: |
| 4232 |
CipherAlg = CIPHER_WEP64; |
| 4233 |
break; |
| 4234 |
case 13: |
| 4235 |
CipherAlg = CIPHER_WEP128; |
| 4236 |
break; |
| 4237 |
default: |
| 4238 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_ADD_WEP, only support CIPHER_WEP64(len:5) & CIPHER_WEP128(len:13)!!\n")); |
| 4239 |
Status = -EINVAL; |
| 4240 |
break; |
| 4241 |
} |
| 4242 |
pAdapter->SharedKey[BSS0][KeyIdx].CipherAlg = CipherAlg; |
| 4243 |
|
| 4244 |
// Default key for tx (shared key) |
| 4245 |
if (pWepKey->KeyIndex & 0x80000000) |
| 4246 |
{ |
| 4247 |
// set key material and key length |
| 4248 |
NdisZeroMemory(pAdapter->StaCfg.DesireSharedKey[KeyIdx].Key, 16); |
| 4249 |
pAdapter->StaCfg.DesireSharedKey[KeyIdx].KeyLen = (UCHAR) pWepKey->KeyLength; |
| 4250 |
NdisMoveMemory(pAdapter->StaCfg.DesireSharedKey[KeyIdx].Key, &pWepKey->KeyMaterial, pWepKey->KeyLength); |
| 4251 |
pAdapter->StaCfg.DesireSharedKeyId = KeyIdx; |
| 4252 |
pAdapter->StaCfg.DesireSharedKey[KeyIdx].CipherAlg = CipherAlg; |
| 4253 |
pAdapter->StaCfg.DefaultKeyId = (UCHAR) KeyIdx; |
| 4254 |
} |
| 4255 |
#ifndef RT30xx |
| 4256 |
#ifdef RT2860 |
| 4257 |
if ((pAdapter->StaCfg.WpaSupplicantUP != 0) && |
| 4258 |
#endif |
| 4259 |
#ifdef RT2870 |
| 4260 |
if ((pAdapter->StaCfg.WpaSupplicantUP != WPA_SUPPLICANT_DISABLE) && |
| 4261 |
#endif |
| 4262 |
(pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA)) |
| 4263 |
{ |
| 4264 |
Key = pWepKey->KeyMaterial; |
| 4265 |
|
| 4266 |
// Set Group key material to Asic |
| 4267 |
AsicAddSharedKeyEntry(pAdapter, BSS0, KeyIdx, CipherAlg, Key, NULL, NULL); |
| 4268 |
|
| 4269 |
// Update WCID attribute table and IVEIV table for this group key table |
| 4270 |
RTMPAddWcidAttributeEntry(pAdapter, BSS0, KeyIdx, CipherAlg, NULL); |
| 4271 |
|
| 4272 |
STA_PORT_SECURED(pAdapter); |
| 4273 |
|
| 4274 |
// Indicate Connected for GUI |
| 4275 |
pAdapter->IndicateMediaState = NdisMediaStateConnected; |
| 4276 |
} |
| 4277 |
else if (pAdapter->StaCfg.PortSecured == WPA_802_1X_PORT_SECURED) |
| 4278 |
#endif |
| 4279 |
#ifdef RT30xx |
| 4280 |
if (pAdapter->StaCfg.PortSecured == WPA_802_1X_PORT_SECURED) |
| 4281 |
#endif |
| 4282 |
{ |
| 4283 |
Key = pAdapter->SharedKey[BSS0][KeyIdx].Key; |
| 4284 |
|
| 4285 |
// Set key material and cipherAlg to Asic |
| 4286 |
AsicAddSharedKeyEntry(pAdapter, BSS0, KeyIdx, CipherAlg, Key, NULL, NULL); |
| 4287 |
|
| 4288 |
if (pWepKey->KeyIndex & 0x80000000) |
| 4289 |
{ |
| 4290 |
PMAC_TABLE_ENTRY pEntry = &pAdapter->MacTab.Content[BSSID_WCID]; |
| 4291 |
// Assign group key info |
| 4292 |
RTMPAddWcidAttributeEntry(pAdapter, BSS0, KeyIdx, CipherAlg, NULL); |
| 4293 |
// Assign pairwise key info |
| 4294 |
RTMPAddWcidAttributeEntry(pAdapter, BSS0, KeyIdx, CipherAlg, pEntry); |
| 4295 |
} |
| 4296 |
} |
| 4297 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_ADD_WEP (id=0x%x, Len=%d-byte), %s\n", pWepKey->KeyIndex, pWepKey->KeyLength, (pAdapter->StaCfg.PortSecured == WPA_802_1X_PORT_SECURED) ? "Port Secured":"Port NOT Secured")); |
| 4298 |
} |
| 4299 |
} |
| 4300 |
kfree(pWepKey); |
| 4301 |
break; |
| 4302 |
case OID_SET_COUNTERMEASURES: |
| 4303 |
if (wrq->u.data.length != sizeof(int)) |
| 4304 |
Status = -EINVAL; |
| 4305 |
else |
| 4306 |
{ |
| 4307 |
int enabled = 0; |
| 4308 |
Status = copy_from_user(&enabled, wrq->u.data.pointer, wrq->u.data.length); |
| 4309 |
if (enabled == 1) |
| 4310 |
pAdapter->StaCfg.bBlockAssoc = TRUE; |
| 4311 |
else |
| 4312 |
// WPA MIC error should block association attempt for 60 seconds |
| 4313 |
pAdapter->StaCfg.bBlockAssoc = FALSE; |
| 4314 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_SET_COUNTERMEASURES bBlockAssoc=%s\n", pAdapter->StaCfg.bBlockAssoc ? "TRUE":"FALSE")); |
| 4315 |
} |
| 4316 |
break; |
| 4317 |
case RT_OID_WPA_SUPPLICANT_SUPPORT: |
| 4318 |
if (wrq->u.data.length != sizeof(UCHAR)) |
| 4319 |
Status = -EINVAL; |
| 4320 |
else |
| 4321 |
{ |
| 4322 |
Status = copy_from_user(&wpa_supplicant_enable, wrq->u.data.pointer, wrq->u.data.length); |
| 4323 |
pAdapter->StaCfg.WpaSupplicantUP = wpa_supplicant_enable; |
| 4324 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_WPA_SUPPLICANT_SUPPORT (=%d)\n", pAdapter->StaCfg.WpaSupplicantUP)); |
| 4325 |
} |
| 4326 |
break; |
| 4327 |
case OID_802_11_DEAUTHENTICATION: |
| 4328 |
if (wrq->u.data.length != sizeof(MLME_DEAUTH_REQ_STRUCT)) |
| 4329 |
Status = -EINVAL; |
| 4330 |
else |
| 4331 |
{ |
| 4332 |
MLME_DEAUTH_REQ_STRUCT *pInfo; |
| 4333 |
MLME_QUEUE_ELEM *MsgElem = (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), MEM_ALLOC_FLAG); |
| 4334 |
|
| 4335 |
pInfo = (MLME_DEAUTH_REQ_STRUCT *) MsgElem->Msg; |
| 4336 |
Status = copy_from_user(pInfo, wrq->u.data.pointer, wrq->u.data.length); |
| 4337 |
MlmeDeauthReqAction(pAdapter, MsgElem); |
| 4338 |
kfree(MsgElem); |
| 4339 |
|
| 4340 |
if (INFRA_ON(pAdapter)) |
| 4341 |
{ |
| 4342 |
LinkDown(pAdapter, FALSE); |
| 4343 |
pAdapter->Mlme.AssocMachine.CurrState = ASSOC_IDLE; |
| 4344 |
} |
| 4345 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_DEAUTHENTICATION (Reason=%d)\n", pInfo->Reason)); |
| 4346 |
} |
| 4347 |
break; |
| 4348 |
case OID_802_11_DROP_UNENCRYPTED: |
| 4349 |
if (wrq->u.data.length != sizeof(int)) |
| 4350 |
Status = -EINVAL; |
| 4351 |
else |
| 4352 |
{ |
| 4353 |
int enabled = 0; |
| 4354 |
Status = copy_from_user(&enabled, wrq->u.data.pointer, wrq->u.data.length); |
| 4355 |
if (enabled == 1) |
| 4356 |
pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_NOT_SECURED; |
| 4357 |
else |
| 4358 |
pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; |
| 4359 |
NdisAcquireSpinLock(&pAdapter->MacTabLock); |
| 4360 |
pAdapter->MacTab.Content[BSSID_WCID].PortSecured = pAdapter->StaCfg.PortSecured; |
| 4361 |
NdisReleaseSpinLock(&pAdapter->MacTabLock); |
| 4362 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_DROP_UNENCRYPTED (=%d)\n", enabled)); |
| 4363 |
} |
| 4364 |
break; |
| 4365 |
case OID_802_11_SET_IEEE8021X: |
| 4366 |
if (wrq->u.data.length != sizeof(BOOLEAN)) |
| 4367 |
Status = -EINVAL; |
| 4368 |
else |
| 4369 |
{ |
| 4370 |
Status = copy_from_user(&IEEE8021xState, wrq->u.data.pointer, wrq->u.data.length); |
| 4371 |
pAdapter->StaCfg.IEEE8021X = IEEE8021xState; |
| 4372 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_SET_IEEE8021X (=%d)\n", IEEE8021xState)); |
| 4373 |
} |
| 4374 |
break; |
| 4375 |
case OID_802_11_SET_IEEE8021X_REQUIRE_KEY: |
| 4376 |
if (wrq->u.data.length != sizeof(BOOLEAN)) |
| 4377 |
Status = -EINVAL; |
| 4378 |
else |
| 4379 |
{ |
| 4380 |
Status = copy_from_user(&IEEE8021x_required_keys, wrq->u.data.pointer, wrq->u.data.length); |
| 4381 |
pAdapter->StaCfg.IEEE8021x_required_keys = IEEE8021x_required_keys; |
| 4382 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_SET_IEEE8021X_REQUIRE_KEY (%d)\n", IEEE8021x_required_keys)); |
| 4383 |
} |
| 4384 |
break; |
| 4385 |
case OID_802_11_PMKID: |
| 4386 |
pPmkId = kmalloc(wrq->u.data.length, MEM_ALLOC_FLAG); |
| 4387 |
|
| 4388 |
if(pPmkId == NULL) { |
| 4389 |
Status = -ENOMEM; |
| 4390 |
break; |
| 4391 |
} |
| 4392 |
Status = copy_from_user(pPmkId, wrq->u.data.pointer, wrq->u.data.length); |
| 4393 |
|
| 4394 |
// check the PMKID information |
| 4395 |
if (pPmkId->BSSIDInfoCount == 0) |
| 4396 |
NdisZeroMemory(pAdapter->StaCfg.SavedPMK, sizeof(BSSID_INFO)*PMKID_NO); |
| 4397 |
else |
| 4398 |
{ |
| 4399 |
PBSSID_INFO pBssIdInfo; |
| 4400 |
UINT BssIdx; |
| 4401 |
UINT CachedIdx; |
| 4402 |
|
| 4403 |
for (BssIdx = 0; BssIdx < pPmkId->BSSIDInfoCount; BssIdx++) |
| 4404 |
{ |
| 4405 |
// point to the indexed BSSID_INFO structure |
| 4406 |
pBssIdInfo = (PBSSID_INFO) ((PUCHAR) pPmkId + 2 * sizeof(UINT) + BssIdx * sizeof(BSSID_INFO)); |
| 4407 |
// Find the entry in the saved data base. |
| 4408 |
for (CachedIdx = 0; CachedIdx < pAdapter->StaCfg.SavedPMKNum; CachedIdx++) |
| 4409 |
{ |
| 4410 |
// compare the BSSID |
| 4411 |
if (NdisEqualMemory(pBssIdInfo->BSSID, pAdapter->StaCfg.SavedPMK[CachedIdx].BSSID, sizeof(NDIS_802_11_MAC_ADDRESS))) |
| 4412 |
break; |
| 4413 |
} |
| 4414 |
|
| 4415 |
// Found, replace it |
| 4416 |
if (CachedIdx < PMKID_NO) |
| 4417 |
{ |
| 4418 |
DBGPRINT(RT_DEBUG_OFF, ("Update OID_802_11_PMKID, idx = %d\n", CachedIdx)); |
| 4419 |
NdisMoveMemory(&pAdapter->StaCfg.SavedPMK[CachedIdx], pBssIdInfo, sizeof(BSSID_INFO)); |
| 4420 |
pAdapter->StaCfg.SavedPMKNum++; |
| 4421 |
} |
| 4422 |
// Not found, replace the last one |
| 4423 |
else |
| 4424 |
{ |
| 4425 |
// Randomly replace one |
| 4426 |
CachedIdx = (pBssIdInfo->BSSID[5] % PMKID_NO); |
| 4427 |
DBGPRINT(RT_DEBUG_OFF, ("Update OID_802_11_PMKID, idx = %d\n", CachedIdx)); |
| 4428 |
NdisMoveMemory(&pAdapter->StaCfg.SavedPMK[CachedIdx], pBssIdInfo, sizeof(BSSID_INFO)); |
| 4429 |
} |
| 4430 |
} |
| 4431 |
} |
| 4432 |
if(pPmkId) |
| 4433 |
kfree(pPmkId); |
| 4434 |
break; |
| 4435 |
default: |
| 4436 |
DBGPRINT(RT_DEBUG_TRACE, ("Set::unknown IOCTL's subcmd = 0x%08x\n", cmd)); |
| 4437 |
Status = -EOPNOTSUPP; |
| 4438 |
break; |
| 4439 |
} |
| 4440 |
|
| 4441 |
|
| 4442 |
return Status; |
| 4443 |
} |
| 4444 |
|
| 4445 |
INT RTMPQueryInformation( |
| 4446 |
IN PRTMP_ADAPTER pAdapter, |
| 4447 |
IN OUT struct ifreq *rq, |
| 4448 |
IN INT cmd) |
| 4449 |
{ |
| 4450 |
struct iwreq *wrq = (struct iwreq *) rq; |
| 4451 |
NDIS_802_11_BSSID_LIST_EX *pBssidList = NULL; |
| 4452 |
PNDIS_WLAN_BSSID_EX pBss; |
| 4453 |
NDIS_802_11_SSID Ssid; |
| 4454 |
NDIS_802_11_CONFIGURATION *pConfiguration = NULL; |
| 4455 |
RT_802_11_LINK_STATUS *pLinkStatus = NULL; |
| 4456 |
RT_802_11_STA_CONFIG *pStaConfig = NULL; |
| 4457 |
NDIS_802_11_STATISTICS *pStatistics = NULL; |
| 4458 |
NDIS_802_11_RTS_THRESHOLD RtsThresh; |
| 4459 |
NDIS_802_11_FRAGMENTATION_THRESHOLD FragThresh; |
| 4460 |
NDIS_802_11_POWER_MODE PowerMode; |
| 4461 |
NDIS_802_11_NETWORK_INFRASTRUCTURE BssType; |
| 4462 |
RT_802_11_PREAMBLE PreamType; |
| 4463 |
NDIS_802_11_AUTHENTICATION_MODE AuthMode; |
| 4464 |
NDIS_802_11_WEP_STATUS WepStatus; |
| 4465 |
NDIS_MEDIA_STATE MediaState; |
| 4466 |
ULONG BssBufSize, ulInfo=0, NetworkTypeList[4], apsd = 0; |
| 4467 |
USHORT BssLen = 0; |
| 4468 |
PUCHAR pBuf = NULL, pPtr; |
| 4469 |
INT Status = NDIS_STATUS_SUCCESS; |
| 4470 |
UINT we_version_compiled; |
| 4471 |
UCHAR i, Padding = 0; |
| 4472 |
BOOLEAN RadioState; |
| 4473 |
UCHAR driverVersion[8]; |
| 4474 |
OID_SET_HT_PHYMODE *pHTPhyMode = NULL; |
| 4475 |
|
| 4476 |
switch(cmd) |
| 4477 |
{ |
| 4478 |
case RT_OID_DEVICE_NAME: |
| 4479 |
wrq->u.data.length = sizeof(STA_NIC_DEVICE_NAME); |
| 4480 |
Status = copy_to_user(wrq->u.data.pointer, STA_NIC_DEVICE_NAME, wrq->u.data.length); |
| 4481 |
break; |
| 4482 |
case RT_OID_VERSION_INFO: |
| 4483 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_VERSION_INFO \n")); |
| 4484 |
wrq->u.data.length = 8*sizeof(UCHAR); |
| 4485 |
sprintf(&driverVersion[0], "%s", STA_DRIVER_VERSION); |
| 4486 |
driverVersion[7] = '\0'; |
| 4487 |
if (copy_to_user(wrq->u.data.pointer, &driverVersion, wrq->u.data.length)) |
| 4488 |
{ |
| 4489 |
Status = -EFAULT; |
| 4490 |
} |
| 4491 |
break; |
| 4492 |
case OID_802_11_BSSID_LIST: |
| 4493 |
if (RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) |
| 4494 |
{ |
| 4495 |
/* |
| 4496 |
* Still scanning, indicate the caller should try again. |
| 4497 |
*/ |
| 4498 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_BSSID_LIST (Still scanning)\n")); |
| 4499 |
return -EAGAIN; |
| 4500 |
} |
| 4501 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_BSSID_LIST (%d BSS returned)\n",pAdapter->ScanTab.BssNr)); |
| 4502 |
pAdapter->StaCfg.bScanReqIsFromWebUI = FALSE; |
| 4503 |
// Claculate total buffer size required |
| 4504 |
BssBufSize = sizeof(ULONG); |
| 4505 |
|
| 4506 |
for (i = 0; i < pAdapter->ScanTab.BssNr; i++) |
| 4507 |
{ |
| 4508 |
// Align pointer to 4 bytes boundary. |
| 4509 |
//Padding = 4 - (pAdapter->ScanTab.BssEntry[i].VarIELen & 0x0003); |
| 4510 |
//if (Padding == 4) |
| 4511 |
// Padding = 0; |
| 4512 |
BssBufSize += (sizeof(NDIS_WLAN_BSSID_EX) - 1 + sizeof(NDIS_802_11_FIXED_IEs) + pAdapter->ScanTab.BssEntry[i].VarIELen + Padding); |
| 4513 |
} |
| 4514 |
|
| 4515 |
// For safety issue, we add 256 bytes just in case |
| 4516 |
BssBufSize += 256; |
| 4517 |
// Allocate the same size as passed from higher layer |
| 4518 |
pBuf = kmalloc(BssBufSize, MEM_ALLOC_FLAG); |
| 4519 |
if(pBuf == NULL) |
| 4520 |
{ |
| 4521 |
Status = -ENOMEM; |
| 4522 |
break; |
| 4523 |
} |
| 4524 |
// Init 802_11_BSSID_LIST_EX structure |
| 4525 |
NdisZeroMemory(pBuf, BssBufSize); |
| 4526 |
pBssidList = (PNDIS_802_11_BSSID_LIST_EX) pBuf; |
| 4527 |
pBssidList->NumberOfItems = pAdapter->ScanTab.BssNr; |
| 4528 |
|
| 4529 |
// Calculate total buffer length |
| 4530 |
BssLen = 4; // Consist of NumberOfItems |
| 4531 |
// Point to start of NDIS_WLAN_BSSID_EX |
| 4532 |
// pPtr = pBuf + sizeof(ULONG); |
| 4533 |
pPtr = (PUCHAR) &pBssidList->Bssid[0]; |
| 4534 |
for (i = 0; i < pAdapter->ScanTab.BssNr; i++) |
| 4535 |
{ |
| 4536 |
pBss = (PNDIS_WLAN_BSSID_EX) pPtr; |
| 4537 |
NdisMoveMemory(&pBss->MacAddress, &pAdapter->ScanTab.BssEntry[i].Bssid, MAC_ADDR_LEN); |
| 4538 |
if ((pAdapter->ScanTab.BssEntry[i].Hidden == 1) && (pAdapter->StaCfg.bShowHiddenSSID == FALSE)) |
| 4539 |
{ |
| 4540 |
// |
| 4541 |
// We must return this SSID during 4way handshaking, otherwise Aegis will failed to parse WPA infomation |
| 4542 |
// and then failed to send EAPOl farame. |
| 4543 |
// |
| 4544 |
if ((pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) && (pAdapter->StaCfg.PortSecured != WPA_802_1X_PORT_SECURED)) |
| 4545 |
{ |
| 4546 |
pBss->Ssid.SsidLength = pAdapter->ScanTab.BssEntry[i].SsidLen; |
| 4547 |
NdisMoveMemory(pBss->Ssid.Ssid, pAdapter->ScanTab.BssEntry[i].Ssid, pAdapter->ScanTab.BssEntry[i].SsidLen); |
| 4548 |
} |
| 4549 |
else |
| 4550 |
pBss->Ssid.SsidLength = 0; |
| 4551 |
} |
| 4552 |
else |
| 4553 |
{ |
| 4554 |
pBss->Ssid.SsidLength = pAdapter->ScanTab.BssEntry[i].SsidLen; |
| 4555 |
NdisMoveMemory(pBss->Ssid.Ssid, pAdapter->ScanTab.BssEntry[i].Ssid, pAdapter->ScanTab.BssEntry[i].SsidLen); |
| 4556 |
} |
| 4557 |
pBss->Privacy = pAdapter->ScanTab.BssEntry[i].Privacy; |
| 4558 |
pBss->Rssi = pAdapter->ScanTab.BssEntry[i].Rssi - pAdapter->BbpRssiToDbmDelta; |
| 4559 |
pBss->NetworkTypeInUse = NetworkTypeInUseSanity(&pAdapter->ScanTab.BssEntry[i]); |
| 4560 |
pBss->Configuration.Length = sizeof(NDIS_802_11_CONFIGURATION); |
| 4561 |
pBss->Configuration.BeaconPeriod = pAdapter->ScanTab.BssEntry[i].BeaconPeriod; |
| 4562 |
pBss->Configuration.ATIMWindow = pAdapter->ScanTab.BssEntry[i].AtimWin; |
| 4563 |
|
| 4564 |
MAP_CHANNEL_ID_TO_KHZ(pAdapter->ScanTab.BssEntry[i].Channel, pBss->Configuration.DSConfig); |
| 4565 |
|
| 4566 |
if (pAdapter->ScanTab.BssEntry[i].BssType == BSS_INFRA) |
| 4567 |
pBss->InfrastructureMode = Ndis802_11Infrastructure; |
| 4568 |
else |
| 4569 |
pBss->InfrastructureMode = Ndis802_11IBSS; |
| 4570 |
|
| 4571 |
NdisMoveMemory(pBss->SupportedRates, pAdapter->ScanTab.BssEntry[i].SupRate, pAdapter->ScanTab.BssEntry[i].SupRateLen); |
| 4572 |
NdisMoveMemory(pBss->SupportedRates + pAdapter->ScanTab.BssEntry[i].SupRateLen, |
| 4573 |
pAdapter->ScanTab.BssEntry[i].ExtRate, |
| 4574 |
pAdapter->ScanTab.BssEntry[i].ExtRateLen); |
| 4575 |
|
| 4576 |
if (pAdapter->ScanTab.BssEntry[i].VarIELen == 0) |
| 4577 |
{ |
| 4578 |
pBss->IELength = sizeof(NDIS_802_11_FIXED_IEs); |
| 4579 |
NdisMoveMemory(pBss->IEs, &pAdapter->ScanTab.BssEntry[i].FixIEs, sizeof(NDIS_802_11_FIXED_IEs)); |
| 4580 |
pPtr = pPtr + sizeof(NDIS_WLAN_BSSID_EX) - 1 + sizeof(NDIS_802_11_FIXED_IEs); |
| 4581 |
} |
| 4582 |
else |
| 4583 |
{ |
| 4584 |
pBss->IELength = (ULONG)(sizeof(NDIS_802_11_FIXED_IEs) + pAdapter->ScanTab.BssEntry[i].VarIELen); |
| 4585 |
pPtr = pPtr + sizeof(NDIS_WLAN_BSSID_EX) - 1 + sizeof(NDIS_802_11_FIXED_IEs); |
| 4586 |
NdisMoveMemory(pBss->IEs, &pAdapter->ScanTab.BssEntry[i].FixIEs, sizeof(NDIS_802_11_FIXED_IEs)); |
| 4587 |
NdisMoveMemory(pBss->IEs + sizeof(NDIS_802_11_FIXED_IEs), pAdapter->ScanTab.BssEntry[i].VarIEs, pAdapter->ScanTab.BssEntry[i].VarIELen); |
| 4588 |
pPtr += pAdapter->ScanTab.BssEntry[i].VarIELen; |
| 4589 |
} |
| 4590 |
pBss->Length = (ULONG)(sizeof(NDIS_WLAN_BSSID_EX) - 1 + sizeof(NDIS_802_11_FIXED_IEs) + pAdapter->ScanTab.BssEntry[i].VarIELen + Padding); |
| 4591 |
|
| 4592 |
#if WIRELESS_EXT < 17 |
| 4593 |
if ((BssLen + pBss->Length) < wrq->u.data.length) |
| 4594 |
BssLen += pBss->Length; |
| 4595 |
else |
| 4596 |
{ |
| 4597 |
pBssidList->NumberOfItems = i; |
| 4598 |
break; |
| 4599 |
} |
| 4600 |
#else |
| 4601 |
BssLen += pBss->Length; |
| 4602 |
#endif |
| 4603 |
} |
| 4604 |
|
| 4605 |
#if WIRELESS_EXT < 17 |
| 4606 |
wrq->u.data.length = BssLen; |
| 4607 |
#else |
| 4608 |
if (BssLen > wrq->u.data.length) |
| 4609 |
{ |
| 4610 |
kfree(pBssidList); |
| 4611 |
return -E2BIG; |
| 4612 |
} |
| 4613 |
else |
| 4614 |
wrq->u.data.length = BssLen; |
| 4615 |
#endif |
| 4616 |
Status = copy_to_user(wrq->u.data.pointer, pBssidList, BssLen); |
| 4617 |
kfree(pBssidList); |
| 4618 |
break; |
| 4619 |
case OID_802_3_CURRENT_ADDRESS: |
| 4620 |
wrq->u.data.length = MAC_ADDR_LEN; |
| 4621 |
Status = copy_to_user(wrq->u.data.pointer, &pAdapter->CurrentAddress, wrq->u.data.length); |
| 4622 |
break; |
| 4623 |
case OID_GEN_MEDIA_CONNECT_STATUS: |
| 4624 |
if (pAdapter->IndicateMediaState == NdisMediaStateConnected) |
| 4625 |
MediaState = NdisMediaStateConnected; |
| 4626 |
else |
| 4627 |
MediaState = NdisMediaStateDisconnected; |
| 4628 |
|
| 4629 |
wrq->u.data.length = sizeof(NDIS_MEDIA_STATE); |
| 4630 |
Status = copy_to_user(wrq->u.data.pointer, &MediaState, wrq->u.data.length); |
| 4631 |
break; |
| 4632 |
case OID_802_11_BSSID: |
| 4633 |
if (INFRA_ON(pAdapter) || ADHOC_ON(pAdapter)) |
| 4634 |
{ |
| 4635 |
Status = copy_to_user(wrq->u.data.pointer, &pAdapter->CommonCfg.Bssid, sizeof(NDIS_802_11_MAC_ADDRESS)); |
| 4636 |
|
| 4637 |
} |
| 4638 |
else |
| 4639 |
{ |
| 4640 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_BSSID(=EMPTY)\n")); |
| 4641 |
Status = -ENOTCONN; |
| 4642 |
} |
| 4643 |
break; |
| 4644 |
case OID_802_11_SSID: |
| 4645 |
NdisZeroMemory(&Ssid, sizeof(NDIS_802_11_SSID)); |
| 4646 |
NdisZeroMemory(Ssid.Ssid, MAX_LEN_OF_SSID); |
| 4647 |
Ssid.SsidLength = pAdapter->CommonCfg.SsidLen; |
| 4648 |
memcpy(Ssid.Ssid, pAdapter->CommonCfg.Ssid, Ssid.SsidLength); |
| 4649 |
wrq->u.data.length = sizeof(NDIS_802_11_SSID); |
| 4650 |
Status = copy_to_user(wrq->u.data.pointer, &Ssid, wrq->u.data.length); |
| 4651 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_SSID (Len=%d, ssid=%s)\n", Ssid.SsidLength,Ssid.Ssid)); |
| 4652 |
break; |
| 4653 |
case RT_OID_802_11_QUERY_LINK_STATUS: |
| 4654 |
pLinkStatus = (RT_802_11_LINK_STATUS *) kmalloc(sizeof(RT_802_11_LINK_STATUS), MEM_ALLOC_FLAG); |
| 4655 |
if (pLinkStatus) |
| 4656 |
{ |
| 4657 |
pLinkStatus->CurrTxRate = RateIdTo500Kbps[pAdapter->CommonCfg.TxRate]; // unit : 500 kbps |
| 4658 |
pLinkStatus->ChannelQuality = pAdapter->Mlme.ChannelQuality; |
| 4659 |
pLinkStatus->RxByteCount = pAdapter->RalinkCounters.ReceivedByteCount; |
| 4660 |
pLinkStatus->TxByteCount = pAdapter->RalinkCounters.TransmittedByteCount; |
| 4661 |
pLinkStatus->CentralChannel = pAdapter->CommonCfg.CentralChannel; |
| 4662 |
wrq->u.data.length = sizeof(RT_802_11_LINK_STATUS); |
| 4663 |
Status = copy_to_user(wrq->u.data.pointer, pLinkStatus, wrq->u.data.length); |
| 4664 |
kfree(pLinkStatus); |
| 4665 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_LINK_STATUS\n")); |
| 4666 |
} |
| 4667 |
else |
| 4668 |
{ |
| 4669 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_LINK_STATUS(kmalloc failed)\n")); |
| 4670 |
Status = -EFAULT; |
| 4671 |
} |
| 4672 |
break; |
| 4673 |
case OID_802_11_CONFIGURATION: |
| 4674 |
pConfiguration = (NDIS_802_11_CONFIGURATION *) kmalloc(sizeof(NDIS_802_11_CONFIGURATION), MEM_ALLOC_FLAG); |
| 4675 |
if (pConfiguration) |
| 4676 |
{ |
| 4677 |
pConfiguration->Length = sizeof(NDIS_802_11_CONFIGURATION); |
| 4678 |
pConfiguration->BeaconPeriod = pAdapter->CommonCfg.BeaconPeriod; |
| 4679 |
pConfiguration->ATIMWindow = pAdapter->StaActive.AtimWin; |
| 4680 |
MAP_CHANNEL_ID_TO_KHZ(pAdapter->CommonCfg.Channel, pConfiguration->DSConfig); |
| 4681 |
wrq->u.data.length = sizeof(NDIS_802_11_CONFIGURATION); |
| 4682 |
Status = copy_to_user(wrq->u.data.pointer, pConfiguration, wrq->u.data.length); |
| 4683 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_CONFIGURATION(BeaconPeriod=%ld,AtimW=%ld,Channel=%d) \n", |
| 4684 |
pConfiguration->BeaconPeriod, pConfiguration->ATIMWindow, pAdapter->CommonCfg.Channel)); |
| 4685 |
kfree(pConfiguration); |
| 4686 |
} |
| 4687 |
else |
| 4688 |
{ |
| 4689 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_CONFIGURATION(kmalloc failed)\n")); |
| 4690 |
Status = -EFAULT; |
| 4691 |
} |
| 4692 |
break; |
| 4693 |
case RT_OID_802_11_SNR_0: |
| 4694 |
if ((pAdapter->StaCfg.LastSNR0 > 0)) |
| 4695 |
{ |
| 4696 |
ulInfo = ((0xeb - pAdapter->StaCfg.LastSNR0) * 3) / 16 ; |
| 4697 |
wrq->u.data.length = sizeof(ulInfo); |
| 4698 |
Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length); |
| 4699 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_SNR_0(0x=%lx)\n", ulInfo)); |
| 4700 |
} |
| 4701 |
else |
| 4702 |
Status = -EFAULT; |
| 4703 |
break; |
| 4704 |
case RT_OID_802_11_SNR_1: |
| 4705 |
if ((pAdapter->Antenna.field.RxPath > 1) && |
| 4706 |
(pAdapter->StaCfg.LastSNR1 > 0)) |
| 4707 |
{ |
| 4708 |
ulInfo = ((0xeb - pAdapter->StaCfg.LastSNR1) * 3) / 16 ; |
| 4709 |
wrq->u.data.length = sizeof(ulInfo); |
| 4710 |
Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length); |
| 4711 |
DBGPRINT(RT_DEBUG_TRACE,("Query::RT_OID_802_11_SNR_1(0x=%lx)\n",ulInfo)); |
| 4712 |
} |
| 4713 |
else |
| 4714 |
Status = -EFAULT; |
| 4715 |
DBGPRINT(RT_DEBUG_TRACE,("Query::RT_OID_802_11_SNR_1(pAdapter->StaCfg.LastSNR1=%d)\n",pAdapter->StaCfg.LastSNR1)); |
| 4716 |
break; |
| 4717 |
case OID_802_11_RSSI_TRIGGER: |
| 4718 |
ulInfo = pAdapter->StaCfg.RssiSample.LastRssi0 - pAdapter->BbpRssiToDbmDelta; |
| 4719 |
wrq->u.data.length = sizeof(ulInfo); |
| 4720 |
Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length); |
| 4721 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_RSSI_TRIGGER(=%ld)\n", ulInfo)); |
| 4722 |
break; |
| 4723 |
case OID_802_11_RSSI: |
| 4724 |
case RT_OID_802_11_RSSI: |
| 4725 |
ulInfo = pAdapter->StaCfg.RssiSample.LastRssi0; |
| 4726 |
wrq->u.data.length = sizeof(ulInfo); |
| 4727 |
Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length); |
| 4728 |
break; |
| 4729 |
case RT_OID_802_11_RSSI_1: |
| 4730 |
ulInfo = pAdapter->StaCfg.RssiSample.LastRssi1; |
| 4731 |
wrq->u.data.length = sizeof(ulInfo); |
| 4732 |
Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length); |
| 4733 |
break; |
| 4734 |
case RT_OID_802_11_RSSI_2: |
| 4735 |
ulInfo = pAdapter->StaCfg.RssiSample.LastRssi2; |
| 4736 |
wrq->u.data.length = sizeof(ulInfo); |
| 4737 |
Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length); |
| 4738 |
break; |
| 4739 |
case OID_802_11_STATISTICS: |
| 4740 |
pStatistics = (NDIS_802_11_STATISTICS *) kmalloc(sizeof(NDIS_802_11_STATISTICS), MEM_ALLOC_FLAG); |
| 4741 |
if (pStatistics) |
| 4742 |
{ |
| 4743 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_STATISTICS \n")); |
| 4744 |
// add the most up-to-date h/w raw counters into software counters |
| 4745 |
NICUpdateRawCounters(pAdapter); |
| 4746 |
|
| 4747 |
// Sanity check for calculation of sucessful count |
| 4748 |
if (pAdapter->WlanCounters.TransmittedFragmentCount.QuadPart < pAdapter->WlanCounters.RetryCount.QuadPart) |
| 4749 |
pAdapter->WlanCounters.TransmittedFragmentCount.QuadPart = pAdapter->WlanCounters.RetryCount.QuadPart; |
| 4750 |
|
| 4751 |
pStatistics->TransmittedFragmentCount.QuadPart = pAdapter->WlanCounters.TransmittedFragmentCount.QuadPart; |
| 4752 |
pStatistics->MulticastTransmittedFrameCount.QuadPart = pAdapter->WlanCounters.MulticastTransmittedFrameCount.QuadPart; |
| 4753 |
pStatistics->FailedCount.QuadPart = pAdapter->WlanCounters.FailedCount.QuadPart; |
| 4754 |
pStatistics->RetryCount.QuadPart = pAdapter->WlanCounters.RetryCount.QuadPart; |
| 4755 |
pStatistics->MultipleRetryCount.QuadPart = pAdapter->WlanCounters.MultipleRetryCount.QuadPart; |
| 4756 |
pStatistics->RTSSuccessCount.QuadPart = pAdapter->WlanCounters.RTSSuccessCount.QuadPart; |
| 4757 |
pStatistics->RTSFailureCount.QuadPart = pAdapter->WlanCounters.RTSFailureCount.QuadPart; |
| 4758 |
pStatistics->ACKFailureCount.QuadPart = pAdapter->WlanCounters.ACKFailureCount.QuadPart; |
| 4759 |
pStatistics->FrameDuplicateCount.QuadPart = pAdapter->WlanCounters.FrameDuplicateCount.QuadPart; |
| 4760 |
pStatistics->ReceivedFragmentCount.QuadPart = pAdapter->WlanCounters.ReceivedFragmentCount.QuadPart; |
| 4761 |
pStatistics->MulticastReceivedFrameCount.QuadPart = pAdapter->WlanCounters.MulticastReceivedFrameCount.QuadPart; |
| 4762 |
#ifdef DBG |
| 4763 |
pStatistics->FCSErrorCount = pAdapter->RalinkCounters.RealFcsErrCount; |
| 4764 |
#else |
| 4765 |
pStatistics->FCSErrorCount.QuadPart = pAdapter->WlanCounters.FCSErrorCount.QuadPart; |
| 4766 |
pStatistics->FrameDuplicateCount.u.LowPart = pAdapter->WlanCounters.FrameDuplicateCount.u.LowPart / 100; |
| 4767 |
#endif |
| 4768 |
wrq->u.data.length = sizeof(NDIS_802_11_STATISTICS); |
| 4769 |
Status = copy_to_user(wrq->u.data.pointer, pStatistics, wrq->u.data.length); |
| 4770 |
kfree(pStatistics); |
| 4771 |
} |
| 4772 |
else |
| 4773 |
{ |
| 4774 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_STATISTICS(kmalloc failed)\n")); |
| 4775 |
Status = -EFAULT; |
| 4776 |
} |
| 4777 |
break; |
| 4778 |
case OID_GEN_RCV_OK: |
| 4779 |
ulInfo = pAdapter->Counters8023.GoodReceives; |
| 4780 |
wrq->u.data.length = sizeof(ulInfo); |
| 4781 |
Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length); |
| 4782 |
break; |
| 4783 |
case OID_GEN_RCV_NO_BUFFER: |
| 4784 |
ulInfo = pAdapter->Counters8023.RxNoBuffer; |
| 4785 |
wrq->u.data.length = sizeof(ulInfo); |
| 4786 |
Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length); |
| 4787 |
break; |
| 4788 |
case RT_OID_802_11_PHY_MODE: |
| 4789 |
ulInfo = (ULONG)pAdapter->CommonCfg.PhyMode; |
| 4790 |
wrq->u.data.length = sizeof(ulInfo); |
| 4791 |
Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length); |
| 4792 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_PHY_MODE (=%ld)\n", ulInfo)); |
| 4793 |
break; |
| 4794 |
case RT_OID_802_11_STA_CONFIG: |
| 4795 |
pStaConfig = (RT_802_11_STA_CONFIG *) kmalloc(sizeof(RT_802_11_STA_CONFIG), MEM_ALLOC_FLAG); |
| 4796 |
if (pStaConfig) |
| 4797 |
{ |
| 4798 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_STA_CONFIG\n")); |
| 4799 |
pStaConfig->EnableTxBurst = pAdapter->CommonCfg.bEnableTxBurst; |
| 4800 |
pStaConfig->EnableTurboRate = 0; |
| 4801 |
pStaConfig->UseBGProtection = pAdapter->CommonCfg.UseBGProtection; |
| 4802 |
pStaConfig->UseShortSlotTime = pAdapter->CommonCfg.bUseShortSlotTime; |
| 4803 |
//pStaConfig->AdhocMode = pAdapter->StaCfg.AdhocMode; |
| 4804 |
pStaConfig->HwRadioStatus = (pAdapter->StaCfg.bHwRadio == TRUE) ? 1 : 0; |
| 4805 |
pStaConfig->Rsv1 = 0; |
| 4806 |
pStaConfig->SystemErrorBitmap = pAdapter->SystemErrorBitmap; |
| 4807 |
wrq->u.data.length = sizeof(RT_802_11_STA_CONFIG); |
| 4808 |
Status = copy_to_user(wrq->u.data.pointer, pStaConfig, wrq->u.data.length); |
| 4809 |
kfree(pStaConfig); |
| 4810 |
} |
| 4811 |
else |
| 4812 |
{ |
| 4813 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_STA_CONFIG(kmalloc failed)\n")); |
| 4814 |
Status = -EFAULT; |
| 4815 |
} |
| 4816 |
break; |
| 4817 |
case OID_802_11_RTS_THRESHOLD: |
| 4818 |
RtsThresh = pAdapter->CommonCfg.RtsThreshold; |
| 4819 |
wrq->u.data.length = sizeof(RtsThresh); |
| 4820 |
Status = copy_to_user(wrq->u.data.pointer, &RtsThresh, wrq->u.data.length); |
| 4821 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_RTS_THRESHOLD(=%ld)\n", RtsThresh)); |
| 4822 |
break; |
| 4823 |
case OID_802_11_FRAGMENTATION_THRESHOLD: |
| 4824 |
FragThresh = pAdapter->CommonCfg.FragmentThreshold; |
| 4825 |
if (pAdapter->CommonCfg.bUseZeroToDisableFragment == TRUE) |
| 4826 |
FragThresh = 0; |
| 4827 |
wrq->u.data.length = sizeof(FragThresh); |
| 4828 |
Status = copy_to_user(wrq->u.data.pointer, &FragThresh, wrq->u.data.length); |
| 4829 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_FRAGMENTATION_THRESHOLD(=%ld)\n", FragThresh)); |
| 4830 |
break; |
| 4831 |
case OID_802_11_POWER_MODE: |
| 4832 |
PowerMode = pAdapter->StaCfg.WindowsPowerMode; |
| 4833 |
wrq->u.data.length = sizeof(PowerMode); |
| 4834 |
Status = copy_to_user(wrq->u.data.pointer, &PowerMode, wrq->u.data.length); |
| 4835 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_POWER_MODE(=%d)\n", PowerMode)); |
| 4836 |
break; |
| 4837 |
case RT_OID_802_11_RADIO: |
| 4838 |
RadioState = (BOOLEAN) pAdapter->StaCfg.bSwRadio; |
| 4839 |
wrq->u.data.length = sizeof(RadioState); |
| 4840 |
Status = copy_to_user(wrq->u.data.pointer, &RadioState, wrq->u.data.length); |
| 4841 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_RADIO (=%d)\n", RadioState)); |
| 4842 |
break; |
| 4843 |
case OID_802_11_INFRASTRUCTURE_MODE: |
| 4844 |
if (pAdapter->StaCfg.BssType == BSS_ADHOC) |
| 4845 |
BssType = Ndis802_11IBSS; |
| 4846 |
else if (pAdapter->StaCfg.BssType == BSS_INFRA) |
| 4847 |
BssType = Ndis802_11Infrastructure; |
| 4848 |
else if (pAdapter->StaCfg.BssType == BSS_MONITOR) |
| 4849 |
BssType = Ndis802_11Monitor; |
| 4850 |
else |
| 4851 |
BssType = Ndis802_11AutoUnknown; |
| 4852 |
|
| 4853 |
wrq->u.data.length = sizeof(BssType); |
| 4854 |
Status = copy_to_user(wrq->u.data.pointer, &BssType, wrq->u.data.length); |
| 4855 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_INFRASTRUCTURE_MODE(=%d)\n", BssType)); |
| 4856 |
break; |
| 4857 |
case RT_OID_802_11_PREAMBLE: |
| 4858 |
PreamType = pAdapter->CommonCfg.TxPreamble; |
| 4859 |
wrq->u.data.length = sizeof(PreamType); |
| 4860 |
Status = copy_to_user(wrq->u.data.pointer, &PreamType, wrq->u.data.length); |
| 4861 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_PREAMBLE(=%d)\n", PreamType)); |
| 4862 |
break; |
| 4863 |
case OID_802_11_AUTHENTICATION_MODE: |
| 4864 |
AuthMode = pAdapter->StaCfg.AuthMode; |
| 4865 |
wrq->u.data.length = sizeof(AuthMode); |
| 4866 |
Status = copy_to_user(wrq->u.data.pointer, &AuthMode, wrq->u.data.length); |
| 4867 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_AUTHENTICATION_MODE(=%d)\n", AuthMode)); |
| 4868 |
break; |
| 4869 |
case OID_802_11_WEP_STATUS: |
| 4870 |
WepStatus = pAdapter->StaCfg.WepStatus; |
| 4871 |
wrq->u.data.length = sizeof(WepStatus); |
| 4872 |
Status = copy_to_user(wrq->u.data.pointer, &WepStatus, wrq->u.data.length); |
| 4873 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_WEP_STATUS(=%d)\n", WepStatus)); |
| 4874 |
break; |
| 4875 |
case OID_802_11_TX_POWER_LEVEL: |
| 4876 |
wrq->u.data.length = sizeof(ULONG); |
| 4877 |
Status = copy_to_user(wrq->u.data.pointer, &pAdapter->CommonCfg.TxPower, wrq->u.data.length); |
| 4878 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_TX_POWER_LEVEL %x\n",pAdapter->CommonCfg.TxPower)); |
| 4879 |
break; |
| 4880 |
case RT_OID_802_11_TX_POWER_LEVEL_1: |
| 4881 |
wrq->u.data.length = sizeof(ULONG); |
| 4882 |
Status = copy_to_user(wrq->u.data.pointer, &pAdapter->CommonCfg.TxPowerPercentage, wrq->u.data.length); |
| 4883 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_TX_POWER_LEVEL_1 (=%ld)\n", pAdapter->CommonCfg.TxPowerPercentage)); |
| 4884 |
break; |
| 4885 |
case OID_802_11_NETWORK_TYPES_SUPPORTED: |
| 4886 |
if ((pAdapter->RfIcType == RFIC_2850) || (pAdapter->RfIcType == RFIC_2750)) |
| 4887 |
{ |
| 4888 |
NetworkTypeList[0] = 3; // NumberOfItems = 3 |
| 4889 |
NetworkTypeList[1] = Ndis802_11DS; // NetworkType[1] = 11b |
| 4890 |
NetworkTypeList[2] = Ndis802_11OFDM24; // NetworkType[2] = 11g |
| 4891 |
NetworkTypeList[3] = Ndis802_11OFDM5; // NetworkType[3] = 11a |
| 4892 |
wrq->u.data.length = 16; |
| 4893 |
Status = copy_to_user(wrq->u.data.pointer, &NetworkTypeList[0], wrq->u.data.length); |
| 4894 |
} |
| 4895 |
else |
| 4896 |
{ |
| 4897 |
NetworkTypeList[0] = 2; // NumberOfItems = 2 |
| 4898 |
NetworkTypeList[1] = Ndis802_11DS; // NetworkType[1] = 11b |
| 4899 |
NetworkTypeList[2] = Ndis802_11OFDM24; // NetworkType[2] = 11g |
| 4900 |
wrq->u.data.length = 12; |
| 4901 |
Status = copy_to_user(wrq->u.data.pointer, &NetworkTypeList[0], wrq->u.data.length); |
| 4902 |
} |
| 4903 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_NETWORK_TYPES_SUPPORTED\n")); |
| 4904 |
break; |
| 4905 |
case OID_802_11_NETWORK_TYPE_IN_USE: |
| 4906 |
wrq->u.data.length = sizeof(ULONG); |
| 4907 |
if (pAdapter->CommonCfg.PhyMode == PHY_11A) |
| 4908 |
ulInfo = Ndis802_11OFDM5; |
| 4909 |
else if ((pAdapter->CommonCfg.PhyMode == PHY_11BG_MIXED) || (pAdapter->CommonCfg.PhyMode == PHY_11G)) |
| 4910 |
ulInfo = Ndis802_11OFDM24; |
| 4911 |
else |
| 4912 |
ulInfo = Ndis802_11DS; |
| 4913 |
Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length); |
| 4914 |
break; |
| 4915 |
case RT_OID_802_11_QUERY_LAST_RX_RATE: |
| 4916 |
ulInfo = (ULONG)pAdapter->LastRxRate; |
| 4917 |
wrq->u.data.length = sizeof(ulInfo); |
| 4918 |
Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length); |
| 4919 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_LAST_RX_RATE (=%ld)\n", ulInfo)); |
| 4920 |
break; |
| 4921 |
case RT_OID_802_11_QUERY_LAST_TX_RATE: |
| 4922 |
//ulInfo = (ULONG)pAdapter->LastTxRate; |
| 4923 |
ulInfo = (ULONG)pAdapter->MacTab.Content[BSSID_WCID].HTPhyMode.word; |
| 4924 |
wrq->u.data.length = sizeof(ulInfo); |
| 4925 |
Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length); |
| 4926 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_LAST_TX_RATE (=%lx)\n", ulInfo)); |
| 4927 |
break; |
| 4928 |
case RT_OID_802_11_QUERY_EEPROM_VERSION: |
| 4929 |
wrq->u.data.length = sizeof(ULONG); |
| 4930 |
Status = copy_to_user(wrq->u.data.pointer, &pAdapter->EepromVersion, wrq->u.data.length); |
| 4931 |
break; |
| 4932 |
case RT_OID_802_11_QUERY_FIRMWARE_VERSION: |
| 4933 |
wrq->u.data.length = sizeof(ULONG); |
| 4934 |
Status = copy_to_user(wrq->u.data.pointer, &pAdapter->FirmwareVersion, wrq->u.data.length); |
| 4935 |
break; |
| 4936 |
case RT_OID_802_11_QUERY_NOISE_LEVEL: |
| 4937 |
wrq->u.data.length = sizeof(UCHAR); |
| 4938 |
Status = copy_to_user(wrq->u.data.pointer, &pAdapter->BbpWriteLatch[66], wrq->u.data.length); |
| 4939 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_NOISE_LEVEL (=%d)\n", pAdapter->BbpWriteLatch[66])); |
| 4940 |
break; |
| 4941 |
case RT_OID_802_11_EXTRA_INFO: |
| 4942 |
wrq->u.data.length = sizeof(ULONG); |
| 4943 |
Status = copy_to_user(wrq->u.data.pointer, &pAdapter->ExtraInfo, wrq->u.data.length); |
| 4944 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_EXTRA_INFO (=%ld)\n", pAdapter->ExtraInfo)); |
| 4945 |
break; |
| 4946 |
case RT_OID_WE_VERSION_COMPILED: |
| 4947 |
wrq->u.data.length = sizeof(UINT); |
| 4948 |
we_version_compiled = WIRELESS_EXT; |
| 4949 |
Status = copy_to_user(wrq->u.data.pointer, &we_version_compiled, wrq->u.data.length); |
| 4950 |
break; |
| 4951 |
case RT_OID_802_11_QUERY_APSD_SETTING: |
| 4952 |
apsd = (pAdapter->CommonCfg.bAPSDCapable | (pAdapter->CommonCfg.bAPSDAC_BE << 1) | (pAdapter->CommonCfg.bAPSDAC_BK << 2) |
| 4953 |
| (pAdapter->CommonCfg.bAPSDAC_VI << 3) | (pAdapter->CommonCfg.bAPSDAC_VO << 4) | (pAdapter->CommonCfg.MaxSPLength << 5)); |
| 4954 |
|
| 4955 |
wrq->u.data.length = sizeof(ULONG); |
| 4956 |
Status = copy_to_user(wrq->u.data.pointer, &apsd, wrq->u.data.length); |
| 4957 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_APSD_SETTING (=0x%lx,APSDCap=%d,AC_BE=%d,AC_BK=%d,AC_VI=%d,AC_VO=%d,MAXSPLen=%d)\n", |
| 4958 |
apsd,pAdapter->CommonCfg.bAPSDCapable,pAdapter->CommonCfg.bAPSDAC_BE,pAdapter->CommonCfg.bAPSDAC_BK,pAdapter->CommonCfg.bAPSDAC_VI,pAdapter->CommonCfg.bAPSDAC_VO,pAdapter->CommonCfg.MaxSPLength)); |
| 4959 |
break; |
| 4960 |
case RT_OID_802_11_QUERY_APSD_PSM: |
| 4961 |
wrq->u.data.length = sizeof(ULONG); |
| 4962 |
Status = copy_to_user(wrq->u.data.pointer, &pAdapter->CommonCfg.bAPSDForcePowerSave, wrq->u.data.length); |
| 4963 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_APSD_PSM (=%d)\n", pAdapter->CommonCfg.bAPSDForcePowerSave)); |
| 4964 |
break; |
| 4965 |
case RT_OID_802_11_QUERY_WMM: |
| 4966 |
wrq->u.data.length = sizeof(BOOLEAN); |
| 4967 |
Status = copy_to_user(wrq->u.data.pointer, &pAdapter->CommonCfg.bWmmCapable, wrq->u.data.length); |
| 4968 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_WMM (=%d)\n", pAdapter->CommonCfg.bWmmCapable)); |
| 4969 |
break; |
| 4970 |
case RT_OID_NEW_DRIVER: |
| 4971 |
{ |
| 4972 |
UCHAR enabled = 1; |
| 4973 |
wrq->u.data.length = sizeof(UCHAR); |
| 4974 |
Status = copy_to_user(wrq->u.data.pointer, &enabled, wrq->u.data.length); |
| 4975 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_NEW_DRIVER (=%d)\n", enabled)); |
| 4976 |
} |
| 4977 |
break; |
| 4978 |
case RT_OID_WPA_SUPPLICANT_SUPPORT: |
| 4979 |
wrq->u.data.length = sizeof(UCHAR); |
| 4980 |
Status = copy_to_user(wrq->u.data.pointer, &pAdapter->StaCfg.WpaSupplicantUP, wrq->u.data.length); |
| 4981 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_WPA_SUPPLICANT_SUPPORT (=%d)\n", pAdapter->StaCfg.WpaSupplicantUP)); |
| 4982 |
break; |
| 4983 |
case RT_OID_DRIVER_DEVICE_NAME: |
| 4984 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_DRIVER_DEVICE_NAME \n")); |
| 4985 |
wrq->u.data.length = 16; |
| 4986 |
if (copy_to_user(wrq->u.data.pointer, pAdapter->StaCfg.dev_name, wrq->u.data.length)) |
| 4987 |
{ |
| 4988 |
Status = -EFAULT; |
| 4989 |
} |
| 4990 |
break; |
| 4991 |
case RT_OID_802_11_QUERY_HT_PHYMODE: |
| 4992 |
pHTPhyMode = (OID_SET_HT_PHYMODE *) kmalloc(sizeof(OID_SET_HT_PHYMODE), MEM_ALLOC_FLAG); |
| 4993 |
if (pHTPhyMode) |
| 4994 |
{ |
| 4995 |
pHTPhyMode->PhyMode = pAdapter->CommonCfg.PhyMode; |
| 4996 |
pHTPhyMode->HtMode = (UCHAR)pAdapter->MacTab.Content[BSSID_WCID].HTPhyMode.field.MODE; |
| 4997 |
pHTPhyMode->BW = (UCHAR)pAdapter->MacTab.Content[BSSID_WCID].HTPhyMode.field.BW; |
| 4998 |
pHTPhyMode->MCS= (UCHAR)pAdapter->MacTab.Content[BSSID_WCID].HTPhyMode.field.MCS; |
| 4999 |
pHTPhyMode->SHORTGI= (UCHAR)pAdapter->MacTab.Content[BSSID_WCID].HTPhyMode.field.ShortGI; |
| 5000 |
pHTPhyMode->STBC= (UCHAR)pAdapter->MacTab.Content[BSSID_WCID].HTPhyMode.field.STBC; |
| 5001 |
|
| 5002 |
pHTPhyMode->ExtOffset = ((pAdapter->CommonCfg.CentralChannel < pAdapter->CommonCfg.Channel) ? (EXTCHA_BELOW) : (EXTCHA_ABOVE)); |
| 5003 |
wrq->u.data.length = sizeof(OID_SET_HT_PHYMODE); |
| 5004 |
if (copy_to_user(wrq->u.data.pointer, pHTPhyMode, wrq->u.data.length)) |
| 5005 |
{ |
| 5006 |
Status = -EFAULT; |
| 5007 |
} |
| 5008 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_HT_PHYMODE (PhyMode = %d, MCS =%d, BW = %d, STBC = %d, ExtOffset=%d)\n", |
| 5009 |
pHTPhyMode->HtMode, pHTPhyMode->MCS, pHTPhyMode->BW, pHTPhyMode->STBC, pHTPhyMode->ExtOffset)); |
| 5010 |
DBGPRINT(RT_DEBUG_TRACE, (" MlmeUpdateTxRates (.word = %x )\n", pAdapter->MacTab.Content[BSSID_WCID].HTPhyMode.word)); |
| 5011 |
} |
| 5012 |
else |
| 5013 |
{ |
| 5014 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_STA_CONFIG(kmalloc failed)\n")); |
| 5015 |
Status = -EFAULT; |
| 5016 |
} |
| 5017 |
break; |
| 5018 |
case RT_OID_802_11_COUNTRY_REGION: |
| 5019 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_COUNTRY_REGION \n")); |
| 5020 |
wrq->u.data.length = sizeof(ulInfo); |
| 5021 |
ulInfo = pAdapter->CommonCfg.CountryRegionForABand; |
| 5022 |
ulInfo = (ulInfo << 8)|(pAdapter->CommonCfg.CountryRegion); |
| 5023 |
if (copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length)) |
| 5024 |
{ |
| 5025 |
Status = -EFAULT; |
| 5026 |
} |
| 5027 |
break; |
| 5028 |
case RT_OID_802_11_QUERY_DAT_HT_PHYMODE: |
| 5029 |
pHTPhyMode = (OID_SET_HT_PHYMODE *) kmalloc(sizeof(OID_SET_HT_PHYMODE), MEM_ALLOC_FLAG); |
| 5030 |
if (pHTPhyMode) |
| 5031 |
{ |
| 5032 |
pHTPhyMode->PhyMode = pAdapter->CommonCfg.PhyMode; |
| 5033 |
pHTPhyMode->HtMode = (UCHAR)pAdapter->CommonCfg.RegTransmitSetting.field.HTMODE; |
| 5034 |
pHTPhyMode->BW = (UCHAR)pAdapter->CommonCfg.RegTransmitSetting.field.BW; |
| 5035 |
pHTPhyMode->MCS= (UCHAR)pAdapter->StaCfg.DesiredTransmitSetting.field.MCS; |
| 5036 |
pHTPhyMode->SHORTGI= (UCHAR)pAdapter->CommonCfg.RegTransmitSetting.field.ShortGI; |
| 5037 |
pHTPhyMode->STBC= (UCHAR)pAdapter->CommonCfg.RegTransmitSetting.field.STBC; |
| 5038 |
|
| 5039 |
wrq->u.data.length = sizeof(OID_SET_HT_PHYMODE); |
| 5040 |
if (copy_to_user(wrq->u.data.pointer, pHTPhyMode, wrq->u.data.length)) |
| 5041 |
{ |
| 5042 |
Status = -EFAULT; |
| 5043 |
} |
| 5044 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_HT_PHYMODE (PhyMode = %d, MCS =%d, BW = %d, STBC = %d, ExtOffset=%d)\n", |
| 5045 |
pHTPhyMode->HtMode, pHTPhyMode->MCS, pHTPhyMode->BW, pHTPhyMode->STBC, pHTPhyMode->ExtOffset)); |
| 5046 |
DBGPRINT(RT_DEBUG_TRACE, (" MlmeUpdateTxRates (.word = %x )\n", pAdapter->MacTab.Content[BSSID_WCID].HTPhyMode.word)); |
| 5047 |
} |
| 5048 |
else |
| 5049 |
{ |
| 5050 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_STA_CONFIG(kmalloc failed)\n")); |
| 5051 |
Status = -EFAULT; |
| 5052 |
} |
| 5053 |
break; |
| 5054 |
case RT_OID_QUERY_MULTIPLE_CARD_SUPPORT: |
| 5055 |
wrq->u.data.length = sizeof(UCHAR); |
| 5056 |
i = 0; |
| 5057 |
if (copy_to_user(wrq->u.data.pointer, &i, wrq->u.data.length)) |
| 5058 |
{ |
| 5059 |
Status = -EFAULT; |
| 5060 |
} |
| 5061 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_QUERY_MULTIPLE_CARD_SUPPORT(=%d) \n", i)); |
| 5062 |
break; |
| 5063 |
|
| 5064 |
case OID_802_11_BUILD_CHANNEL_EX: |
| 5065 |
{ |
| 5066 |
UCHAR value; |
| 5067 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_BUILD_CHANNEL_EX \n")); |
| 5068 |
wrq->u.data.length = sizeof(UCHAR); |
| 5069 |
DBGPRINT(RT_DEBUG_TRACE, ("Doesn't support EXT_BUILD_CHANNEL_LIST.\n")); |
| 5070 |
value = 0; |
| 5071 |
Status = copy_to_user(wrq->u.data.pointer, &value, 1); |
| 5072 |
DBGPRINT(RT_DEBUG_TRACE, ("Status=%d\n", Status)); |
| 5073 |
} |
| 5074 |
break; |
| 5075 |
|
| 5076 |
case OID_802_11_GET_CH_LIST: |
| 5077 |
{ |
| 5078 |
PRT_CHANNEL_LIST_INFO pChListBuf; |
| 5079 |
|
| 5080 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_GET_CH_LIST \n")); |
| 5081 |
if (pAdapter->ChannelListNum == 0) |
| 5082 |
{ |
| 5083 |
wrq->u.data.length = 0; |
| 5084 |
break; |
| 5085 |
} |
| 5086 |
|
| 5087 |
pChListBuf = (RT_CHANNEL_LIST_INFO *) kmalloc(sizeof(RT_CHANNEL_LIST_INFO), MEM_ALLOC_FLAG); |
| 5088 |
if (pChListBuf == NULL) |
| 5089 |
{ |
| 5090 |
wrq->u.data.length = 0; |
| 5091 |
break; |
| 5092 |
} |
| 5093 |
|
| 5094 |
pChListBuf->ChannelListNum = pAdapter->ChannelListNum; |
| 5095 |
for (i = 0; i < pChListBuf->ChannelListNum; i++) |
| 5096 |
pChListBuf->ChannelList[i] = pAdapter->ChannelList[i].Channel; |
| 5097 |
|
| 5098 |
wrq->u.data.length = sizeof(RT_CHANNEL_LIST_INFO); |
| 5099 |
Status = copy_to_user(wrq->u.data.pointer, pChListBuf, sizeof(RT_CHANNEL_LIST_INFO)); |
| 5100 |
DBGPRINT(RT_DEBUG_TRACE, ("Status=%d\n", Status)); |
| 5101 |
|
| 5102 |
if (pChListBuf) |
| 5103 |
kfree(pChListBuf); |
| 5104 |
} |
| 5105 |
break; |
| 5106 |
|
| 5107 |
case OID_802_11_GET_COUNTRY_CODE: |
| 5108 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_GET_COUNTRY_CODE \n")); |
| 5109 |
wrq->u.data.length = 2; |
| 5110 |
Status = copy_to_user(wrq->u.data.pointer, &pAdapter->CommonCfg.CountryCode, 2); |
| 5111 |
DBGPRINT(RT_DEBUG_TRACE, ("Status=%d\n", Status)); |
| 5112 |
break; |
| 5113 |
|
| 5114 |
case OID_802_11_GET_CHANNEL_GEOGRAPHY: |
| 5115 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_GET_CHANNEL_GEOGRAPHY \n")); |
| 5116 |
wrq->u.data.length = 1; |
| 5117 |
Status = copy_to_user(wrq->u.data.pointer, &pAdapter->CommonCfg.Geography, 1); |
| 5118 |
DBGPRINT(RT_DEBUG_TRACE, ("Status=%d\n", Status)); |
| 5119 |
break; |
| 5120 |
|
| 5121 |
default: |
| 5122 |
DBGPRINT(RT_DEBUG_TRACE, ("Query::unknown IOCTL's subcmd = 0x%08x\n", cmd)); |
| 5123 |
Status = -EOPNOTSUPP; |
| 5124 |
break; |
| 5125 |
} |
| 5126 |
return Status; |
| 5127 |
} |
| 5128 |
|
| 5129 |
INT rt28xx_sta_ioctl( |
2683 |
INT rt28xx_sta_ioctl( |
| 5130 |
IN struct net_device *net_dev, |
2684 |
IN struct net_device *net_dev, |
| 5131 |
IN OUT struct ifreq *rq, |
2685 |
IN OUT struct ifreq *rq, |
| 5132 |
IN INT cmd) |
2686 |
IN INT cmd) |
| 5133 |
{ |
2687 |
{ |
| 5134 |
POS_COOKIE pObj; |
2688 |
RTMP_ADAPTER *pAd = net_dev->ml_priv; |
| 5135 |
VIRTUAL_ADAPTER *pVirtualAd = NULL; |
2689 |
POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie; |
| 5136 |
RTMP_ADAPTER *pAd = NULL; |
|
|
| 5137 |
struct iwreq *wrq = (struct iwreq *) rq; |
2690 |
struct iwreq *wrq = (struct iwreq *) rq; |
| 5138 |
BOOLEAN StateMachineTouched = FALSE; |
2691 |
BOOLEAN StateMachineTouched = FALSE; |
| 5139 |
INT Status = NDIS_STATUS_SUCCESS; |
2692 |
INT Status = NDIS_STATUS_SUCCESS; |
| 5140 |
USHORT subcmd; |
|
|
| 5141 |
|
| 5142 |
if (net_dev->priv_flags == INT_MAIN) |
| 5143 |
{ |
| 5144 |
pAd = net_dev->ml_priv; |
| 5145 |
} |
| 5146 |
else |
| 5147 |
{ |
| 5148 |
pVirtualAd = net_dev->ml_priv; |
| 5149 |
pAd = pVirtualAd->RtmpDev->ml_priv; |
| 5150 |
} |
| 5151 |
pObj = (POS_COOKIE) pAd->OS_Cookie; |
| 5152 |
|
| 5153 |
if (pAd == NULL) |
| 5154 |
{ |
| 5155 |
/* if 1st open fail, pAd will be free; |
| 5156 |
So the net_dev->ml_priv will be NULL in 2rd open */ |
| 5157 |
return -ENETDOWN; |
| 5158 |
} |
| 5159 |
|
2693 |
|
| 5160 |
//check if the interface is down |
2694 |
//check if the interface is down |
| 5161 |
if(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE)) |
2695 |
if(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE)) |
|
Lines 5300-5316
INT rt28xx_sta_ioctl(
Link Here
|
| 5300 |
case SIOCGIWRANGE: //Get range of parameters |
2834 |
case SIOCGIWRANGE: //Get range of parameters |
| 5301 |
case SIOCGIWRETRY: //get retry limits and lifetime |
2835 |
case SIOCGIWRETRY: //get retry limits and lifetime |
| 5302 |
case SIOCSIWRETRY: //set retry limits and lifetime |
2836 |
case SIOCSIWRETRY: //set retry limits and lifetime |
| 5303 |
Status = -EOPNOTSUPP; |
|
|
| 5304 |
break; |
| 5305 |
case RT_PRIV_IOCTL: |
2837 |
case RT_PRIV_IOCTL: |
| 5306 |
#ifdef RT30xx |
2838 |
case RT_PRIV_IOCTL_EXT: |
| 5307 |
case RT_PRIV_IOCTL_EXT: |
2839 |
Status = -EOPNOTSUPP; |
| 5308 |
#endif |
|
|
| 5309 |
subcmd = wrq->u.data.flags; |
| 5310 |
if( subcmd & OID_GET_SET_TOGGLE) |
| 5311 |
Status = RTMPSetInformation(pAd, rq, subcmd); |
| 5312 |
else |
| 5313 |
Status = RTMPQueryInformation(pAd, rq, subcmd); |
| 5314 |
break; |
2840 |
break; |
| 5315 |
case SIOCGIWPRIV: |
2841 |
case SIOCGIWPRIV: |
| 5316 |
if (wrq->u.data.pointer) |
2842 |
if (wrq->u.data.pointer) |
|
Lines 5330-5348
INT rt28xx_sta_ioctl(
Link Here
|
| 5330 |
case RTPRIV_IOCTL_GSITESURVEY: |
2856 |
case RTPRIV_IOCTL_GSITESURVEY: |
| 5331 |
RTMPIoctlGetSiteSurvey(pAd, wrq); |
2857 |
RTMPIoctlGetSiteSurvey(pAd, wrq); |
| 5332 |
break; |
2858 |
break; |
| 5333 |
#ifdef DBG |
|
|
| 5334 |
case RTPRIV_IOCTL_MAC: |
| 5335 |
RTMPIoctlMAC(pAd, wrq); |
| 5336 |
break; |
| 5337 |
case RTPRIV_IOCTL_E2P: |
| 5338 |
RTMPIoctlE2PROM(pAd, wrq); |
| 5339 |
break; |
| 5340 |
#ifdef RT30xx |
| 5341 |
case RTPRIV_IOCTL_RF: |
| 5342 |
RTMPIoctlRF(pAd, wrq); |
| 5343 |
break; |
| 5344 |
#endif // RT30xx // |
| 5345 |
#endif // DBG // |
| 5346 |
case SIOCETHTOOL: |
2859 |
case SIOCETHTOOL: |
| 5347 |
break; |
2860 |
break; |
| 5348 |
default: |
2861 |
default: |
|
Lines 6241-6832
INT Set_Wpa_Support(
Link Here
|
| 6241 |
return TRUE; |
3754 |
return TRUE; |
| 6242 |
} |
3755 |
} |
| 6243 |
|
3756 |
|
| 6244 |
#ifdef DBG |
|
|
| 6245 |
/* |
| 6246 |
========================================================================== |
| 6247 |
Description: |
| 6248 |
Read / Write MAC |
| 6249 |
Arguments: |
| 6250 |
pAdapter Pointer to our adapter |
| 6251 |
wrq Pointer to the ioctl argument |
| 6252 |
|
| 6253 |
Return Value: |
| 6254 |
None |
| 6255 |
|
| 6256 |
Note: |
| 6257 |
Usage: |
| 6258 |
1.) iwpriv ra0 mac 0 ==> read MAC where Addr=0x0 |
| 6259 |
2.) iwpriv ra0 mac 0=12 ==> write MAC where Addr=0x0, value=12 |
| 6260 |
========================================================================== |
| 6261 |
*/ |
| 6262 |
VOID RTMPIoctlMAC( |
| 6263 |
IN PRTMP_ADAPTER pAdapter, |
| 6264 |
IN struct iwreq *wrq) |
| 6265 |
{ |
| 6266 |
CHAR *this_char; |
| 6267 |
CHAR *value; |
| 6268 |
INT j = 0, k = 0; |
| 6269 |
CHAR msg[1024]; |
| 6270 |
CHAR arg[255]; |
| 6271 |
ULONG macAddr = 0; |
| 6272 |
UCHAR temp[16], temp2[16]; |
| 6273 |
UINT32 macValue = 0; |
| 6274 |
INT Status; |
| 6275 |
#ifdef RT30xx |
| 6276 |
BOOLEAN bIsPrintAllMAC = FALSE; |
| 6277 |
#endif |
| 6278 |
|
| 6279 |
memset(msg, 0x00, 1024); |
| 6280 |
if (wrq->u.data.length > 1) //No parameters. |
| 6281 |
{ |
| 6282 |
Status = copy_from_user(arg, wrq->u.data.pointer, (wrq->u.data.length > 255) ? 255 : wrq->u.data.length); |
| 6283 |
sprintf(msg, "\n"); |
| 6284 |
|
| 6285 |
//Parsing Read or Write |
| 6286 |
this_char = arg; |
| 6287 |
if (!*this_char) |
| 6288 |
goto next; |
| 6289 |
|
| 6290 |
if ((value = rtstrchr(this_char, '=')) != NULL) |
| 6291 |
*value++ = 0; |
| 6292 |
|
| 6293 |
if (!value || !*value) |
| 6294 |
{ //Read |
| 6295 |
// Sanity check |
| 6296 |
if(strlen(this_char) > 4) |
| 6297 |
goto next; |
| 6298 |
|
| 6299 |
j = strlen(this_char); |
| 6300 |
while(j-- > 0) |
| 6301 |
{ |
| 6302 |
if(this_char[j] > 'f' || this_char[j] < '0') |
| 6303 |
return; |
| 6304 |
} |
| 6305 |
|
| 6306 |
// Mac Addr |
| 6307 |
k = j = strlen(this_char); |
| 6308 |
while(j-- > 0) |
| 6309 |
{ |
| 6310 |
this_char[4-k+j] = this_char[j]; |
| 6311 |
} |
| 6312 |
|
| 6313 |
while(k < 4) |
| 6314 |
this_char[3-k++]='0'; |
| 6315 |
this_char[4]='\0'; |
| 6316 |
|
| 6317 |
if(strlen(this_char) == 4) |
| 6318 |
{ |
| 6319 |
AtoH(this_char, temp, 2); |
| 6320 |
macAddr = *temp*256 + temp[1]; |
| 6321 |
if (macAddr < 0xFFFF) |
| 6322 |
{ |
| 6323 |
RTMP_IO_READ32(pAdapter, macAddr, &macValue); |
| 6324 |
DBGPRINT(RT_DEBUG_TRACE, ("MacAddr=%lx, MacValue=%x\n", macAddr, macValue)); |
| 6325 |
sprintf(msg+strlen(msg), "[0x%08lX]:%08X ", macAddr , macValue); |
| 6326 |
} |
| 6327 |
else |
| 6328 |
#ifndef RT30xx |
| 6329 |
{//Invalid parametes, so default printk all bbp |
| 6330 |
#endif |
| 6331 |
#ifdef RT30xx |
| 6332 |
{//Invalid parametes, so default printk all mac |
| 6333 |
bIsPrintAllMAC = TRUE; |
| 6334 |
#endif |
| 6335 |
goto next; |
| 6336 |
} |
| 6337 |
} |
| 6338 |
} |
| 6339 |
else |
| 6340 |
{ //Write |
| 6341 |
memcpy(&temp2, value, strlen(value)); |
| 6342 |
temp2[strlen(value)] = '\0'; |
| 6343 |
|
| 6344 |
// Sanity check |
| 6345 |
if((strlen(this_char) > 4) || strlen(temp2) > 8) |
| 6346 |
goto next; |
| 6347 |
|
| 6348 |
j = strlen(this_char); |
| 6349 |
while(j-- > 0) |
| 6350 |
{ |
| 6351 |
if(this_char[j] > 'f' || this_char[j] < '0') |
| 6352 |
return; |
| 6353 |
} |
| 6354 |
|
| 6355 |
j = strlen(temp2); |
| 6356 |
while(j-- > 0) |
| 6357 |
{ |
| 6358 |
if(temp2[j] > 'f' || temp2[j] < '0') |
| 6359 |
return; |
| 6360 |
} |
| 6361 |
|
| 6362 |
//MAC Addr |
| 6363 |
k = j = strlen(this_char); |
| 6364 |
while(j-- > 0) |
| 6365 |
{ |
| 6366 |
this_char[4-k+j] = this_char[j]; |
| 6367 |
} |
| 6368 |
|
| 6369 |
while(k < 4) |
| 6370 |
this_char[3-k++]='0'; |
| 6371 |
this_char[4]='\0'; |
| 6372 |
|
| 6373 |
//MAC value |
| 6374 |
k = j = strlen(temp2); |
| 6375 |
while(j-- > 0) |
| 6376 |
{ |
| 6377 |
temp2[8-k+j] = temp2[j]; |
| 6378 |
} |
| 6379 |
|
| 6380 |
while(k < 8) |
| 6381 |
temp2[7-k++]='0'; |
| 6382 |
temp2[8]='\0'; |
| 6383 |
|
| 6384 |
{ |
| 6385 |
AtoH(this_char, temp, 2); |
| 6386 |
macAddr = *temp*256 + temp[1]; |
| 6387 |
|
| 6388 |
AtoH(temp2, temp, 4); |
| 6389 |
macValue = *temp*256*256*256 + temp[1]*256*256 + temp[2]*256 + temp[3]; |
| 6390 |
|
| 6391 |
// debug mode |
| 6392 |
if (macAddr == (HW_DEBUG_SETTING_BASE + 4)) |
| 6393 |
{ |
| 6394 |
// 0x2bf4: byte0 non-zero: enable R17 tuning, 0: disable R17 tuning |
| 6395 |
if (macValue & 0x000000ff) |
| 6396 |
{ |
| 6397 |
pAdapter->BbpTuning.bEnable = TRUE; |
| 6398 |
DBGPRINT(RT_DEBUG_TRACE,("turn on R17 tuning\n")); |
| 6399 |
} |
| 6400 |
else |
| 6401 |
{ |
| 6402 |
UCHAR R66; |
| 6403 |
pAdapter->BbpTuning.bEnable = FALSE; |
| 6404 |
R66 = 0x26 + GET_LNA_GAIN(pAdapter); |
| 6405 |
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAdapter, BBP_R66, (0x26 + GET_LNA_GAIN(pAdapter))); |
| 6406 |
DBGPRINT(RT_DEBUG_TRACE,("turn off R17 tuning, restore to 0x%02x\n", R66)); |
| 6407 |
} |
| 6408 |
return; |
| 6409 |
} |
| 6410 |
|
| 6411 |
DBGPRINT(RT_DEBUG_TRACE, ("MacAddr=%02lx, MacValue=0x%x\n", macAddr, macValue)); |
| 6412 |
|
| 6413 |
RTMP_IO_WRITE32(pAdapter, macAddr, macValue); |
| 6414 |
sprintf(msg+strlen(msg), "[0x%08lX]:%08X ", macAddr, macValue); |
| 6415 |
} |
| 6416 |
} |
| 6417 |
} |
| 6418 |
#ifdef RT30xx |
| 6419 |
else |
| 6420 |
bIsPrintAllMAC = TRUE; |
| 6421 |
#endif |
| 6422 |
next: |
| 6423 |
#ifdef RT30xx |
| 6424 |
if (bIsPrintAllMAC) |
| 6425 |
{ |
| 6426 |
struct file *file_w; |
| 6427 |
PCHAR fileName = "MacDump.txt"; |
| 6428 |
mm_segment_t orig_fs; |
| 6429 |
|
| 6430 |
orig_fs = get_fs(); |
| 6431 |
set_fs(KERNEL_DS); |
| 6432 |
|
| 6433 |
// open file |
| 6434 |
file_w = filp_open(fileName, O_WRONLY|O_CREAT, 0); |
| 6435 |
if (IS_ERR(file_w)) |
| 6436 |
{ |
| 6437 |
DBGPRINT(RT_DEBUG_TRACE, ("-->2) %s: Error %ld opening %s\n", __func__, -PTR_ERR(file_w), fileName)); |
| 6438 |
} |
| 6439 |
else |
| 6440 |
{ |
| 6441 |
if (file_w->f_op && file_w->f_op->write) |
| 6442 |
{ |
| 6443 |
file_w->f_pos = 0; |
| 6444 |
macAddr = 0x1000; |
| 6445 |
|
| 6446 |
while (macAddr <= 0x1800) |
| 6447 |
{ |
| 6448 |
RTMP_IO_READ32(pAdapter, macAddr, &macValue); |
| 6449 |
sprintf(msg, "%08lx = %08X\n", macAddr, macValue); |
| 6450 |
|
| 6451 |
// write data to file |
| 6452 |
file_w->f_op->write(file_w, msg, strlen(msg), &file_w->f_pos); |
| 6453 |
|
| 6454 |
printk("%s", msg); |
| 6455 |
macAddr += 4; |
| 6456 |
} |
| 6457 |
sprintf(msg, "\nDump all MAC values to %s\n", fileName); |
| 6458 |
} |
| 6459 |
filp_close(file_w, NULL); |
| 6460 |
} |
| 6461 |
set_fs(orig_fs); |
| 6462 |
} |
| 6463 |
#endif /* RT30xx */ |
| 6464 |
if(strlen(msg) == 1) |
| 6465 |
sprintf(msg+strlen(msg), "===>Error command format!"); |
| 6466 |
|
| 6467 |
// Copy the information into the user buffer |
| 6468 |
wrq->u.data.length = strlen(msg); |
| 6469 |
Status = copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length); |
| 6470 |
|
| 6471 |
DBGPRINT(RT_DEBUG_TRACE, ("<==RTMPIoctlMAC\n\n")); |
| 6472 |
} |
| 6473 |
|
| 6474 |
/* |
| 6475 |
========================================================================== |
| 6476 |
Description: |
| 6477 |
Read / Write E2PROM |
| 6478 |
Arguments: |
| 6479 |
pAdapter Pointer to our adapter |
| 6480 |
wrq Pointer to the ioctl argument |
| 6481 |
|
| 6482 |
Return Value: |
| 6483 |
None |
| 6484 |
|
| 6485 |
Note: |
| 6486 |
Usage: |
| 6487 |
1.) iwpriv ra0 e2p 0 ==> read E2PROM where Addr=0x0 |
| 6488 |
2.) iwpriv ra0 e2p 0=1234 ==> write E2PROM where Addr=0x0, value=1234 |
| 6489 |
========================================================================== |
| 6490 |
*/ |
| 6491 |
VOID RTMPIoctlE2PROM( |
| 6492 |
IN PRTMP_ADAPTER pAdapter, |
| 6493 |
IN struct iwreq *wrq) |
| 6494 |
{ |
| 6495 |
CHAR *this_char; |
| 6496 |
CHAR *value; |
| 6497 |
INT j = 0, k = 0; |
| 6498 |
CHAR msg[1024]; |
| 6499 |
CHAR arg[255]; |
| 6500 |
USHORT eepAddr = 0; |
| 6501 |
UCHAR temp[16], temp2[16]; |
| 6502 |
USHORT eepValue; |
| 6503 |
int Status; |
| 6504 |
#ifdef RT30xx |
| 6505 |
BOOLEAN bIsPrintAllE2P = FALSE; |
| 6506 |
#endif |
| 6507 |
|
| 6508 |
memset(msg, 0x00, 1024); |
| 6509 |
if (wrq->u.data.length > 1) //No parameters. |
| 6510 |
{ |
| 6511 |
Status = copy_from_user(arg, wrq->u.data.pointer, (wrq->u.data.length > 255) ? 255 : wrq->u.data.length); |
| 6512 |
sprintf(msg, "\n"); |
| 6513 |
|
| 6514 |
//Parsing Read or Write |
| 6515 |
this_char = arg; |
| 6516 |
|
| 6517 |
|
| 6518 |
if (!*this_char) |
| 6519 |
goto next; |
| 6520 |
|
| 6521 |
if ((value = rtstrchr(this_char, '=')) != NULL) |
| 6522 |
*value++ = 0; |
| 6523 |
|
| 6524 |
if (!value || !*value) |
| 6525 |
{ //Read |
| 6526 |
|
| 6527 |
// Sanity check |
| 6528 |
if(strlen(this_char) > 4) |
| 6529 |
goto next; |
| 6530 |
|
| 6531 |
j = strlen(this_char); |
| 6532 |
while(j-- > 0) |
| 6533 |
{ |
| 6534 |
if(this_char[j] > 'f' || this_char[j] < '0') |
| 6535 |
return; |
| 6536 |
} |
| 6537 |
|
| 6538 |
// E2PROM addr |
| 6539 |
k = j = strlen(this_char); |
| 6540 |
while(j-- > 0) |
| 6541 |
{ |
| 6542 |
this_char[4-k+j] = this_char[j]; |
| 6543 |
} |
| 6544 |
|
| 6545 |
while(k < 4) |
| 6546 |
this_char[3-k++]='0'; |
| 6547 |
this_char[4]='\0'; |
| 6548 |
|
| 6549 |
if(strlen(this_char) == 4) |
| 6550 |
{ |
| 6551 |
AtoH(this_char, temp, 2); |
| 6552 |
eepAddr = *temp*256 + temp[1]; |
| 6553 |
if (eepAddr < 0xFFFF) |
| 6554 |
{ |
| 6555 |
RT28xx_EEPROM_READ16(pAdapter, eepAddr, eepValue); |
| 6556 |
sprintf(msg+strlen(msg), "[0x%04X]:0x%04X ", eepAddr , eepValue); |
| 6557 |
} |
| 6558 |
else |
| 6559 |
{//Invalid parametes, so default printk all bbp |
| 6560 |
#ifdef RT30xx |
| 6561 |
bIsPrintAllE2P = TRUE; |
| 6562 |
#endif |
| 6563 |
goto next; |
| 6564 |
} |
| 6565 |
} |
| 6566 |
} |
| 6567 |
else |
| 6568 |
{ //Write |
| 6569 |
memcpy(&temp2, value, strlen(value)); |
| 6570 |
temp2[strlen(value)] = '\0'; |
| 6571 |
|
| 6572 |
// Sanity check |
| 6573 |
if((strlen(this_char) > 4) || strlen(temp2) > 8) |
| 6574 |
goto next; |
| 6575 |
|
| 6576 |
j = strlen(this_char); |
| 6577 |
while(j-- > 0) |
| 6578 |
{ |
| 6579 |
if(this_char[j] > 'f' || this_char[j] < '0') |
| 6580 |
return; |
| 6581 |
} |
| 6582 |
j = strlen(temp2); |
| 6583 |
while(j-- > 0) |
| 6584 |
{ |
| 6585 |
if(temp2[j] > 'f' || temp2[j] < '0') |
| 6586 |
return; |
| 6587 |
} |
| 6588 |
|
| 6589 |
//MAC Addr |
| 6590 |
k = j = strlen(this_char); |
| 6591 |
while(j-- > 0) |
| 6592 |
{ |
| 6593 |
this_char[4-k+j] = this_char[j]; |
| 6594 |
} |
| 6595 |
|
| 6596 |
while(k < 4) |
| 6597 |
this_char[3-k++]='0'; |
| 6598 |
this_char[4]='\0'; |
| 6599 |
|
| 6600 |
//MAC value |
| 6601 |
k = j = strlen(temp2); |
| 6602 |
while(j-- > 0) |
| 6603 |
{ |
| 6604 |
temp2[4-k+j] = temp2[j]; |
| 6605 |
} |
| 6606 |
|
| 6607 |
while(k < 4) |
| 6608 |
temp2[3-k++]='0'; |
| 6609 |
temp2[4]='\0'; |
| 6610 |
|
| 6611 |
AtoH(this_char, temp, 2); |
| 6612 |
eepAddr = *temp*256 + temp[1]; |
| 6613 |
|
| 6614 |
AtoH(temp2, temp, 2); |
| 6615 |
eepValue = *temp*256 + temp[1]; |
| 6616 |
|
| 6617 |
RT28xx_EEPROM_WRITE16(pAdapter, eepAddr, eepValue); |
| 6618 |
sprintf(msg+strlen(msg), "[0x%02X]:%02X ", eepAddr, eepValue); |
| 6619 |
} |
| 6620 |
} |
| 6621 |
#ifdef RT30xx |
| 6622 |
else |
| 6623 |
bIsPrintAllE2P = TRUE; |
| 6624 |
#endif |
| 6625 |
next: |
| 6626 |
#ifdef RT30xx |
| 6627 |
if (bIsPrintAllE2P) |
| 6628 |
{ |
| 6629 |
struct file *file_w; |
| 6630 |
PCHAR fileName = "EEPROMDump.txt"; |
| 6631 |
mm_segment_t orig_fs; |
| 6632 |
|
| 6633 |
orig_fs = get_fs(); |
| 6634 |
set_fs(KERNEL_DS); |
| 6635 |
|
| 6636 |
// open file |
| 6637 |
file_w = filp_open(fileName, O_WRONLY|O_CREAT, 0); |
| 6638 |
if (IS_ERR(file_w)) |
| 6639 |
{ |
| 6640 |
DBGPRINT(RT_DEBUG_TRACE, ("-->2) %s: Error %ld opening %s\n", __func__, -PTR_ERR(file_w), fileName)); |
| 6641 |
} |
| 6642 |
else |
| 6643 |
{ |
| 6644 |
if (file_w->f_op && file_w->f_op->write) |
| 6645 |
{ |
| 6646 |
file_w->f_pos = 0; |
| 6647 |
eepAddr = 0x00; |
| 6648 |
|
| 6649 |
while (eepAddr <= 0xFE) |
| 6650 |
{ |
| 6651 |
RT28xx_EEPROM_READ16(pAdapter, eepAddr, eepValue); |
| 6652 |
sprintf(msg, "%08x = %04x\n", eepAddr , eepValue); |
| 6653 |
|
| 6654 |
// write data to file |
| 6655 |
file_w->f_op->write(file_w, msg, strlen(msg), &file_w->f_pos); |
| 6656 |
|
| 6657 |
printk("%s", msg); |
| 6658 |
eepAddr += 2; |
| 6659 |
} |
| 6660 |
sprintf(msg, "\nDump all EEPROM values to %s\n", fileName); |
| 6661 |
} |
| 6662 |
filp_close(file_w, NULL); |
| 6663 |
} |
| 6664 |
set_fs(orig_fs); |
| 6665 |
} |
| 6666 |
#endif /* RT30xx */ |
| 6667 |
if(strlen(msg) == 1) |
| 6668 |
sprintf(msg+strlen(msg), "===>Error command format!"); |
| 6669 |
|
| 6670 |
|
| 6671 |
// Copy the information into the user buffer |
| 6672 |
wrq->u.data.length = strlen(msg); |
| 6673 |
Status = copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length); |
| 6674 |
|
| 6675 |
DBGPRINT(RT_DEBUG_TRACE, ("<==RTMPIoctlE2PROM\n")); |
| 6676 |
} |
| 6677 |
#ifdef RT30xx |
| 6678 |
/* |
| 6679 |
========================================================================== |
| 6680 |
Description: |
| 6681 |
Read / Write RF register |
| 6682 |
Arguments: |
| 6683 |
pAdapter Pointer to our adapter |
| 6684 |
wrq Pointer to the ioctl argument |
| 6685 |
|
| 6686 |
Return Value: |
| 6687 |
None |
| 6688 |
|
| 6689 |
Note: |
| 6690 |
Usage: |
| 6691 |
1.) iwpriv ra0 rf ==> read all RF registers |
| 6692 |
2.) iwpriv ra0 rf 1 ==> read RF where RegID=1 |
| 6693 |
3.) iwpriv ra0 rf 1=10 ==> write RF R1=0x10 |
| 6694 |
========================================================================== |
| 6695 |
*/ |
| 6696 |
VOID RTMPIoctlRF( |
| 6697 |
IN PRTMP_ADAPTER pAdapter, |
| 6698 |
IN struct iwreq *wrq) |
| 6699 |
{ |
| 6700 |
CHAR *this_char; |
| 6701 |
CHAR *value; |
| 6702 |
UCHAR regRF = 0; |
| 6703 |
CHAR msg[2048]; |
| 6704 |
CHAR arg[255]; |
| 6705 |
INT rfId; |
| 6706 |
LONG rfValue; |
| 6707 |
int Status; |
| 6708 |
BOOLEAN bIsPrintAllRF = FALSE; |
| 6709 |
|
| 6710 |
|
| 6711 |
memset(msg, 0x00, 2048); |
| 6712 |
if (wrq->u.data.length > 1) //No parameters. |
| 6713 |
{ |
| 6714 |
Status = copy_from_user(arg, wrq->u.data.pointer, (wrq->u.data.length > 255) ? 255 : wrq->u.data.length); |
| 6715 |
sprintf(msg, "\n"); |
| 6716 |
|
| 6717 |
//Parsing Read or Write |
| 6718 |
this_char = arg; |
| 6719 |
if (!*this_char) |
| 6720 |
goto next; |
| 6721 |
|
| 6722 |
if ((value = strchr(this_char, '=')) != NULL) |
| 6723 |
*value++ = 0; |
| 6724 |
|
| 6725 |
if (!value || !*value) |
| 6726 |
{ //Read |
| 6727 |
if (sscanf(this_char, "%d", &(rfId)) == 1) |
| 6728 |
{ |
| 6729 |
if (rfId <= 31) |
| 6730 |
{ |
| 6731 |
// In RT2860 ATE mode, we do not load 8051 firmware. |
| 6732 |
//We must access RF directly. |
| 6733 |
// For RT2870 ATE mode, ATE_RF_IO_WRITE8(/READ8)_BY_REG_ID are redefined. |
| 6734 |
// according to Andy, Gary, David require. |
| 6735 |
// the command rf shall read rf register directly for dubug. |
| 6736 |
// BBP_IO_READ8_BY_REG_ID(pAdapter, bbpId, ®BBP); |
| 6737 |
RT30xxReadRFRegister(pAdapter, rfId, ®RF); |
| 6738 |
|
| 6739 |
sprintf(msg+strlen(msg), "R%02d[0x%02x]:%02X ", rfId, rfId*2, regRF); |
| 6740 |
} |
| 6741 |
else |
| 6742 |
{//Invalid parametes, so default printk all RF |
| 6743 |
bIsPrintAllRF = TRUE; |
| 6744 |
goto next; |
| 6745 |
} |
| 6746 |
} |
| 6747 |
else |
| 6748 |
{ //Invalid parametes, so default printk all RF |
| 6749 |
bIsPrintAllRF = TRUE; |
| 6750 |
goto next; |
| 6751 |
} |
| 6752 |
} |
| 6753 |
else |
| 6754 |
{ //Write |
| 6755 |
if ((sscanf(this_char, "%d", &(rfId)) == 1) && (sscanf(value, "%lx", &(rfValue)) == 1)) |
| 6756 |
{ |
| 6757 |
if (rfId <= 31) |
| 6758 |
{ |
| 6759 |
// In RT2860 ATE mode, we do not load 8051 firmware. |
| 6760 |
// We should access RF registers directly. |
| 6761 |
// For RT2870 ATE mode, ATE_RF_IO_WRITE8/READ8_BY_REG_ID are redefined. |
| 6762 |
{ |
| 6763 |
// according to Andy, Gary, David require. |
| 6764 |
// the command RF shall read/write RF register directly for dubug. |
| 6765 |
//BBP_IO_READ8_BY_REG_ID(pAdapter, bbpId, ®BBP); |
| 6766 |
//BBP_IO_WRITE8_BY_REG_ID(pAdapter, (UCHAR)bbpId,(UCHAR) bbpValue); |
| 6767 |
RT30xxReadRFRegister(pAdapter, rfId, ®RF); |
| 6768 |
RT30xxWriteRFRegister(pAdapter, (UCHAR)rfId,(UCHAR) rfValue); |
| 6769 |
//Read it back for showing |
| 6770 |
//BBP_IO_READ8_BY_REG_ID(pAdapter, bbpId, ®BBP); |
| 6771 |
RT30xxReadRFRegister(pAdapter, rfId, ®RF); |
| 6772 |
sprintf(msg+strlen(msg), "R%02d[0x%02X]:%02X\n", rfId, rfId*2, regRF); |
| 6773 |
} |
| 6774 |
} |
| 6775 |
else |
| 6776 |
{//Invalid parametes, so default printk all RF |
| 6777 |
bIsPrintAllRF = TRUE; |
| 6778 |
} |
| 6779 |
} |
| 6780 |
else |
| 6781 |
{ //Invalid parametes, so default printk all RF |
| 6782 |
bIsPrintAllRF = TRUE; |
| 6783 |
} |
| 6784 |
} |
| 6785 |
} |
| 6786 |
else |
| 6787 |
bIsPrintAllRF = TRUE; |
| 6788 |
next: |
| 6789 |
if (bIsPrintAllRF) |
| 6790 |
{ |
| 6791 |
memset(msg, 0x00, 2048); |
| 6792 |
sprintf(msg, "\n"); |
| 6793 |
for (rfId = 0; rfId <= 31; rfId++) |
| 6794 |
{ |
| 6795 |
// according to Andy, Gary, David require. |
| 6796 |
// the command RF shall read/write RF register directly for dubug. |
| 6797 |
RT30xxReadRFRegister(pAdapter, rfId, ®RF); |
| 6798 |
sprintf(msg+strlen(msg), "%03d = %02X\n", rfId, regRF); |
| 6799 |
} |
| 6800 |
// Copy the information into the user buffer |
| 6801 |
DBGPRINT(RT_DEBUG_TRACE, ("strlen(msg)=%d\n", (UINT32)strlen(msg))); |
| 6802 |
wrq->u.data.length = strlen(msg); |
| 6803 |
if (copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length)) |
| 6804 |
{ |
| 6805 |
DBGPRINT(RT_DEBUG_TRACE, ("%s: copy_to_user() fail\n", __func__)); |
| 6806 |
} |
| 6807 |
} |
| 6808 |
else |
| 6809 |
{ |
| 6810 |
if(strlen(msg) == 1) |
| 6811 |
sprintf(msg+strlen(msg), "===>Error command format!"); |
| 6812 |
|
| 6813 |
DBGPRINT(RT_DEBUG_TRACE, ("copy to user [msg=%s]\n", msg)); |
| 6814 |
// Copy the information into the user buffer |
| 6815 |
DBGPRINT(RT_DEBUG_TRACE, ("strlen(msg) =%d\n", (UINT32)strlen(msg))); |
| 6816 |
|
| 6817 |
// Copy the information into the user buffer |
| 6818 |
wrq->u.data.length = strlen(msg); |
| 6819 |
Status = copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length); |
| 6820 |
} |
| 6821 |
|
| 6822 |
DBGPRINT(RT_DEBUG_TRACE, ("<==RTMPIoctlRF\n\n")); |
| 6823 |
} |
| 6824 |
#endif // RT30xx // |
| 6825 |
#endif // DBG // |
| 6826 |
|
| 6827 |
|
| 6828 |
|
| 6829 |
|
| 6830 |
INT Set_TGnWifiTest_Proc( |
3757 |
INT Set_TGnWifiTest_Proc( |
| 6831 |
IN PRTMP_ADAPTER pAd, |
3758 |
IN PRTMP_ADAPTER pAd, |
| 6832 |
IN PUCHAR arg) |
3759 |
IN PUCHAR arg) |
|
Lines 6867-6914
INT Set_ShortRetryLimit_Proc(
Link Here
|
| 6867 |
DBGPRINT(RT_DEBUG_TRACE, ("IF Set_ShortRetryLimit_Proc::(tx_rty_cfg=0x%x)\n", tx_rty_cfg.word)); |
3794 |
DBGPRINT(RT_DEBUG_TRACE, ("IF Set_ShortRetryLimit_Proc::(tx_rty_cfg=0x%x)\n", tx_rty_cfg.word)); |
| 6868 |
return TRUE; |
3795 |
return TRUE; |
| 6869 |
} |
3796 |
} |
| 6870 |
|
|
|
| 6871 |
#if !defined(RT2860) && !defined(RT30xx) |
| 6872 |
INT Show_Adhoc_MacTable_Proc( |
| 6873 |
IN PRTMP_ADAPTER pAd, |
| 6874 |
IN PCHAR extra) |
| 6875 |
{ |
| 6876 |
INT i; |
| 6877 |
|
| 6878 |
sprintf(extra, "\n"); |
| 6879 |
|
| 6880 |
sprintf(extra + strlen(extra), "HT Operating Mode : %d\n", pAd->CommonCfg.AddHTInfo.AddHtInfo2.OperaionMode); |
| 6881 |
|
| 6882 |
sprintf(extra + strlen(extra), "\n%-19s%-4s%-4s%-7s%-7s%-7s%-10s%-6s%-6s%-6s%-6s\n", |
| 6883 |
"MAC", "AID", "BSS", "RSSI0", "RSSI1", "RSSI2", "PhMd", "BW", "MCS", "SGI", "STBC"); |
| 6884 |
|
| 6885 |
for (i=1; i<MAX_LEN_OF_MAC_TABLE; i++) |
| 6886 |
{ |
| 6887 |
PMAC_TABLE_ENTRY pEntry = &pAd->MacTab.Content[i]; |
| 6888 |
|
| 6889 |
if (strlen(extra) > (IW_PRIV_SIZE_MASK - 30)) |
| 6890 |
break; |
| 6891 |
if ((pEntry->ValidAsCLI || pEntry->ValidAsApCli) && (pEntry->Sst == SST_ASSOC)) |
| 6892 |
{ |
| 6893 |
sprintf(extra + strlen(extra), "%02X:%02X:%02X:%02X:%02X:%02X ", |
| 6894 |
pEntry->Addr[0], pEntry->Addr[1], pEntry->Addr[2], |
| 6895 |
pEntry->Addr[3], pEntry->Addr[4], pEntry->Addr[5]); |
| 6896 |
sprintf(extra + strlen(extra), "%-4d", (int)pEntry->Aid); |
| 6897 |
sprintf(extra + strlen(extra), "%-4d", (int)pEntry->apidx); |
| 6898 |
sprintf(extra + strlen(extra), "%-7d", pEntry->RssiSample.AvgRssi0); |
| 6899 |
sprintf(extra + strlen(extra), "%-7d", pEntry->RssiSample.AvgRssi1); |
| 6900 |
sprintf(extra + strlen(extra), "%-7d", pEntry->RssiSample.AvgRssi2); |
| 6901 |
sprintf(extra + strlen(extra), "%-10s", GetPhyMode(pEntry->HTPhyMode.field.MODE)); |
| 6902 |
sprintf(extra + strlen(extra), "%-6s", GetBW(pEntry->HTPhyMode.field.BW)); |
| 6903 |
sprintf(extra + strlen(extra), "%-6d", pEntry->HTPhyMode.field.MCS); |
| 6904 |
sprintf(extra + strlen(extra), "%-6d", pEntry->HTPhyMode.field.ShortGI); |
| 6905 |
sprintf(extra + strlen(extra), "%-6d", pEntry->HTPhyMode.field.STBC); |
| 6906 |
sprintf(extra + strlen(extra), "%-10d, %d, %d%%\n", pEntry->DebugFIFOCount, pEntry->DebugTxCount, |
| 6907 |
(pEntry->DebugTxCount) ? ((pEntry->DebugTxCount-pEntry->DebugFIFOCount)*100/pEntry->DebugTxCount) : 0); |
| 6908 |
sprintf(extra, "%s\n", extra); |
| 6909 |
} |
| 6910 |
} |
| 6911 |
|
| 6912 |
return TRUE; |
| 6913 |
} |
| 6914 |
#endif /* RT2870 */ |