diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-04-26 16:06:25 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-06-19 11:00:50 -0700 |
commit | 3a32ed12b69113094f0921dad50f112626cde44d (patch) | |
tree | 6942cd9503be2151aa34582f7fd32894dd30a408 /drivers/staging/rt2860/sta_ioctl.c | |
parent | 0eae1ca391ab35da89b08afde74030ced103fd86 (diff) |
Staging: rt2860: prepare for rt28[67]0/*.[ch] merge
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/rt2860/sta_ioctl.c')
-rw-r--r-- | drivers/staging/rt2860/sta_ioctl.c | 574 |
1 files changed, 565 insertions, 9 deletions
diff --git a/drivers/staging/rt2860/sta_ioctl.c b/drivers/staging/rt2860/sta_ioctl.c index 73a83d490b3..eb0109ad2fc 100644 --- a/drivers/staging/rt2860/sta_ioctl.c +++ b/drivers/staging/rt2860/sta_ioctl.c @@ -87,6 +87,10 @@ struct iw_priv_args privtab[] = { 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "radio_on" }, { SHOW_CFG_VALUE, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "show" }, +#if !defined(RT2860) && !defined(RT30xx) + { SHOW_ADHOC_ENTRY_INFO, + 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "adhocEntry" }, +#endif /* --- sub-ioctls relations --- */ #ifdef DBG @@ -96,6 +100,11 @@ struct iw_priv_args privtab[] = { { RTPRIV_IOCTL_MAC, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | 1024, "mac"}, +#ifdef RT30xx +{ RTPRIV_IOCTL_RF, + IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, + "rf"}, +#endif // RT30xx // { RTPRIV_IOCTL_E2P, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | 1024, "e2p"}, @@ -165,9 +174,11 @@ INT Set_Wpa_Support( IN PUCHAR arg); #ifdef DBG +#if !defined(RT2860) && !defined(RT30xx) VOID RTMPIoctlBBP( IN PRTMP_ADAPTER pAdapter, IN struct iwreq *wrq); +#endif VOID RTMPIoctlMAC( IN PRTMP_ADAPTER pAdapter, @@ -176,6 +187,12 @@ VOID RTMPIoctlMAC( VOID RTMPIoctlE2PROM( IN PRTMP_ADAPTER pAdapter, IN struct iwreq *wrq); + +#ifdef RT30xx +VOID RTMPIoctlRF( + IN PRTMP_ADAPTER pAdapter, + IN struct iwreq *wrq); +#endif // RT30xx // #endif // DBG // @@ -199,6 +216,12 @@ INT Set_ShortRetryLimit_Proc( IN PRTMP_ADAPTER pAdapter, IN PUCHAR arg); +#if !defined(RT2860) && !defined(RT30xx) +INT Show_Adhoc_MacTable_Proc( + IN PRTMP_ADAPTER pAd, + IN PCHAR extra); +#endif + static struct { CHAR *name; INT (*set_proc)(PRTMP_ADAPTER pAdapter, PUCHAR arg); @@ -256,6 +279,13 @@ static struct { {"ForceGF", Set_ForceGF_Proc}, {"LongRetry", Set_LongRetryLimit_Proc}, {"ShortRetry", Set_ShortRetryLimit_Proc}, +//2008/09/11:KH add to support efuse<-- +#ifdef RT30xx + {"efuseFreeNumber", set_eFuseGetFreeBlockCount_Proc}, + {"efuseDump", set_eFusedump_Proc}, + {"efuseLoadFromBin", set_eFuseLoadFromBin_Proc}, +#endif // RT30xx // +//2008/09/11:KH add to support efuse--> {NULL,} }; @@ -269,6 +299,7 @@ VOID RTMPAddKey( DBGPRINT(RT_DEBUG_TRACE, ("RTMPAddKey ------>\n")); +#ifdef RT2860 RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); if (RTMP_TEST_PSFLAG(pAd, fRTMP_PS_SET_PCI_CLK_OFF_COMMAND)) { @@ -282,6 +313,7 @@ VOID RTMPAddKey( RTMPusecDelay(6000); pAd->bPCIclkOff = FALSE; } +#endif if (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) { @@ -474,8 +506,10 @@ VOID RTMPAddKey( } } end: +#ifdef RT2860 RTMP_SET_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); DBGPRINT(RT_DEBUG_INFO, ("<------ RTMPAddKey\n")); +#endif return; } @@ -497,8 +531,12 @@ rt_ioctl_giwname(struct net_device *dev, char *name, char *extra) { // PRTMP_ADAPTER pAdapter = dev->ml_priv; - +#ifdef RT2860 strncpy(name, "RT2860 Wireless", IFNAMSIZ); +#endif +#ifdef RT2870 + strncpy(name, "RT2870 Wireless", IFNAMSIZ); +#endif // RT2870 // return 0; } @@ -540,7 +578,12 @@ int rt_ioctl_giwfreq(struct net_device *dev, struct iw_freq *freq, char *extra) { VIRTUAL_ADAPTER *pVirtualAd = NULL; +#ifndef RT30xx PRTMP_ADAPTER pAdapter = NULL; +#endif +#ifdef RT30xx + PRTMP_ADAPTER pAdapter; +#endif UCHAR ch; ULONG m; @@ -551,7 +594,9 @@ int rt_ioctl_giwfreq(struct net_device *dev, else { pVirtualAd = dev->ml_priv; +#ifndef RT30xx if (pVirtualAd && pVirtualAd->RtmpDev) +#endif pAdapter = pVirtualAd->RtmpDev->ml_priv; } @@ -611,6 +656,7 @@ int rt_ioctl_giwmode(struct net_device *dev, struct iw_request_info *info, __u32 *mode, char *extra) { +#ifndef RT30xx PRTMP_ADAPTER pAdapter = NULL; VIRTUAL_ADAPTER *pVirtualAd = NULL; @@ -631,6 +677,10 @@ int rt_ioctl_giwmode(struct net_device *dev, So the net_dev->ml_priv will be NULL in 2rd open */ return -ENETDOWN; } +#endif +#ifdef RT30xx + PRTMP_ADAPTER pAdapter = dev->ml_priv; +#endif if (ADHOC_ON(pAdapter)) *mode = IW_MODE_ADHOC; @@ -674,12 +724,18 @@ int rt_ioctl_giwrange(struct net_device *dev, struct iw_request_info *info, struct iw_point *data, char *extra) { +#ifndef RT30xx PRTMP_ADAPTER pAdapter = NULL; VIRTUAL_ADAPTER *pVirtualAd = NULL; +#endif +#ifdef RT30xx + PRTMP_ADAPTER pAdapter = dev->ml_priv; +#endif struct iw_range *range = (struct iw_range *) extra; u16 val; int i; +#ifndef RT30xx if (dev->priv_flags == INT_MAIN) { pAdapter = dev->ml_priv; @@ -697,6 +753,7 @@ int rt_ioctl_giwrange(struct net_device *dev, So the net_dev->ml_priv will be NULL in 2rd open */ return -ENETDOWN; } +#endif DBGPRINT(RT_DEBUG_TRACE ,("===>rt_ioctl_giwrange\n")); data->length = sizeof(struct iw_range); @@ -816,6 +873,7 @@ int rt_ioctl_giwap(struct net_device *dev, struct iw_request_info *info, struct sockaddr *ap_addr, char *extra) { +#ifndef RT30xx PRTMP_ADAPTER pAdapter = NULL; VIRTUAL_ADAPTER *pVirtualAd = NULL; @@ -836,6 +894,10 @@ int rt_ioctl_giwap(struct net_device *dev, So the net_dev->ml_priv will be NULL in 2rd open */ return -ENETDOWN; } +#endif +#ifdef RT30xx + PRTMP_ADAPTER pAdapter = dev->ml_priv; +#endif if (INFRA_ON(pAdapter) || ADHOC_ON(pAdapter)) { @@ -954,7 +1016,7 @@ int rt_ioctl_siwscan(struct net_device *dev, DBGPRINT(RT_DEBUG_TRACE, ("!!! Driver is in Monitor Mode now !!!\n")); return -EINVAL; } - +#ifdef RT2860 if ((pAdapter->OpMode == OPMODE_STA) && (IDLE_ON(pAdapter)) && (pAdapter->StaCfg.bRadio == TRUE) && (RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_IDLE_RADIO_OFF))) @@ -964,7 +1026,7 @@ int rt_ioctl_siwscan(struct net_device *dev, // Check if still radio off. else if (pAdapter->bPCIclkOff == TRUE) return 0; - +#endif if (pAdapter->StaCfg.WpaSupplicantUP == WPA_SUPPLICANT_ENABLE) { pAdapter->StaCfg.WpaSupplicantScanCount++; @@ -1082,6 +1144,87 @@ int rt_ioctl_giwscan(struct net_device *dev, previous_ev = current_ev; current_ev = iwe_stream_add_event(info, current_ev,end_buf, &iwe, IW_EV_ADDR_LEN); +#ifdef RT30xx + if (current_ev == previous_ev) +#if WIRELESS_EXT >= 17 + return -E2BIG; +#else + break; +#endif + + /* + Protocol: + it will show scanned AP's WirelessMode . + it might be + 802.11a + 802.11a/n + 802.11g/n + 802.11b/g/n + 802.11g + 802.11b/g + */ + memset(&iwe, 0, sizeof(iwe)); + iwe.cmd = SIOCGIWNAME; + + + { + PBSS_ENTRY pBssEntry=&pAdapter->ScanTab.BssEntry[i]; + BOOLEAN isGonly=FALSE; + int rateCnt=0; + + if (pBssEntry->Channel>14) + { + if (pBssEntry->HtCapabilityLen!=0) + strcpy(iwe.u.name,"802.11a/n"); + else + strcpy(iwe.u.name,"802.11a"); + } + else + { + /* + if one of non B mode rate is set supported rate . it mean G only. + */ + for (rateCnt=0;rateCnt<pBssEntry->SupRateLen;rateCnt++) + { + /* + 6Mbps(140) 9Mbps(146) and >=12Mbps(152) are supported rate , it mean G only. + */ + if (pBssEntry->SupRate[rateCnt]==140 || pBssEntry->SupRate[rateCnt]==146 || pBssEntry->SupRate[rateCnt]>=152) + isGonly=TRUE; + } + + for (rateCnt=0;rateCnt<pBssEntry->ExtRateLen;rateCnt++) + { + if (pBssEntry->ExtRate[rateCnt]==140 || pBssEntry->ExtRate[rateCnt]==146 || pBssEntry->ExtRate[rateCnt]>=152) + isGonly=TRUE; + } + + + if (pBssEntry->HtCapabilityLen!=0) + { + if (isGonly==TRUE) + strcpy(iwe.u.name,"802.11g/n"); + else + strcpy(iwe.u.name,"802.11b/g/n"); + } + else + { + if (isGonly==TRUE) + strcpy(iwe.u.name,"802.11g"); + else + { + if (pBssEntry->SupRateLen==4 && pBssEntry->ExtRateLen==0) + strcpy(iwe.u.name,"802.11b"); + else + strcpy(iwe.u.name,"802.11b/g"); + } + } + } + } + + previous_ev = current_ev; + current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_ADDR_LEN); +#endif /* RT30xx */ if (current_ev == previous_ev) #if WIRELESS_EXT >= 17 return -E2BIG; @@ -1351,6 +1494,7 @@ int rt_ioctl_giwessid(struct net_device *dev, struct iw_request_info *info, struct iw_point *data, char *essid) { +#ifndef RT30xx PRTMP_ADAPTER pAdapter = NULL; VIRTUAL_ADAPTER *pVirtualAd = NULL; @@ -1371,6 +1515,10 @@ int rt_ioctl_giwessid(struct net_device *dev, So the net_dev->ml_priv will be NULL in 2rd open */ return -ENETDOWN; } +#endif +#ifdef RT30xx + PRTMP_ADAPTER pAdapter = dev->ml_priv; +#endif data->flags = 1; if (MONITOR_ON(pAdapter)) @@ -1385,6 +1533,14 @@ int rt_ioctl_giwessid(struct net_device *dev, data->length = pAdapter->CommonCfg.SsidLen; memcpy(essid, pAdapter->CommonCfg.Ssid, pAdapter->CommonCfg.SsidLen); } +#ifdef RT2870 + // Add for RT2870 + else if (pAdapter->StaCfg.WpaSupplicantUP != WPA_SUPPLICANT_DISABLE) + { + data->length = pAdapter->CommonCfg.SsidLen; + memcpy(essid, pAdapter->CommonCfg.Ssid, pAdapter->CommonCfg.SsidLen); + } +#endif // RT2870 // else {//the ANY ssid was specified data->length = 0; @@ -1422,6 +1578,7 @@ int rt_ioctl_giwnickn(struct net_device *dev, struct iw_request_info *info, struct iw_point *data, char *nickname) { +#ifndef RT30xx PRTMP_ADAPTER pAdapter = NULL; VIRTUAL_ADAPTER *pVirtualAd = NULL; @@ -1442,6 +1599,10 @@ int rt_ioctl_giwnickn(struct net_device *dev, So the net_dev->ml_priv will be NULL in 2rd open */ return -ENETDOWN; } +#endif +#ifdef RT30xx + PRTMP_ADAPTER pAdapter = dev->ml_priv; +#endif if (data->length > strlen(pAdapter->nickname) + 1) data->length = strlen(pAdapter->nickname) + 1; @@ -1485,6 +1646,7 @@ int rt_ioctl_giwrts(struct net_device *dev, struct iw_request_info *info, struct iw_param *rts, char *extra) { +#ifndef RT30xx PRTMP_ADAPTER pAdapter = NULL; VIRTUAL_ADAPTER *pVirtualAd = NULL; @@ -1505,6 +1667,10 @@ int rt_ioctl_giwrts(struct net_device *dev, So the net_dev->ml_priv will be NULL in 2rd open */ return -ENETDOWN; } +#endif +#ifdef RT30xx + PRTMP_ADAPTER pAdapter = dev->ml_priv; +#endif //check if the interface is down if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) @@ -1551,6 +1717,7 @@ int rt_ioctl_giwfrag(struct net_device *dev, struct iw_request_info *info, struct iw_param *frag, char *extra) { +#ifndef RT30xx PRTMP_ADAPTER pAdapter = NULL; VIRTUAL_ADAPTER *pVirtualAd = NULL; @@ -1571,6 +1738,10 @@ int rt_ioctl_giwfrag(struct net_device *dev, So the net_dev->ml_priv will be NULL in 2rd open */ return -ENETDOWN; } +#endif +#ifdef RT30xx + PRTMP_ADAPTER pAdapter = dev->ml_priv; +#endif //check if the interface is down if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) @@ -1611,8 +1782,13 @@ int rt_ioctl_siwencode(struct net_device *dev, pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeOpen; goto done; } +#ifndef RT30xx else if ((erq->length == 0) && (erq->flags & IW_ENCODE_RESTRICTED || erq->flags & IW_ENCODE_OPEN)) +#endif +#ifdef RT30xx + else if (erq->flags & IW_ENCODE_RESTRICTED || erq->flags & IW_ENCODE_OPEN) +#endif { STA_PORT_SECURED(pAdapter); pAdapter->StaCfg.PairCipher = Ndis802_11WEPEnabled; @@ -1623,7 +1799,9 @@ int rt_ioctl_siwencode(struct net_device *dev, pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeShared; else pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeOpen; +#ifndef RT30xx goto done; +#endif } if (erq->length > 0) @@ -1642,6 +1820,12 @@ int rt_ioctl_siwencode(struct net_device *dev, //Using default key keyIdx = pAdapter->StaCfg.DefaultKeyId; } +#ifdef RT30xx + else + { + pAdapter->StaCfg.DefaultKeyId=keyIdx; + } +#endif NdisZeroMemory(pAdapter->SharedKey[BSS0][keyIdx].Key, 16); @@ -1693,7 +1877,11 @@ rt_ioctl_giwencode(struct net_device *dev, struct iw_request_info *info, struct iw_point *erq, char *key) { +#ifdef RT30xx + PRTMP_ADAPTER pAdapter = dev->ml_priv; +#endif int kid; +#ifndef RT30xx PRTMP_ADAPTER pAdapter = NULL; VIRTUAL_ADAPTER *pVirtualAd = NULL; @@ -1714,6 +1902,7 @@ rt_ioctl_giwencode(struct net_device *dev, So the net_dev->ml_priv will be NULL in 2rd open */ return -ENETDOWN; } +#endif //check if the interface is down if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) @@ -2046,6 +2235,14 @@ rt_private_show(struct net_device *dev, struct iw_request_info *info, wrq->length = strlen(extra) + 1; // 1: size of '\0' break; case RAIO_ON: +#ifdef RT2870 + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) + { + sprintf(extra, "Scanning\n"); + wrq->length = strlen(extra) + 1; // 1: size of '\0' + break; + } +#endif pAd->StaCfg.bSwRadio = TRUE; //if (pAd->StaCfg.bRadio != (pAd->StaCfg.bHwRadio && pAd->StaCfg.bSwRadio)) { @@ -2068,6 +2265,12 @@ rt_private_show(struct net_device *dev, struct iw_request_info *info, wrq->length = strlen(extra) + 1; // 1: size of '\0' } break; +#if !defined(RT2860) && !defined(RT30xx) + case SHOW_ADHOC_ENTRY_INFO: + Show_Adhoc_MacTable_Proc(pAd, extra); + wrq->length = strlen(extra) + 1; // 1: size of '\0' + break; +#endif default: DBGPRINT(RT_DEBUG_TRACE, ("%s - unknow subcmd = %d\n", __func__, subcmd)); break; @@ -2311,6 +2514,7 @@ void fnSetCipherKey( IN BOOLEAN bGTK, IN struct iw_encode_ext *ext) { +#ifdef RT2860 RTMP_CLEAR_PSFLAG(pAdapter, fRTMP_PS_CAN_GO_SLEEP); if (RTMP_TEST_PSFLAG(pAdapter, fRTMP_PS_SET_PCI_CLK_OFF_COMMAND)) { @@ -2324,7 +2528,7 @@ void fnSetCipherKey( RTMPusecDelay(6000); pAdapter->bPCIclkOff = FALSE; } - +#endif NdisZeroMemory(&pAdapter->SharedKey[BSS0][keyIdx], sizeof(CIPHER_KEY)); pAdapter->SharedKey[BSS0][keyIdx].KeyLen = LEN_TKIP_EK; NdisMoveMemory(pAdapter->SharedKey[BSS0][keyIdx].Key, ext->key, LEN_TKIP_EK); @@ -2355,8 +2559,9 @@ void fnSetCipherKey( keyIdx, pAdapter->SharedKey[BSS0][keyIdx].CipherAlg, &pAdapter->MacTab.Content[BSSID_WCID]); - +#ifdef RT2860 RTMP_SET_PSFLAG(pAdapter, fRTMP_PS_CAN_GO_SLEEP); +#endif } int rt_ioctl_siwencodeext(struct net_device *dev, @@ -2421,7 +2626,7 @@ int rt_ioctl_siwencodeext(struct net_device *dev, NdisZeroMemory(pAdapter->SharedKey[BSS0][keyIdx].Key, 16); NdisMoveMemory(pAdapter->SharedKey[BSS0][keyIdx].Key, ext->key, ext->key_len); - +#ifndef RT30xx if (pAdapter->StaCfg.GroupCipher == Ndis802_11GroupWEP40Enabled || pAdapter->StaCfg.GroupCipher == Ndis802_11GroupWEP104Enabled) { @@ -2436,6 +2641,7 @@ int rt_ioctl_siwencodeext(struct net_device *dev, // Indicate Connected for GUI pAdapter->IndicateMediaState = NdisMediaStateConnected; } +#endif break; case IW_ENCODE_ALG_TKIP: DBGPRINT(RT_DEBUG_TRACE, ("%s::IW_ENCODE_ALG_TKIP - keyIdx = %d, ext->key_len = %d\n", __func__, keyIdx, ext->key_len)); @@ -2747,7 +2953,12 @@ rt_private_ioctl_bbp(struct net_device *dev, struct iw_request_info *info, DBGPRINT(RT_DEBUG_TRACE, ("this_char=%s, value=%s\n", this_char, value)); if (sscanf(this_char, "%d", &(bbpId)) == 1) { +#ifndef RT30xx if (bbpId <= 136) +#endif // RT30xx // +#ifdef RT30xx + if (bbpId <= 138) // edit by johnli, RF power sequence setup, add BBP R138 for ADC dynamic on/off control +#endif // RT30xx // { { RTMP_BBP_IO_READ8_BY_REG_ID(pAdapter, bbpId, ®BBP); @@ -2772,7 +2983,12 @@ rt_private_ioctl_bbp(struct net_device *dev, struct iw_request_info *info, { //Write if ((sscanf(this_char, "%d", &(bbpId)) == 1) && (sscanf(value, "%x", &(bbpValue)) == 1)) { +#ifndef RT30xx if (bbpId <= 136) +#endif // RT30xx // +#ifdef RT30xx + if (bbpId <= 138) // edit by johnli, RF power sequence setup, add BBP R138 for ADC dynamic on/off control +#endif // RT30xx // { { RTMP_BBP_IO_WRITE8_BY_REG_ID(pAdapter, bbpId, bbpValue); @@ -2804,14 +3020,24 @@ next: { memset(extra, 0x00, IW_PRIV_SIZE_MASK); sprintf(extra, "\n"); +#ifndef RT30xx for (bbpId = 0; bbpId <= 136; bbpId++) +#endif // RT30xx // +#ifdef RT30xx + for (bbpId = 0; bbpId <= 138; bbpId++) // edit by johnli, RF power sequence setup, add BBP R138 for ADC dynamic on/off control +#endif // RT30xx // { if (strlen(extra) >= (IW_PRIV_SIZE_MASK - 10)) break; RTMP_BBP_IO_READ8_BY_REG_ID(pAdapter, bbpId, ®BBP); +#ifndef RT30xx sprintf(extra+strlen(extra), "R%02d[0x%02X]:%02X ", bbpId, bbpId*2, regBBP); if (bbpId%5 == 4) sprintf(extra+strlen(extra), "\n"); +#endif +#ifdef RT30xx + sprintf(extra+strlen(extra), "%03d = %02X\n", bbpId, regBBP); // edit by johnli, change display format +#endif } wrq->length = strlen(extra) + 1; // 1: size of '\0' @@ -3300,9 +3526,14 @@ INT RTMPSetInformation( { // allow dynamic change of "USE OFDM rate or not" in ADHOC mode // if setting changed, need to reset current TX rate as well as BEACON frame format +#ifdef RT30xx + pAdapter->CommonCfg.PhyMode = StaConfig.AdhocMode; +#endif if (pAdapter->StaCfg.BssType == BSS_ADHOC) { +#ifndef RT30xx pAdapter->CommonCfg.PhyMode = StaConfig.AdhocMode; +#endif RTMPSetPhyMode(pAdapter, PhyMode); MlmeUpdateTxRates(pAdapter, FALSE, 0); MakeIbssBeacon(pAdapter); // re-build BEACON frame @@ -3466,6 +3697,15 @@ INT RTMPSetInformation( pAdapter->Counters8023.RxNoBuffer = 0; pAdapter->Counters8023.GoodReceives = 0; pAdapter->Counters8023.RxNoBuffer = 0; +#ifdef RT2870 + pAdapter->BulkOutComplete = 0; + pAdapter->BulkOutCompleteOther= 0; + pAdapter->BulkOutCompleteCancel = 0; + pAdapter->BulkOutReq = 0; + pAdapter->BulkInReq= 0; + pAdapter->BulkInComplete = 0; + pAdapter->BulkInCompleteFail = 0; +#endif // RT2870 // DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_RESET_COUNTERS \n")); break; case OID_802_11_RTS_THRESHOLD: @@ -4012,8 +4252,13 @@ INT RTMPSetInformation( pAdapter->StaCfg.DesireSharedKey[KeyIdx].CipherAlg = CipherAlg; pAdapter->StaCfg.DefaultKeyId = (UCHAR) KeyIdx; } - +#ifndef RT30xx +#ifdef RT2860 if ((pAdapter->StaCfg.WpaSupplicantUP != 0) && +#endif +#ifdef RT2870 + if ((pAdapter->StaCfg.WpaSupplicantUP != WPA_SUPPLICANT_DISABLE) && +#endif (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA)) { Key = pWepKey->KeyMaterial; @@ -4030,6 +4275,10 @@ INT RTMPSetInformation( pAdapter->IndicateMediaState = NdisMediaStateConnected; } else if (pAdapter->StaCfg.PortSecured == WPA_802_1X_PORT_SECURED) +#endif +#ifdef RT30xx + if (pAdapter->StaCfg.PortSecured == WPA_802_1X_PORT_SECURED) +#endif { Key = pAdapter->SharedKey[BSS0][KeyIdx].Key; @@ -5054,6 +5303,9 @@ INT rt28xx_sta_ioctl( Status = -EOPNOTSUPP; break; case RT_PRIV_IOCTL: +#ifdef RT30xx + case RT_PRIV_IOCTL_EXT: +#endif subcmd = wrq->u.data.flags; if( subcmd & OID_GET_SET_TOGGLE) Status = RTMPSetInformation(pAd, rq, subcmd); @@ -5085,6 +5337,11 @@ INT rt28xx_sta_ioctl( case RTPRIV_IOCTL_E2P: RTMPIoctlE2PROM(pAd, wrq); break; +#ifdef RT30xx + case RTPRIV_IOCTL_RF: + RTMPIoctlRF(pAd, wrq); + break; +#endif // RT30xx // #endif // DBG // case SIOCETHTOOL: break; @@ -5180,6 +5437,9 @@ INT Set_WmmCapable_Proc( bWmmCapable = simple_strtol(arg, 0, 10); if ((bWmmCapable == 1) +#ifdef RT2870 + && (pAd->NumberOfPipes >= 5) +#endif // RT2870 // ) pAd->CommonCfg.bWmmCapable = TRUE; else if (bWmmCapable == 0) @@ -6012,7 +6272,9 @@ VOID RTMPIoctlMAC( UCHAR temp[16], temp2[16]; UINT32 macValue = 0; INT Status; - +#ifdef RT30xx + BOOLEAN bIsPrintAllMAC = FALSE; +#endif memset(msg, 0x00, 1024); if (wrq->u.data.length > 1) //No parameters. @@ -6063,7 +6325,13 @@ VOID RTMPIoctlMAC( sprintf(msg+strlen(msg), "[0x%08lX]:%08X ", macAddr , macValue); } else +#ifndef RT30xx {//Invalid parametes, so default printk all bbp +#endif +#ifdef RT30xx + {//Invalid parametes, so default printk all mac + bIsPrintAllMAC = TRUE; +#endif goto next; } } @@ -6147,7 +6415,52 @@ VOID RTMPIoctlMAC( } } } +#ifdef RT30xx + else + bIsPrintAllMAC = TRUE; +#endif next: +#ifdef RT30xx + if (bIsPrintAllMAC) + { + struct file *file_w; + PCHAR fileName = "MacDump.txt"; + mm_segment_t orig_fs; + + orig_fs = get_fs(); + set_fs(KERNEL_DS); + + // open file + file_w = filp_open(fileName, O_WRONLY|O_CREAT, 0); + if (IS_ERR(file_w)) + { + DBGPRINT(RT_DEBUG_TRACE, ("-->2) %s: Error %ld opening %s\n", __func__, -PTR_ERR(file_w), fileName)); + } + else + { + if (file_w->f_op && file_w->f_op->write) + { + file_w->f_pos = 0; + macAddr = 0x1000; + + while (macAddr <= 0x1800) + { + RTMP_IO_READ32(pAdapter, macAddr, &macValue); + sprintf(msg, "%08lx = %08X\n", macAddr, macValue); + + // write data to file + file_w->f_op->write(file_w, msg, strlen(msg), &file_w->f_pos); + + printk("%s", msg); + macAddr += 4; + } + sprintf(msg, "\nDump all MAC values to %s\n", fileName); + } + filp_close(file_w, NULL); + } + set_fs(orig_fs); + } +#endif /* RT30xx */ if(strlen(msg) == 1) sprintf(msg+strlen(msg), "===>Error command format!"); @@ -6188,7 +6501,9 @@ VOID RTMPIoctlE2PROM( UCHAR temp[16], temp2[16]; USHORT eepValue; int Status; - +#ifdef RT30xx + BOOLEAN bIsPrintAllE2P = FALSE; +#endif memset(msg, 0x00, 1024); if (wrq->u.data.length > 1) //No parameters. @@ -6242,6 +6557,9 @@ VOID RTMPIoctlE2PROM( } else {//Invalid parametes, so default printk all bbp +#ifdef RT30xx + bIsPrintAllE2P = TRUE; +#endif goto next; } } @@ -6300,7 +6618,52 @@ VOID RTMPIoctlE2PROM( sprintf(msg+strlen(msg), "[0x%02X]:%02X ", eepAddr, eepValue); } } +#ifdef RT30xx + else + bIsPrintAllE2P = TRUE; +#endif next: +#ifdef RT30xx + if (bIsPrintAllE2P) + { + struct file *file_w; + PCHAR fileName = "EEPROMDump.txt"; + mm_segment_t orig_fs; + + orig_fs = get_fs(); + set_fs(KERNEL_DS); + + // open file + file_w = filp_open(fileName, O_WRONLY|O_CREAT, 0); + if (IS_ERR(file_w)) + { + DBGPRINT(RT_DEBUG_TRACE, ("-->2) %s: Error %ld opening %s\n", __func__, -PTR_ERR(file_w), fileName)); + } + else + { + if (file_w->f_op && file_w->f_op->write) + { + file_w->f_pos = 0; + eepAddr = 0x00; + + while (eepAddr <= 0xFE) + { + RT28xx_EEPROM_READ16(pAdapter, eepAddr, eepValue); + sprintf(msg, "%08x = %04x\n", eepAddr , eepValue); + + // write data to file + file_w->f_op->write(file_w, msg, strlen(msg), &file_w->f_pos); + + printk("%s", msg); + eepAddr += 2; + } + sprintf(msg, "\nDump all EEPROM values to %s\n", fileName); + } + filp_close(file_w, NULL); + } + set_fs(orig_fs); + } +#endif /* RT30xx */ if(strlen(msg) == 1) sprintf(msg+strlen(msg), "===>Error command format!"); @@ -6311,6 +6674,154 @@ next: DBGPRINT(RT_DEBUG_TRACE, ("<==RTMPIoctlE2PROM\n")); } +#ifdef RT30xx +/* + ========================================================================== + Description: + Read / Write RF register +Arguments: + pAdapter Pointer to our adapter + wrq Pointer to the ioctl argument + + Return Value: + None + + Note: + Usage: + 1.) iwpriv ra0 rf ==> read all RF registers + 2.) iwpriv ra0 rf 1 ==> read RF where RegID=1 + 3.) iwpriv ra0 rf 1=10 ==> write RF R1=0x10 + ========================================================================== +*/ +VOID RTMPIoctlRF( + IN PRTMP_ADAPTER pAdapter, + IN struct iwreq *wrq) +{ + CHAR *this_char; + CHAR *value; + UCHAR regRF = 0; + CHAR msg[2048]; + CHAR arg[255]; + INT rfId; + LONG rfValue; + int Status; + BOOLEAN bIsPrintAllRF = FALSE; + + + memset(msg, 0x00, 2048); + if (wrq->u.data.length > 1) //No parameters. + { + Status = copy_from_user(arg, wrq->u.data.pointer, (wrq->u.data.length > 255) ? 255 : wrq->u.data.length); + sprintf(msg, "\n"); + + //Parsing Read or Write + this_char = arg; + if (!*this_char) + goto next; + + if ((value = strchr(this_char, '=')) != NULL) + *value++ = 0; + + if (!value || !*value) + { //Read + if (sscanf(this_char, "%d", &(rfId)) == 1) + { + if (rfId <= 31) + { + // In RT2860 ATE mode, we do not load 8051 firmware. + //We must access RF directly. + // For RT2870 ATE mode, ATE_RF_IO_WRITE8(/READ8)_BY_REG_ID are redefined. + // according to Andy, Gary, David require. + // the command rf shall read rf register directly for dubug. + // BBP_IO_READ8_BY_REG_ID(pAdapter, bbpId, ®BBP); + RT30xxReadRFRegister(pAdapter, rfId, ®RF); + + sprintf(msg+strlen(msg), "R%02d[0x%02x]:%02X ", rfId, rfId*2, regRF); + } + else + {//Invalid parametes, so default printk all RF + bIsPrintAllRF = TRUE; + goto next; + } + } + else + { //Invalid parametes, so default printk all RF + bIsPrintAllRF = TRUE; + goto next; + } + } + else + { //Write + if ((sscanf(this_char, "%d", &(rfId)) == 1) && (sscanf(value, "%lx", &(rfValue)) == 1)) + { + if (rfId <= 31) + { + // In RT2860 ATE mode, we do not load 8051 firmware. + // We should access RF registers directly. + // For RT2870 ATE mode, ATE_RF_IO_WRITE8/READ8_BY_REG_ID are redefined. + { + // according to Andy, Gary, David require. + // the command RF shall read/write RF register directly for dubug. + //BBP_IO_READ8_BY_REG_ID(pAdapter, bbpId, ®BBP); + //BBP_IO_WRITE8_BY_REG_ID(pAdapter, (UCHAR)bbpId,(UCHAR) bbpValue); + RT30xxReadRFRegister(pAdapter, rfId, ®RF); + RT30xxWriteRFRegister(pAdapter, (UCHAR)rfId,(UCHAR) rfValue); + //Read it back for showing + //BBP_IO_READ8_BY_REG_ID(pAdapter, bbpId, ®BBP); + RT30xxReadRFRegister(pAdapter, rfId, ®RF); + sprintf(msg+strlen(msg), "R%02d[0x%02X]:%02X\n", rfId, rfId*2, regRF); + } + } + else + {//Invalid parametes, so default printk all RF + bIsPrintAllRF = TRUE; + } + } + else + { //Invalid parametes, so default printk all RF + bIsPrintAllRF = TRUE; + } + } + } + else + bIsPrintAllRF = TRUE; +next: + if (bIsPrintAllRF) + { + memset(msg, 0x00, 2048); + sprintf(msg, "\n"); + for (rfId = 0; rfId <= 31; rfId++) + { + // according to Andy, Gary, David require. + // the command RF shall read/write RF register directly for dubug. + RT30xxReadRFRegister(pAdapter, rfId, ®RF); + sprintf(msg+strlen(msg), "%03d = %02X\n", rfId, regRF); + } + // Copy the information into the user buffer + DBGPRINT(RT_DEBUG_TRACE, ("strlen(msg)=%d\n", (UINT32)strlen(msg))); + wrq->u.data.length = strlen(msg); + if (copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length)) + { + DBGPRINT(RT_DEBUG_TRACE, ("%s: copy_to_user() fail\n", __func__)); + } + } + else + { + if(strlen(msg) == 1) + sprintf(msg+strlen(msg), "===>Error command format!"); + + DBGPRINT(RT_DEBUG_TRACE, ("copy to user [msg=%s]\n", msg)); + // Copy the information into the user buffer + DBGPRINT(RT_DEBUG_TRACE, ("strlen(msg) =%d\n", (UINT32)strlen(msg))); + + // Copy the information into the user buffer + wrq->u.data.length = strlen(msg); + Status = copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length); + } + + DBGPRINT(RT_DEBUG_TRACE, ("<==RTMPIoctlRF\n\n")); +} +#endif // RT30xx // #endif // DBG // @@ -6356,3 +6867,48 @@ INT Set_ShortRetryLimit_Proc( DBGPRINT(RT_DEBUG_TRACE, ("IF Set_ShortRetryLimit_Proc::(tx_rty_cfg=0x%x)\n", tx_rty_cfg.word)); return TRUE; } + +#if !defined(RT2860) && !defined(RT30xx) +INT Show_Adhoc_MacTable_Proc( + IN PRTMP_ADAPTER pAd, + IN PCHAR extra) +{ + INT i; + + sprintf(extra, "\n"); + + sprintf(extra + strlen(extra), "HT Operating Mode : %d\n", pAd->CommonCfg.AddHTInfo.AddHtInfo2.OperaionMode); + + sprintf(extra + strlen(extra), "\n%-19s%-4s%-4s%-7s%-7s%-7s%-10s%-6s%-6s%-6s%-6s\n", + "MAC", "AID", "BSS", "RSSI0", "RSSI1", "RSSI2", "PhMd", "BW", "MCS", "SGI", "STBC"); + + for (i=1; i<MAX_LEN_OF_MAC_TABLE; i++) + { + PMAC_TABLE_ENTRY pEntry = &pAd->MacTab.Content[i]; + + if (strlen(extra) > (IW_PRIV_SIZE_MASK - 30)) + break; + if ((pEntry->ValidAsCLI || pEntry->ValidAsApCli) && (pEntry->Sst == SST_ASSOC)) + { + sprintf(extra + strlen(extra), "%02X:%02X:%02X:%02X:%02X:%02X ", + pEntry->Addr[0], pEntry->Addr[1], pEntry->Addr[2], + pEntry->Addr[3], pEntry->Addr[4], pEntry->Addr[5]); + sprintf(extra + strlen(extra), "%-4d", (int)pEntry->Aid); + sprintf(extra + strlen(extra), "%-4d", (int)pEntry->apidx); + sprintf(extra + strlen(extra), "%-7d", pEntry->RssiSample.AvgRssi0); + sprintf(extra + strlen(extra), "%-7d", pEntry->RssiSample.AvgRssi1); + sprintf(extra + strlen(extra), "%-7d", pEntry->RssiSample.AvgRssi2); + sprintf(extra + strlen(extra), "%-10s", GetPhyMode(pEntry->HTPhyMode.field.MODE)); + sprintf(extra + strlen(extra), "%-6s", GetBW(pEntry->HTPhyMode.field.BW)); + sprintf(extra + strlen(extra), "%-6d", pEntry->HTPhyMode.field.MCS); + sprintf(extra + strlen(extra), "%-6d", pEntry->HTPhyMode.field.ShortGI); + sprintf(extra + strlen(extra), "%-6d", pEntry->HTPhyMode.field.STBC); + sprintf(extra + strlen(extra), "%-10d, %d, %d%%\n", pEntry->DebugFIFOCount, pEntry->DebugTxCount, + (pEntry->DebugTxCount) ? ((pEntry->DebugTxCount-pEntry->DebugFIFOCount)*100/pEntry->DebugTxCount) : 0); + sprintf(extra, "%s\n", extra); + } + } + + return TRUE; +} +#endif /* RT2870 */ |