Staging: rt28x0: fix comments in common/*.c files

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Bartlomiej Zolnierkiewicz 2009-12-11 12:23:15 -08:00 committed by Greg Kroah-Hartman
parent 9f548a2a3d
commit ec278fa259
26 changed files with 3858 additions and 3864 deletions

View file

@ -113,13 +113,13 @@ VOID MlmeADDBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
NdisZeroMemory(&Frame, sizeof(FRAME_ADDBA_REQ));
if (MlmeAddBAReqSanity(pAd, Elem->Msg, Elem->MsgLen, Addr)) {
NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory
NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); /*Get an unused nonpaged memory */
if (NStatus != NDIS_STATUS_SUCCESS) {
DBGPRINT(RT_DEBUG_TRACE,
("BA - MlmeADDBAAction() allocate memory failed \n"));
return;
}
// 1. find entry
/* 1. find entry */
Idx =
pAd->MacTab.Content[pInfo->Wcid].BAOriWcidArray[pInfo->TID];
if (Idx == 0) {
@ -200,27 +200,27 @@ VOID MlmeDELBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
FRAME_BAR FrameBar;
pInfo = (MLME_DELBA_REQ_STRUCT *) Elem->Msg;
// must send back DELBA
/* must send back DELBA */
NdisZeroMemory(&Frame, sizeof(FRAME_DELBA_REQ));
DBGPRINT(RT_DEBUG_TRACE,
("==> MlmeDELBAAction(), Initiator(%d) \n", pInfo->Initiator));
if (MlmeDelBAReqSanity(pAd, Elem->Msg, Elem->MsgLen)) {
NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory
NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); /*Get an unused nonpaged memory */
if (NStatus != NDIS_STATUS_SUCCESS) {
DBGPRINT(RT_DEBUG_ERROR,
("BA - MlmeDELBAAction() allocate memory failed 1. \n"));
return;
}
NStatus = MlmeAllocateMemory(pAd, &pOutBuffer2); //Get an unused nonpaged memory
NStatus = MlmeAllocateMemory(pAd, &pOutBuffer2); /*Get an unused nonpaged memory */
if (NStatus != NDIS_STATUS_SUCCESS) {
MlmeFreeMemory(pAd, pOutBuffer);
DBGPRINT(RT_DEBUG_ERROR,
("BA - MlmeDELBAAction() allocate memory failed 2. \n"));
return;
}
// SEND BAR (Send BAR to refresh peer reordering buffer.)
/* SEND BAR (Send BAR to refresh peer reordering buffer.) */
Idx =
pAd->MacTab.Content[pInfo->Wcid].BAOriWcidArray[pInfo->TID];
@ -228,12 +228,12 @@ VOID MlmeDELBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
pAd->MacTab.Content[pInfo->Wcid].Addr,
pAd->CurrentAddress);
FrameBar.StartingSeq.field.FragNum = 0; // make sure sequence not clear in DEL funciton.
FrameBar.StartingSeq.field.StartSeq = pAd->MacTab.Content[pInfo->Wcid].TxSeq[pInfo->TID]; // make sure sequence not clear in DEL funciton.
FrameBar.BarControl.TID = pInfo->TID; // make sure sequence not clear in DEL funciton.
FrameBar.BarControl.ACKPolicy = IMMED_BA; // make sure sequence not clear in DEL funciton.
FrameBar.BarControl.Compressed = 1; // make sure sequence not clear in DEL funciton.
FrameBar.BarControl.MTID = 0; // make sure sequence not clear in DEL funciton.
FrameBar.StartingSeq.field.FragNum = 0; /* make sure sequence not clear in DEL funciton. */
FrameBar.StartingSeq.field.StartSeq = pAd->MacTab.Content[pInfo->Wcid].TxSeq[pInfo->TID]; /* make sure sequence not clear in DEL funciton. */
FrameBar.BarControl.TID = pInfo->TID; /* make sure sequence not clear in DEL funciton. */
FrameBar.BarControl.ACKPolicy = IMMED_BA; /* make sure sequence not clear in DEL funciton. */
FrameBar.BarControl.Compressed = 1; /* make sure sequence not clear in DEL funciton. */
FrameBar.BarControl.MTID = 0; /* make sure sequence not clear in DEL funciton. */
MakeOutgoingFrame(pOutBuffer2, &FrameLen,
sizeof(FRAME_BAR), &FrameBar, END_OF_ARGS);
@ -242,7 +242,7 @@ VOID MlmeDELBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
DBGPRINT(RT_DEBUG_TRACE,
("BA - MlmeDELBAAction() . Send BAR to refresh peer reordering buffer \n"));
// SEND DELBA FRAME
/* SEND DELBA FRAME */
FrameLen = 0;
{
@ -263,7 +263,7 @@ VOID MlmeDELBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
Frame.Action = DELBA;
Frame.DelbaParm.Initiator = pInfo->Initiator;
Frame.DelbaParm.TID = pInfo->TID;
Frame.ReasonCode = 39; // Time Out
Frame.ReasonCode = 39; /* Time Out */
*(USHORT *) (&Frame.DelbaParm) =
cpu2le16(*(USHORT *) (&Frame.DelbaParm));
Frame.ReasonCode = cpu2le16(Frame.ReasonCode);
@ -288,8 +288,8 @@ VOID MlmeDLSAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
VOID MlmeInvalidAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
{
//PUCHAR pOutBuffer = NULL;
//Return the receiving frame except the MSB of category filed set to 1. 7.3.1.11
/*PUCHAR pOutBuffer = NULL; */
/*Return the receiving frame except the MSB of category filed set to 1. 7.3.1.11 */
}
VOID PeerQOSAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
@ -347,20 +347,20 @@ static VOID respond_ht_information_exchange_action(IN PRTMP_ADAPTER pAd,
FRAME_HT_INFO HTINFOframe, *pFrame;
UCHAR *pAddr;
// 2. Always send back ADDBA Response
NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory
/* 2. Always send back ADDBA Response */
NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); /*Get an unused nonpaged memory */
if (NStatus != NDIS_STATUS_SUCCESS) {
DBGPRINT(RT_DEBUG_TRACE,
("ACTION - respond_ht_information_exchange_action() allocate memory failed \n"));
return;
}
// get RA
/* get RA */
pFrame = (FRAME_HT_INFO *) & Elem->Msg[0];
pAddr = pFrame->Hdr.Addr2;
NdisZeroMemory(&HTINFOframe, sizeof(FRAME_HT_INFO));
// 2-1. Prepare ADDBA Response frame.
/* 2-1. Prepare ADDBA Response frame. */
{
if (ADHOC_ON(pAd))
ActHeaderInit(pAd, &HTINFOframe.Hdr, pAddr,
@ -400,21 +400,21 @@ VOID PeerHTAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
("ACTION - HT Notify Channel bandwidth action----> \n"));
if (pAd->StaActive.SupportedPhyInfo.bHtEnable == FALSE) {
// Note, this is to patch DIR-1353 AP. When the AP set to Wep, it will use legacy mode. But AP still keeps
// sending BW_Notify Action frame, and cause us to linkup and linkdown.
// In legacy mode, don't need to parse HT action frame.
/* Note, this is to patch DIR-1353 AP. When the AP set to Wep, it will use legacy mode. But AP still keeps */
/* sending BW_Notify Action frame, and cause us to linkup and linkdown. */
/* In legacy mode, don't need to parse HT action frame. */
DBGPRINT(RT_DEBUG_TRACE,
("ACTION -Ignore HT Notify Channel BW when link as legacy mode. BW = %d---> \n",
Elem->Msg[LENGTH_802_11 + 2]));
break;
}
if (Elem->Msg[LENGTH_802_11 + 2] == 0) // 7.4.8.2. if value is 1, keep the same as supported channel bandwidth.
if (Elem->Msg[LENGTH_802_11 + 2] == 0) /* 7.4.8.2. if value is 1, keep the same as supported channel bandwidth. */
pAd->MacTab.Content[Elem->Wcid].HTPhyMode.field.BW = 0;
break;
case SMPS_ACTION:
// 7.3.1.25
/* 7.3.1.25 */
DBGPRINT(RT_DEBUG_TRACE, ("ACTION - SMPS action----> \n"));
if (((Elem->Msg[LENGTH_802_11 + 2] & 0x1) == 0)) {
pAd->MacTab.Content[Elem->Wcid].MmpsMode = MMPS_ENABLE;
@ -427,7 +427,7 @@ VOID PeerHTAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
DBGPRINT(RT_DEBUG_TRACE,
("Aid(%d) MIMO PS = %d\n", Elem->Wcid,
pAd->MacTab.Content[Elem->Wcid].MmpsMode));
// rt2860c : add something for smps change.
/* rt2860c : add something for smps change. */
break;
case SETPCO_ACTION:
@ -441,7 +441,7 @@ VOID PeerHTAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
pHT_info =
(HT_INFORMATION_OCTET *) & Elem->Msg[LENGTH_802_11 +
2];
// 7.4.8.10
/* 7.4.8.10 */
DBGPRINT(RT_DEBUG_TRACE,
("ACTION - HT Information Exchange action----> \n"));
if (pHT_info->Request) {
@ -512,7 +512,7 @@ VOID SendRefreshBAR(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry)
ASSERT(pBAEntry->Wcid < MAX_LEN_OF_MAC_TABLE);
NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory
NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); /*Get an unused nonpaged memory */
if (NStatus != NDIS_STATUS_SUCCESS) {
DBGPRINT(RT_DEBUG_ERROR,
("BA - MlmeADDBAAction() allocate memory failed \n"));
@ -524,17 +524,17 @@ VOID SendRefreshBAR(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry)
BarHeaderInit(pAd, &FrameBar, pEntry->Addr,
pAd->CurrentAddress);
FrameBar.StartingSeq.field.FragNum = 0; // make sure sequence not clear in DEL function.
FrameBar.StartingSeq.field.StartSeq = Sequence; // make sure sequence not clear in DEL funciton.
FrameBar.BarControl.TID = TID; // make sure sequence not clear in DEL funciton.
FrameBar.StartingSeq.field.FragNum = 0; /* make sure sequence not clear in DEL function. */
FrameBar.StartingSeq.field.StartSeq = Sequence; /* make sure sequence not clear in DEL funciton. */
FrameBar.BarControl.TID = TID; /* make sure sequence not clear in DEL funciton. */
MakeOutgoingFrame(pOutBuffer, &FrameLen,
sizeof(FRAME_BAR), &FrameBar,
END_OF_ARGS);
//if (!(CLIENT_STATUS_TEST_FLAG(pEntry, fCLIENT_STATUS_RALINK_CHIPSET)))
if (1) // Now we always send BAR.
/*if (!(CLIENT_STATUS_TEST_FLAG(pEntry, fCLIENT_STATUS_RALINK_CHIPSET))) */
if (1) /* Now we always send BAR. */
{
//MiniportMMRequestUnlock(pAd, 0, pOutBuffer, FrameLen);
/*MiniportMMRequestUnlock(pAd, 0, pOutBuffer, FrameLen); */
MiniportMMRequest(pAd,
(MGMT_USE_QUEUE_FLAG |
MapUserPriorityToAccessCategory

View file

@ -27,14 +27,14 @@
#include "../rt_config.h"
#define BA_ORI_INIT_SEQ (pEntry->TxSeq[TID]) //1 // inital sequence number of BA session
#define BA_ORI_INIT_SEQ (pEntry->TxSeq[TID]) /*1 // inital sequence number of BA session */
#define ORI_SESSION_MAX_RETRY 8
#define ORI_BA_SESSION_TIMEOUT (2000) // ms
#define REC_BA_SESSION_IDLE_TIMEOUT (1000) // ms
#define ORI_BA_SESSION_TIMEOUT (2000) /* ms */
#define REC_BA_SESSION_IDLE_TIMEOUT (1000) /* ms */
#define REORDERING_PACKET_TIMEOUT ((100 * OS_HZ)/1000) // system ticks -- 100 ms
#define MAX_REORDERING_PACKET_TIMEOUT ((3000 * OS_HZ)/1000) // system ticks -- 100 ms
#define REORDERING_PACKET_TIMEOUT ((100 * OS_HZ)/1000) /* system ticks -- 100 ms */
#define MAX_REORDERING_PACKET_TIMEOUT ((3000 * OS_HZ)/1000) /* system ticks -- 100 ms */
#define RESET_RCV_SEQ (0xFFFF)
@ -66,20 +66,20 @@ VOID BA_MaxWinSizeReasign(IN PRTMP_ADAPTER pAd,
{
UCHAR MaxSize;
if (pAd->MACVersion >= RALINK_2883_VERSION) // 3*3
if (pAd->MACVersion >= RALINK_2883_VERSION) /* 3*3 */
{
if (pAd->MACVersion >= RALINK_3070_VERSION) {
if (pEntryPeer->WepStatus !=
Ndis802_11EncryptionDisabled)
MaxSize = 7; // for non-open mode
MaxSize = 7; /* for non-open mode */
else
MaxSize = 13;
} else
MaxSize = 31;
} else if (pAd->MACVersion >= RALINK_2880E_VERSION) // 2880 e
} else if (pAd->MACVersion >= RALINK_2880E_VERSION) /* 2880 e */
{
if (pEntryPeer->WepStatus != Ndis802_11EncryptionDisabled)
MaxSize = 7; // for non-open mode
MaxSize = 7; /* for non-open mode */
else
MaxSize = 13;
} else
@ -108,9 +108,9 @@ void Announce_Reordering_Packet(IN PRTMP_ADAPTER pAd,
ASSERT(0);
BA_Reorder_AMSDU_Annnounce(pAd, pPacket);
} else {
//
// pass this 802.3 packet to upper layer or forward this packet to WM directly
//
/* */
/* pass this 802.3 packet to upper layer or forward this packet to WM directly */
/* */
ANNOUNCE_OR_FORWARD_802_3_PACKET(pAd, pPacket,
RTMP_GET_PACKET_IF(pPacket));
@ -275,7 +275,7 @@ BOOLEAN ba_reordering_resource_init(PRTMP_ADAPTER pAd, int num)
return (TRUE);
}
//static int blk_count=0; // sample take off, no use
/*static int blk_count=0; // sample take off, no use */
static struct reordering_mpdu *ba_mpdu_blk_alloc(PRTMP_ADAPTER pAd)
{
@ -284,7 +284,7 @@ static struct reordering_mpdu *ba_mpdu_blk_alloc(PRTMP_ADAPTER pAd)
NdisAcquireSpinLock(&pAd->mpdu_blk_pool.lock);
mpdu_blk = ba_dequeue(&pAd->mpdu_blk_pool.freelist);
if (mpdu_blk) {
// blk_count++;
/* blk_count++; */
/* reset mpdu_blk */
NdisZeroMemory(mpdu_blk, sizeof(struct reordering_mpdu));
}
@ -298,7 +298,7 @@ static void ba_mpdu_blk_free(PRTMP_ADAPTER pAd,
ASSERT(mpdu_blk);
NdisAcquireSpinLock(&pAd->mpdu_blk_pool.lock);
// blk_count--;
/* blk_count--; */
ba_enqueue(&pAd->mpdu_blk_pool.freelist, mpdu_blk);
NdisReleaseSpinLock(&pAd->mpdu_blk_pool.lock);
}
@ -380,17 +380,17 @@ static void ba_refresh_reordering_mpdus(IN PRTMP_ADAPTER pAd,
NdisReleaseSpinLock(&pBAEntry->RxReRingLock);
}
//static
/*static */
void ba_flush_reordering_timeout_mpdus(IN PRTMP_ADAPTER pAd,
IN PBA_REC_ENTRY pBAEntry,
IN ULONG Now32)
{
USHORT Sequence;
// if ((RTMP_TIME_AFTER((unsigned long)Now32, (unsigned long)(pBAEntry->LastIndSeqAtTimer+REORDERING_PACKET_TIMEOUT)) &&
// (pBAEntry->list.qlen > ((pBAEntry->BAWinSize*7)/8))) //||
// (RTMP_TIME_AFTER((unsigned long)Now32, (unsigned long)(pBAEntry->LastIndSeqAtTimer+(10*REORDERING_PACKET_TIMEOUT))) &&
// (pBAEntry->list.qlen > (pBAEntry->BAWinSize/8)))
/* if ((RTMP_TIME_AFTER((unsigned long)Now32, (unsigned long)(pBAEntry->LastIndSeqAtTimer+REORDERING_PACKET_TIMEOUT)) && */
/* (pBAEntry->list.qlen > ((pBAEntry->BAWinSize*7)/8))) //|| */
/* (RTMP_TIME_AFTER((unsigned long)Now32, (unsigned long)(pBAEntry->LastIndSeqAtTimer+(10*REORDERING_PACKET_TIMEOUT))) && */
/* (pBAEntry->list.qlen > (pBAEntry->BAWinSize/8))) */
if (RTMP_TIME_AFTER
((unsigned long)Now32,
(unsigned long)(pBAEntry->LastIndSeqAtTimer +
@ -413,16 +413,16 @@ void ba_flush_reordering_timeout_mpdus(IN PRTMP_ADAPTER pAd,
(REORDERING_PACKET_TIMEOUT)))
&& (pBAEntry->list.qlen > 0)
) {
//
// force LastIndSeq to shift to LastIndSeq+1
//
/* */
/* force LastIndSeq to shift to LastIndSeq+1 */
/* */
Sequence = (pBAEntry->LastIndSeq + 1) & MAXSEQ;
ba_indicate_reordering_mpdus_le_seq(pAd, pBAEntry, Sequence);
pBAEntry->LastIndSeqAtTimer = Now32;
pBAEntry->LastIndSeq = Sequence;
//
// indicate in-order mpdus
//
/* */
/* indicate in-order mpdus */
/* */
Sequence =
ba_indicate_reordering_mpdus_in_order(pAd, pBAEntry,
Sequence);
@ -446,7 +446,7 @@ VOID BAOriSessionSetUp(IN PRTMP_ADAPTER pAd,
IN USHORT TimeOut,
IN ULONG DelayTime, IN BOOLEAN isForced)
{
//MLME_ADDBA_REQ_STRUCT AddbaReq;
/*MLME_ADDBA_REQ_STRUCT AddbaReq; */
BA_ORI_ENTRY *pBAEntry = NULL;
USHORT Idx;
BOOLEAN Cancelled;
@ -455,20 +455,20 @@ VOID BAOriSessionSetUp(IN PRTMP_ADAPTER pAd,
&& (isForced == FALSE))
return;
// if this entry is limited to use legacy tx mode, it doesn't generate BA.
/* if this entry is limited to use legacy tx mode, it doesn't generate BA. */
if (RTMPStaFixedTxMode(pAd, pEntry) != FIXED_TXMODE_HT)
return;
if ((pEntry->BADeclineBitmap & (1 << TID)) && (isForced == FALSE)) {
// try again after 3 secs
/* try again after 3 secs */
DelayTime = 3000;
// DBGPRINT(RT_DEBUG_TRACE, ("DeCline BA from Peer\n"));
// return;
/* DBGPRINT(RT_DEBUG_TRACE, ("DeCline BA from Peer\n")); */
/* return; */
}
Idx = pEntry->BAOriWcidArray[TID];
if (Idx == 0) {
// allocate a BA session
/* allocate a BA session */
pBAEntry = BATableAllocOriEntry(pAd, &Idx);
if (pBAEntry == NULL) {
DBGPRINT(RT_DEBUG_TRACE,
@ -485,12 +485,12 @@ VOID BAOriSessionSetUp(IN PRTMP_ADAPTER pAd,
pEntry->BAOriWcidArray[TID] = Idx;
// Initialize BA session
/* Initialize BA session */
pBAEntry->ORI_BA_Status = Originator_WaitRes;
pBAEntry->Wcid = pEntry->Aid;
pBAEntry->BAWinSize = pAd->CommonCfg.BACapability.field.RxBAWinLimit;
pBAEntry->Sequence = BA_ORI_INIT_SEQ;
pBAEntry->Token = 1; // (2008-01-21) Jan Lee recommends it - this token can't be 0
pBAEntry->Token = 1; /* (2008-01-21) Jan Lee recommends it - this token can't be 0 */
pBAEntry->TID = TID;
pBAEntry->TimeOutValue = TimeOut;
pBAEntry->pAdapter = pAd;
@ -502,7 +502,7 @@ VOID BAOriSessionSetUp(IN PRTMP_ADAPTER pAd,
} else
RTMPCancelTimer(&pBAEntry->ORIBATimer, &Cancelled);
// set timer to send ADDBA request
/* set timer to send ADDBA request */
RTMPSetTimer(&pBAEntry->ORIBATimer, DelayTime);
}
@ -522,7 +522,7 @@ VOID BAOriSessionAdd(IN PRTMP_ADAPTER pAd,
Idx = pEntry->BAOriWcidArray[TID];
pBAEntry = &pAd->BATable.BAOriEntry[Idx];
// Start fill in parameters.
/* Start fill in parameters. */
if ((Idx != 0) && (pBAEntry->TID == TID)
&& (pBAEntry->ORI_BA_Status == Originator_WaitRes)) {
pBAEntry->BAWinSize =
@ -533,21 +533,21 @@ VOID BAOriSessionAdd(IN PRTMP_ADAPTER pAd,
pBAEntry->ORI_BA_Status = Originator_Done;
pAd->BATable.numDoneOriginator++;
// reset sequence number
/* reset sequence number */
pBAEntry->Sequence = BA_ORI_INIT_SEQ;
// Set Bitmap flag.
/* Set Bitmap flag. */
pEntry->TXBAbitmap |= (1 << TID);
RTMPCancelTimer(&pBAEntry->ORIBATimer, &Cancelled);
pBAEntry->ORIBATimer.TimerValue = 0; //pFrame->TimeOutValue;
pBAEntry->ORIBATimer.TimerValue = 0; /*pFrame->TimeOutValue; */
DBGPRINT(RT_DEBUG_TRACE,
("%s : TXBAbitmap = %x, BAWinSize = %d, TimeOut = %ld\n",
__func__, pEntry->TXBAbitmap, pBAEntry->BAWinSize,
pBAEntry->ORIBATimer.TimerValue));
// SEND BAR ;
NStatus = MlmeAllocateMemory(pAd, &pOutBuffer2); //Get an unused nonpaged memory
/* SEND BAR ; */
NStatus = MlmeAllocateMemory(pAd, &pOutBuffer2); /*Get an unused nonpaged memory */
if (NStatus != NDIS_STATUS_SUCCESS) {
DBGPRINT(RT_DEBUG_TRACE,
("BA - BAOriSessionAdd() allocate memory failed \n"));
@ -558,16 +558,16 @@ VOID BAOriSessionAdd(IN PRTMP_ADAPTER pAd,
pAd->MacTab.Content[pBAEntry->Wcid].Addr,
pAd->CurrentAddress);
FrameBar.StartingSeq.field.FragNum = 0; // make sure sequence not clear in DEL function.
FrameBar.StartingSeq.field.StartSeq = pBAEntry->Sequence; // make sure sequence not clear in DEL funciton.
FrameBar.BarControl.TID = pBAEntry->TID; // make sure sequence not clear in DEL funciton.
FrameBar.StartingSeq.field.FragNum = 0; /* make sure sequence not clear in DEL function. */
FrameBar.StartingSeq.field.StartSeq = pBAEntry->Sequence; /* make sure sequence not clear in DEL funciton. */
FrameBar.BarControl.TID = pBAEntry->TID; /* make sure sequence not clear in DEL funciton. */
MakeOutgoingFrame(pOutBuffer2, &FrameLen,
sizeof(FRAME_BAR), &FrameBar, END_OF_ARGS);
MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer2, FrameLen);
MlmeFreeMemory(pAd, pOutBuffer2);
if (pBAEntry->ORIBATimer.TimerValue)
RTMPSetTimer(&pBAEntry->ORIBATimer, pBAEntry->ORIBATimer.TimerValue); // in mSec
RTMPSetTimer(&pBAEntry->ORIBATimer, pBAEntry->ORIBATimer.TimerValue); /* in mSec */
}
}
@ -580,19 +580,19 @@ BOOLEAN BARecSessionAdd(IN PRTMP_ADAPTER pAd,
USHORT Idx;
UCHAR TID;
UCHAR BAWinSize;
//UINT32 Value;
//UINT offset;
/*UINT32 Value; */
/*UINT offset; */
ASSERT(pEntry);
// find TID
/* find TID */
TID = pFrame->BaParm.TID;
BAWinSize =
min(((UCHAR) pFrame->BaParm.BufSize),
(UCHAR) pAd->CommonCfg.BACapability.field.RxBAWinLimit);
// Intel patch
/* Intel patch */
if (BAWinSize == 0) {
BAWinSize = 64;
}
@ -603,7 +603,7 @@ BOOLEAN BARecSessionAdd(IN PRTMP_ADAPTER pAd,
pBAEntry = BATableAllocRecEntry(pAd, &Idx);
} else {
pBAEntry = &pAd->BATable.BARecEntry[Idx];
// flush all pending reordering mpdus
/* flush all pending reordering mpdus */
ba_refresh_reordering_mpdus(pAd, pBAEntry);
}
@ -612,7 +612,7 @@ BOOLEAN BARecSessionAdd(IN PRTMP_ADAPTER pAd,
pAd->BATable.numAsRecipient, Idx, pFrame->BaParm.BufSize,
BAWinSize));
// Start fill in parameters.
/* Start fill in parameters. */
if (pBAEntry != NULL) {
ASSERT(pBAEntry->list.qlen == 0);
@ -622,8 +622,8 @@ BOOLEAN BARecSessionAdd(IN PRTMP_ADAPTER pAd,
pBAEntry->TID = TID;
pBAEntry->TimeOutValue = pFrame->TimeOutValue;
pBAEntry->REC_BA_Status = Recipient_Accept;
// initial sequence number
pBAEntry->LastIndSeq = RESET_RCV_SEQ; //pFrame->BaStartSeq.field.StartSeq;
/* initial sequence number */
pBAEntry->LastIndSeq = RESET_RCV_SEQ; /*pFrame->BaStartSeq.field.StartSeq; */
DBGPRINT(RT_DEBUG_OFF,
("Start Seq = %08x\n",
@ -638,13 +638,13 @@ BOOLEAN BARecSessionAdd(IN PRTMP_ADAPTER pAd,
TRUE);
}
// Set Bitmap flag.
/* Set Bitmap flag. */
pEntry->RXBAbitmap |= (1 << TID);
pEntry->BARecWcidArray[TID] = Idx;
pEntry->BADeclineBitmap &= ~(1 << TID);
// Set BA session mask in WCID table.
/* Set BA session mask in WCID table. */
RTMP_ADD_BA_SESSION_TO_ASIC(pAd, pEntry->Aid, TID);
DBGPRINT(RT_DEBUG_TRACE,
@ -673,11 +673,11 @@ BA_REC_ENTRY *BATableAllocRecEntry(IN PRTMP_ADAPTER pAd, OUT USHORT * Idx)
MAX_BARECI_SESSION));
goto done;
}
// reserve idx 0 to identify BAWcidArray[TID] as empty
/* reserve idx 0 to identify BAWcidArray[TID] as empty */
for (i = 1; i < MAX_LEN_OF_BA_REC_TABLE; i++) {
pBAEntry = &pAd->BATable.BARecEntry[i];
if ((pBAEntry->REC_BA_Status == Recipient_NONE)) {
// get one
/* get one */
pAd->BATable.numAsRecipient++;
pBAEntry->REC_BA_Status = Recipient_USED;
*Idx = i;
@ -700,11 +700,11 @@ BA_ORI_ENTRY *BATableAllocOriEntry(IN PRTMP_ADAPTER pAd, OUT USHORT * Idx)
if (pAd->BATable.numAsOriginator >= (MAX_LEN_OF_BA_ORI_TABLE)) {
goto done;
}
// reserve idx 0 to identify BAWcidArray[TID] as empty
/* reserve idx 0 to identify BAWcidArray[TID] as empty */
for (i = 1; i < MAX_LEN_OF_BA_ORI_TABLE; i++) {
pBAEntry = &pAd->BATable.BAOriEntry[i];
if ((pBAEntry->ORI_BA_Status == Originator_NONE)) {
// get one
/* get one */
pAd->BATable.numAsOriginator++;
pBAEntry->ORI_BA_Status = Originator_USED;
pBAEntry->pAdapter = pAd;
@ -739,7 +739,7 @@ VOID BATableFreeOriEntry(IN PRTMP_ADAPTER pAd, IN ULONG Idx)
DBGPRINT(RT_DEBUG_TRACE,
("BATableFreeOriEntry numAsOriginator= %ld\n",
pAd->BATable.numAsRecipient));
// Erase Bitmap flag.
/* Erase Bitmap flag. */
}
ASSERT(pAd->BATable.numAsOriginator != 0);
@ -789,13 +789,13 @@ VOID BAOriSessionTearDown(IN OUT PRTMP_ADAPTER pAd,
if (Wcid >= MAX_LEN_OF_MAC_TABLE) {
return;
}
//
// Locate corresponding BA Originator Entry in BA Table with the (pAddr,TID).
//
/* */
/* Locate corresponding BA Originator Entry in BA Table with the (pAddr,TID). */
/* */
Idx = pAd->MacTab.Content[Wcid].BAOriWcidArray[TID];
if ((Idx == 0) || (Idx >= MAX_LEN_OF_BA_ORI_TABLE)) {
if (bForceSend == TRUE) {
// force send specified TID DelBA
/* force send specified TID DelBA */
MLME_DELBA_REQ_STRUCT DelbaReq;
MLME_QUEUE_ELEM *Elem =
(MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM),
@ -831,9 +831,9 @@ VOID BAOriSessionTearDown(IN OUT PRTMP_ADAPTER pAd,
DBGPRINT(RT_DEBUG_TRACE,
("\t===>Idx = %ld, Wcid=%d.TID=%d, ORI_BA_Status = %d \n", Idx,
Wcid, TID, pBAEntry->ORI_BA_Status));
//
// Prepare DelBA action frame and send to the peer.
//
/* */
/* Prepare DelBA action frame and send to the peer. */
/* */
if ((bPassive == FALSE) && (TID == pBAEntry->TID)
&& (pBAEntry->ORI_BA_Status == Originator_Done)) {
MLME_DELBA_REQ_STRUCT DelbaReq;
@ -863,7 +863,7 @@ VOID BAOriSessionTearDown(IN OUT PRTMP_ADAPTER pAd,
BATableFreeOriEntry(pAd, Idx);
if (bPassive) {
//BAOriSessionSetUp(pAd, &pAd->MacTab.Content[Wcid], TID, 0, 10000, TRUE);
/*BAOriSessionSetUp(pAd, &pAd->MacTab.Content[Wcid], TID, 0, 10000, TRUE); */
}
}
@ -876,9 +876,9 @@ VOID BARecSessionTearDown(IN OUT PRTMP_ADAPTER pAd,
if (Wcid >= MAX_LEN_OF_MAC_TABLE) {
return;
}
//
// Locate corresponding BA Originator Entry in BA Table with the (pAddr,TID).
//
/* */
/* Locate corresponding BA Originator Entry in BA Table with the (pAddr,TID). */
/* */
Idx = pAd->MacTab.Content[Wcid].BARecWcidArray[TID];
if (Idx == 0)
return;
@ -890,21 +890,21 @@ VOID BARecSessionTearDown(IN OUT PRTMP_ADAPTER pAd,
DBGPRINT(RT_DEBUG_TRACE,
("\t===>Idx = %ld, Wcid=%d.TID=%d, REC_BA_Status = %d \n", Idx,
Wcid, TID, pBAEntry->REC_BA_Status));
//
// Prepare DelBA action frame and send to the peer.
//
/* */
/* Prepare DelBA action frame and send to the peer. */
/* */
if ((TID == pBAEntry->TID)
&& (pBAEntry->REC_BA_Status == Recipient_Accept)) {
MLME_DELBA_REQ_STRUCT DelbaReq;
BOOLEAN Cancelled;
//ULONG offset;
//UINT32 VALUE;
/*ULONG offset; */
/*UINT32 VALUE; */
RTMPCancelTimer(&pBAEntry->RECBATimer, &Cancelled);
//
// 1. Send DELBA Action Frame
//
/* */
/* 1. Send DELBA Action Frame */
/* */
if (bPassive == FALSE) {
MLME_QUEUE_ELEM *Elem =
(MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM),
@ -931,18 +931,18 @@ VOID BARecSessionTearDown(IN OUT PRTMP_ADAPTER pAd,
}
}
//
// 2. Free resource of BA session
//
// flush all pending reordering mpdus
/* */
/* 2. Free resource of BA session */
/* */
/* flush all pending reordering mpdus */
ba_refresh_reordering_mpdus(pAd, pBAEntry);
NdisAcquireSpinLock(&pAd->BATabLock);
// Erase Bitmap flag.
/* Erase Bitmap flag. */
pBAEntry->LastIndSeq = RESET_RCV_SEQ;
pBAEntry->BAWinSize = 0;
// Erase Bitmap flag at software mactable
/* Erase Bitmap flag at software mactable */
pAd->MacTab.Content[Wcid].RXBAbitmap &=
(~(1 << (pBAEntry->TID)));
pAd->MacTab.Content[Wcid].BARecWcidArray[TID] = 0;
@ -995,7 +995,7 @@ VOID BAOriSessionSetupTimeout(IN PVOID SystemSpecific1,
pAd = pBAEntry->pAdapter;
{
// Do nothing if monitor mode is on
/* Do nothing if monitor mode is on */
if (MONITOR_ON(pAd))
return;
}
@ -1062,7 +1062,7 @@ VOID BARecSessionIdleTimeout(IN PVOID SystemSpecific1,
(unsigned long)(pBAEntry->LastIndSeqAtTimer +
REC_BA_SESSION_IDLE_TIMEOUT))) {
pAd = pBAEntry->pAdapter;
// flush all pending reordering mpdus
/* flush all pending reordering mpdus */
ba_refresh_reordering_mpdus(pAd, pBAEntry);
DBGPRINT(RT_DEBUG_OFF,
("%ld: REC BA session Timeout\n", Now32));
@ -1072,15 +1072,15 @@ VOID BARecSessionIdleTimeout(IN PVOID SystemSpecific1,
VOID PeerAddBAReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
{
// 7.4.4.1
//ULONG Idx;
/* 7.4.4.1 */
/*ULONG Idx; */
UCHAR Status = 1;
UCHAR pAddr[6];
FRAME_ADDBA_RSP ADDframe;
PUCHAR pOutBuffer = NULL;
NDIS_STATUS NStatus;
PFRAME_ADDBA_REQ pAddreqFrame = NULL;
//UCHAR BufSize;
/*UCHAR BufSize; */
ULONG FrameLen;
PULONG ptemp;
PMAC_TABLE_ENTRY pMacEntry;
@ -1088,16 +1088,16 @@ VOID PeerAddBAReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
DBGPRINT(RT_DEBUG_TRACE,
("%s ==> (Wcid = %d)\n", __func__, Elem->Wcid));
//hex_dump("AddBAReq", Elem->Msg, Elem->MsgLen);
/*hex_dump("AddBAReq", Elem->Msg, Elem->MsgLen); */
//ADDBA Request from unknown peer, ignore this.
/*ADDBA Request from unknown peer, ignore this. */
if (Elem->Wcid >= MAX_LEN_OF_MAC_TABLE)
return;
pMacEntry = &pAd->MacTab.Content[Elem->Wcid];
DBGPRINT(RT_DEBUG_TRACE, ("BA - PeerAddBAReqAction----> \n"));
ptemp = (PULONG) Elem->Msg;
//DBGPRINT_RAW(RT_DEBUG_EMU, ("%08x:: %08x:: %08x:: %08x:: %08x:: %08x:: %08x:: %08x:: %08x\n", *(ptemp), *(ptemp+1), *(ptemp+2), *(ptemp+3), *(ptemp+4), *(ptemp+5), *(ptemp+6), *(ptemp+7), *(ptemp+8)));
/*DBGPRINT_RAW(RT_DEBUG_EMU, ("%08x:: %08x:: %08x:: %08x:: %08x:: %08x:: %08x:: %08x:: %08x\n", *(ptemp), *(ptemp+1), *(ptemp+2), *(ptemp+3), *(ptemp+4), *(ptemp+5), *(ptemp+6), *(ptemp+7), *(ptemp+8))); */
if (PeerAddBAReqActionSanity(pAd, Elem->Msg, Elem->MsgLen, pAddr)) {
@ -1111,9 +1111,9 @@ VOID PeerAddBAReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
pAddreqFrame))
Status = 0;
else
Status = 38; // more parameters have invalid values
Status = 38; /* more parameters have invalid values */
} else {
Status = 37; // the request has been declined.
Status = 37; /* the request has been declined. */
}
}
@ -1121,8 +1121,8 @@ VOID PeerAddBAReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
ASSERT(pAd->MacTab.Content[Elem->Wcid].Sst == SST_ASSOC);
pAddreqFrame = (PFRAME_ADDBA_REQ) (&Elem->Msg[0]);
// 2. Always send back ADDBA Response
NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory
/* 2. Always send back ADDBA Response */
NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); /*Get an unused nonpaged memory */
if (NStatus != NDIS_STATUS_SUCCESS) {
DBGPRINT(RT_DEBUG_TRACE,
("ACTION - PeerBAAction() allocate memory failed \n"));
@ -1131,7 +1131,7 @@ VOID PeerAddBAReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
NdisZeroMemory(&ADDframe, sizeof(FRAME_ADDBA_RSP));
// 2-1. Prepare ADDBA Response frame.
/* 2-1. Prepare ADDBA Response frame. */
{
if (ADHOC_ON(pAd))
ActHeaderInit(pAd, &ADDframe.Hdr, pAddr,
@ -1145,7 +1145,7 @@ VOID PeerAddBAReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
ADDframe.Category = CATEGORY_BA;
ADDframe.Action = ADDBA_RESP;
ADDframe.Token = pAddreqFrame->Token;
// What is the Status code?? need to check.
/* What is the Status code?? need to check. */
ADDframe.StatusCode = Status;
ADDframe.BaParm.BAPolicy = IMMED_BA;
ADDframe.BaParm.AMSDUSupported = 0;
@ -1156,7 +1156,7 @@ VOID PeerAddBAReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
if (ADDframe.BaParm.BufSize == 0) {
ADDframe.BaParm.BufSize = 64;
}
ADDframe.TimeOutValue = 0; //pAddreqFrame->TimeOutValue;
ADDframe.TimeOutValue = 0; /*pAddreqFrame->TimeOutValue; */
*(USHORT *) (&ADDframe.BaParm) =
cpu2le16(*(USHORT *) (&ADDframe.BaParm));
@ -1175,18 +1175,18 @@ VOID PeerAddBAReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
VOID PeerAddBARspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
{
//UCHAR Idx, i;
//PUCHAR pOutBuffer = NULL;
/*UCHAR Idx, i; */
/*PUCHAR pOutBuffer = NULL; */
PFRAME_ADDBA_RSP pFrame = NULL;
//PBA_ORI_ENTRY pBAEntry;
/*PBA_ORI_ENTRY pBAEntry; */
//ADDBA Response from unknown peer, ignore this.
/*ADDBA Response from unknown peer, ignore this. */
if (Elem->Wcid >= MAX_LEN_OF_MAC_TABLE)
return;
DBGPRINT(RT_DEBUG_TRACE, ("%s ==> Wcid(%d)\n", __func__, Elem->Wcid));
//hex_dump("PeerAddBARspAction()", Elem->Msg, Elem->MsgLen);
/*hex_dump("PeerAddBARspAction()", Elem->Msg, Elem->MsgLen); */
if (PeerAddBARspActionSanity(pAd, Elem->Msg, Elem->MsgLen)) {
pFrame = (PFRAME_ADDBA_RSP) (&Elem->Msg[0]);
@ -1195,17 +1195,17 @@ VOID PeerAddBARspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
("\t\t StatusCode = %d\n", pFrame->StatusCode));
switch (pFrame->StatusCode) {
case 0:
// I want a BAsession with this peer as an originator.
/* I want a BAsession with this peer as an originator. */
BAOriSessionAdd(pAd, &pAd->MacTab.Content[Elem->Wcid],
pFrame);
break;
default:
// check status == USED ???
/* check status == USED ??? */
BAOriSessionTearDown(pAd, Elem->Wcid,
pFrame->BaParm.TID, TRUE, FALSE);
break;
}
// Rcv Decline StatusCode
/* Rcv Decline StatusCode */
if ((pFrame->StatusCode == 37)
|| ((pAd->OpMode == OPMODE_STA) && STA_TGN_WIFI_ON(pAd)
&& (pFrame->StatusCode != 0))
@ -1218,12 +1218,12 @@ VOID PeerAddBARspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
VOID PeerDelBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
{
//UCHAR Idx;
//PUCHAR pOutBuffer = NULL;
/*UCHAR Idx; */
/*PUCHAR pOutBuffer = NULL; */
PFRAME_DELBA_REQ pDelFrame = NULL;
DBGPRINT(RT_DEBUG_TRACE, ("%s ==>\n", __func__));
//DELBA Request from unknown peer, ignore this.
/*DELBA Request from unknown peer, ignore this. */
if (PeerDelBAActionSanity(pAd, Elem->Wcid, Elem->Msg, Elem->MsgLen)) {
pDelFrame = (PFRAME_DELBA_REQ) (&Elem->Msg[0]);
if (pDelFrame->DelbaParm.Initiator == ORIGINATOR) {
@ -1235,7 +1235,7 @@ VOID PeerDelBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
DBGPRINT(RT_DEBUG_TRACE,
("BA - PeerDelBAAction----> RECIPIENT, Reason = %d\n",
pDelFrame->ReasonCode));
//hex_dump("DelBA Frame", pDelFrame, Elem->MsgLen);
/*hex_dump("DelBA Frame", pDelFrame, Elem->MsgLen); */
BAOriSessionTearDown(pAd, Elem->Wcid,
pDelFrame->DelbaParm.TID, TRUE,
FALSE);
@ -1248,26 +1248,26 @@ BOOLEAN CntlEnqueueForRecv(IN PRTMP_ADAPTER pAd,
IN ULONG MsgLen, IN PFRAME_BA_REQ pMsg)
{
PFRAME_BA_REQ pFrame = pMsg;
//PRTMP_REORDERBUF pBuffer;
//PRTMP_REORDERBUF pDmaBuf;
/*PRTMP_REORDERBUF pBuffer; */
/*PRTMP_REORDERBUF pDmaBuf; */
PBA_REC_ENTRY pBAEntry;
//BOOLEAN Result;
/*BOOLEAN Result; */
ULONG Idx;
//UCHAR NumRxPkt;
UCHAR TID; //, i;
/*UCHAR NumRxPkt; */
UCHAR TID; /*, i; */
TID = (UCHAR) pFrame->BARControl.TID;
DBGPRINT(RT_DEBUG_TRACE,
("%s(): BAR-Wcid(%ld), Tid (%d)\n", __func__, Wcid, TID));
//hex_dump("BAR", (PCHAR) pFrame, MsgLen);
// Do nothing if the driver is starting halt state.
// This might happen when timer already been fired before cancel timer with mlmehalt
/*hex_dump("BAR", (PCHAR) pFrame, MsgLen); */
/* Do nothing if the driver is starting halt state. */
/* This might happen when timer already been fired before cancel timer with mlmehalt */
if (RTMP_TEST_FLAG
(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST))
return FALSE;
// First check the size, it MUST not exceed the mlme queue size
/* First check the size, it MUST not exceed the mlme queue size */
if (MsgLen > MGMT_DMA_BUFFER_SIZE) {
DBGPRINT_ERR(("CntlEnqueueForRecv: frame too large, size = %ld \n", MsgLen));
return FALSE;
@ -1280,7 +1280,7 @@ BOOLEAN CntlEnqueueForRecv(IN PRTMP_ADAPTER pAd,
}
if ((Wcid < MAX_LEN_OF_MAC_TABLE) && (TID < 8)) {
// if this receiving packet is from SA that is in our OriEntry. Since WCID <9 has direct mapping. no need search.
/* if this receiving packet is from SA that is in our OriEntry. Since WCID <9 has direct mapping. no need search. */
Idx = pAd->MacTab.Content[Wcid].BARecWcidArray[TID];
pBAEntry = &pAd->BATable.BARecEntry[Idx];
} else {
@ -1294,7 +1294,7 @@ BOOLEAN CntlEnqueueForRecv(IN PRTMP_ADAPTER pAd,
if (SEQ_SMALLER
(pBAEntry->LastIndSeq, pFrame->BAStartingSeq.field.StartSeq,
MAXSEQ)) {
//DBGPRINT(RT_DEBUG_TRACE, ("BAR Seq = %x, LastIndSeq = %x\n", pFrame->BAStartingSeq.field.StartSeq, pBAEntry->LastIndSeq));
/*DBGPRINT(RT_DEBUG_TRACE, ("BAR Seq = %x, LastIndSeq = %x\n", pFrame->BAStartingSeq.field.StartSeq, pBAEntry->LastIndSeq)); */
ba_indicate_reordering_mpdus_le_seq(pAd, pBAEntry,
pFrame->BAStartingSeq.field.
StartSeq);
@ -1302,7 +1302,7 @@ BOOLEAN CntlEnqueueForRecv(IN PRTMP_ADAPTER pAd,
(pFrame->BAStartingSeq.field.StartSeq ==
0) ? MAXSEQ : (pFrame->BAStartingSeq.field.StartSeq - 1);
}
//ba_refresh_reordering_mpdus(pAd, pBAEntry);
/*ba_refresh_reordering_mpdus(pAd, pBAEntry); */
return TRUE;
}
@ -1313,11 +1313,11 @@ VOID SendPSMPAction(IN PRTMP_ADAPTER pAd, IN UCHAR Wcid, IN UCHAR Psmp)
{
PUCHAR pOutBuffer = NULL;
NDIS_STATUS NStatus;
//ULONG Idx;
/*ULONG Idx; */
FRAME_PSMP_ACTION Frame;
ULONG FrameLen;
NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory
NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); /*Get an unused nonpaged memory */
if (NStatus != NDIS_STATUS_SUCCESS) {
DBGPRINT(RT_DEBUG_ERROR,
("BA - MlmeADDBAAction() allocate memory failed \n"));
@ -1337,7 +1337,7 @@ VOID SendPSMPAction(IN PRTMP_ADAPTER pAd, IN UCHAR Wcid, IN UCHAR Psmp)
|| pAd->Antenna.field.TxPath > 1)) {
RTMP_ASIC_MMPS_DISABLE(pAd);
}
#endif // RT30xx //
#endif /* RT30xx // */
Frame.Psmp = 0;
break;
case MMPS_DYNAMIC:
@ -1350,7 +1350,7 @@ VOID SendPSMPAction(IN PRTMP_ADAPTER pAd, IN UCHAR Wcid, IN UCHAR Psmp)
|| pAd->Antenna.field.TxPath > 1)) {
RTMP_ASIC_MMPS_ENABLE(pAd);
}
#endif // RT30xx //
#endif /* RT30xx // */
Frame.Psmp = 1;
break;
}
@ -1372,7 +1372,7 @@ typedef struct PACKED {
UCHAR BSSID[MAC_ADDR_LEN];
UCHAR ReportingCondition;
UCHAR Threshold;
UCHAR SSIDIE[2]; // 2 byte
UCHAR SSIDIE[2]; /* 2 byte */
} BEACON_REQUEST;
typedef struct PACKED {
@ -1391,10 +1391,10 @@ void convert_reordering_packet_to_preAMSDU_or_802_3_packet(IN PRTMP_ADAPTER pAd,
PNDIS_PACKET pRxPkt;
UCHAR Header802_3[LENGTH_802_3];
// 1. get 802.3 Header
// 2. remove LLC
// a. pointer pRxBlk->pData to payload
// b. modify pRxBlk->DataSize
/* 1. get 802.3 Header */
/* 2. remove LLC */
/* a. pointer pRxBlk->pData to payload */
/* b. modify pRxBlk->DataSize */
RTMP_802_11_REMOVE_LLC_AND_CONVERT_TO_802_3(pRxBlk, Header802_3);
@ -1406,9 +1406,9 @@ void convert_reordering_packet_to_preAMSDU_or_802_3_packet(IN PRTMP_ADAPTER pAd,
SET_OS_PKT_LEN(pRxPkt, pRxBlk->DataSize);
SET_OS_PKT_DATATAIL(pRxPkt, pRxBlk->pData, pRxBlk->DataSize);
//
// copy 802.3 header, if necessary
//
/* */
/* copy 802.3 header, if necessary */
/* */
if (!RX_BLK_TEST_FLAG(pRxBlk, fRX_AMSDU)) {
{
#ifdef LINUX
@ -1446,7 +1446,7 @@ static VOID ba_enqueue_reordering_packet(IN PRTMP_ADAPTER pAd,
mpdu_blk = ba_mpdu_blk_alloc(pAd);
if ((mpdu_blk != NULL) && (!RX_BLK_TEST_FLAG(pRxBlk, fRX_EAP))) {
// Write RxD buffer address & allocated buffer length
/* Write RxD buffer address & allocated buffer length */
NdisAcquireSpinLock(&pBAEntry->RxReRingLock);
mpdu_blk->Sequence = Sequence;
@ -1459,18 +1459,18 @@ static VOID ba_enqueue_reordering_packet(IN PRTMP_ADAPTER pAd,
STATS_INC_RX_PACKETS(pAd, FromWhichBSSID);
//
// it is necessary for reordering packet to record
// which BSS it come from
//
/* */
/* it is necessary for reordering packet to record */
/* which BSS it come from */
/* */
RTMP_SET_PACKET_IF(pRxBlk->pRxPacket, FromWhichBSSID);
mpdu_blk->pPacket = pRxBlk->pRxPacket;
if (ba_reordering_mpdu_insertsorted(&pBAEntry->list, mpdu_blk)
== FALSE) {
// had been already within reordering list
// don't indicate
/* had been already within reordering list */
/* don't indicate */
RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket,
NDIS_STATUS_SUCCESS);
ba_mpdu_blk_free(pAd, mpdu_blk);
@ -1489,7 +1489,7 @@ static VOID ba_enqueue_reordering_packet(IN PRTMP_ADAPTER pAd,
* and receving mpdu to upper layer
* make tcp/ip to take care reordering mechanism
*/
//ba_refresh_reordering_mpdus(pAd, pBAEntry);
/*ba_refresh_reordering_mpdus(pAd, pBAEntry); */
ba_indicate_reordering_mpdus_le_seq(pAd, pBAEntry, Sequence);
pBAEntry->LastIndSeq = Sequence;
@ -1527,7 +1527,7 @@ VOID Indicate_AMPDU_Packet(IN PRTMP_ADAPTER pAd,
if (!RX_BLK_TEST_FLAG(pRxBlk, fRX_AMSDU)
&& (pRxBlk->DataSize > MAX_RX_PKT_LEN)) {
// release packet
/* release packet */
RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket,
NDIS_STATUS_FAILURE);
return;
@ -1542,9 +1542,9 @@ VOID Indicate_AMPDU_Packet(IN PRTMP_ADAPTER pAd,
}
pBAEntry = &pAd->BATable.BARecEntry[Idx];
} else {
// impossible !!!
/* impossible !!! */
ASSERT(0);
// release packet
/* release packet */
RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket,
NDIS_STATUS_FAILURE);
return;
@ -1552,7 +1552,7 @@ VOID Indicate_AMPDU_Packet(IN PRTMP_ADAPTER pAd,
ASSERT(pBAEntry);
// update last rx time
/* update last rx time */
NdisGetSystemUpTime(&Now32);
pBAEntry->rcvSeq = Sequence;
@ -1560,23 +1560,23 @@ VOID Indicate_AMPDU_Packet(IN PRTMP_ADAPTER pAd,
ba_flush_reordering_timeout_mpdus(pAd, pBAEntry, Now32);
pBAEntry->LastIndSeqAtTimer = Now32;
//
// Reset Last Indicate Sequence
//
/* */
/* Reset Last Indicate Sequence */
/* */
if (pBAEntry->LastIndSeq == RESET_RCV_SEQ) {
ASSERT((pBAEntry->list.qlen == 0)
&& (pBAEntry->list.next == NULL));
// reset rcv sequence of BA session
/* reset rcv sequence of BA session */
pBAEntry->LastIndSeq = Sequence;
pBAEntry->LastIndSeqAtTimer = Now32;
INDICATE_LEGACY_OR_AMSDU(pAd, pRxBlk, FromWhichBSSID);
return;
}
//
// I. Check if in order.
//
/* */
/* I. Check if in order. */
/* */
if (SEQ_STEPONE(Sequence, pBAEntry->LastIndSeq, MAXSEQ)) {
USHORT LastIndSeq;
@ -1590,29 +1590,29 @@ VOID Indicate_AMPDU_Packet(IN PRTMP_ADAPTER pAd,
}
pBAEntry->LastIndSeqAtTimer = Now32;
}
//
// II. Drop Duplicated Packet
//
/* */
/* II. Drop Duplicated Packet */
/* */
else if (Sequence == pBAEntry->LastIndSeq) {
// drop and release packet
/* drop and release packet */
pBAEntry->nDropPacket++;
RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket,
NDIS_STATUS_FAILURE);
}
//
// III. Drop Old Received Packet
//
/* */
/* III. Drop Old Received Packet */
/* */
else if (SEQ_SMALLER(Sequence, pBAEntry->LastIndSeq, MAXSEQ)) {
// drop and release packet
/* drop and release packet */
pBAEntry->nDropPacket++;
RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket,
NDIS_STATUS_FAILURE);
}
//
// IV. Receive Sequence within Window Size
//
/* */
/* IV. Receive Sequence within Window Size */
/* */
else if (SEQ_SMALLER
(Sequence,
(((pBAEntry->LastIndSeq + pBAEntry->BAWinSize + 1)) & MAXSEQ),
@ -1620,9 +1620,9 @@ VOID Indicate_AMPDU_Packet(IN PRTMP_ADAPTER pAd,
ba_enqueue_reordering_packet(pAd, pBAEntry, pRxBlk,
FromWhichBSSID);
}
//
// V. Receive seq surpasses Win(lastseq + nMSDU). So refresh all reorder buffer
//
/* */
/* V. Receive seq surpasses Win(lastseq + nMSDU). So refresh all reorder buffer */
/* */
else {
LONG WinStartSeq, TmpSeq;
@ -1632,7 +1632,7 @@ VOID Indicate_AMPDU_Packet(IN PRTMP_ADAPTER pAd,
}
WinStartSeq = (TmpSeq + 1) & MAXSEQ;
ba_indicate_reordering_mpdus_le_seq(pAd, pBAEntry, WinStartSeq);
pBAEntry->LastIndSeq = WinStartSeq; //TmpSeq;
pBAEntry->LastIndSeq = WinStartSeq; /*TmpSeq; */
pBAEntry->LastIndSeqAtTimer = Now32;

View file

@ -277,7 +277,7 @@ void construct_mic_header2(unsigned char *mic_header2,
mic_header2[4] = mpdu[20];
mic_header2[5] = mpdu[21];
// In Sequence Control field, mute sequence numer bits (12-bit)
/* In Sequence Control field, mute sequence numer bits (12-bit) */
mic_header2[6] = mpdu[22] & 0x0f; /* SC */
mic_header2[7] = 0x00; /* mpdu[23]; */
@ -403,7 +403,7 @@ void construct_ctr_preload(unsigned char *ctr_preload,
for (i = 8; i < 14; i++)
ctr_preload[i] = pn_vector[13 - i]; /* ctr_preload[8:13] = PN[5:0] */
#endif
ctr_preload[14] = (unsigned char)(c / 256); // Ctr
ctr_preload[14] = (unsigned char)(c / 256); /* Ctr */
ctr_preload[15] = (unsigned char)(c % 256);
}
@ -477,12 +477,12 @@ BOOLEAN RTMPSoftDecryptAES(IN PRTMP_ADAPTER pAd,
PN[4] = *(pData + HeaderLen + 6);
PN[5] = *(pData + HeaderLen + 7);
payload_len = DataByteCnt - HeaderLen - 8 - 8; // 8 bytes for CCMP header , 8 bytes for MIC
payload_len = DataByteCnt - HeaderLen - 8 - 8; /* 8 bytes for CCMP header , 8 bytes for MIC */
payload_remainder = (payload_len) % 16;
num_blocks = (payload_len) / 16;
// Find start of payload
payload_index = HeaderLen + 8; //IV+EIV
/* Find start of payload */
payload_index = HeaderLen + 8; /*IV+EIV */
for (i = 0; i < num_blocks; i++) {
construct_ctr_preload(ctr_preload,
@ -495,10 +495,10 @@ BOOLEAN RTMPSoftDecryptAES(IN PRTMP_ADAPTER pAd,
payload_index += 16;
}
//
// If there is a short final block, then pad it
// encrypt it and copy the unpadded part back
//
/* */
/* If there is a short final block, then pad it */
/* encrypt it and copy the unpadded part back */
/* */
if (payload_remainder > 0) {
construct_ctr_preload(ctr_preload,
a4_exists,
@ -515,9 +515,9 @@ BOOLEAN RTMPSoftDecryptAES(IN PRTMP_ADAPTER pAd,
payload_remainder);
payload_index += payload_remainder;
}
//
// Descrypt the MIC
//
/* */
/* Descrypt the MIC */
/* */
construct_ctr_preload(ctr_preload, a4_exists, qc_exists, pData, PN, 0);
NdisZeroMemory(padded_buffer, 16);
NdisMoveMemory(padded_buffer, pData + payload_index, 8);
@ -528,15 +528,15 @@ BOOLEAN RTMPSoftDecryptAES(IN PRTMP_ADAPTER pAd,
NdisMoveMemory(TrailMIC, chain_buffer, 8);
//
// Calculate MIC
//
/* */
/* Calculate MIC */
/* */
//Force the protected frame bit on
/*Force the protected frame bit on */
*(pData + 1) = *(pData + 1) | 0x40;
// Find start of payload
// Because the CCMP header has been removed
/* Find start of payload */
/* Because the CCMP header has been removed */
payload_index = HeaderLen;
construct_mic_iv(mic_iv, qc_exists, a4_exists, pData, payload_len, PN);
@ -551,14 +551,14 @@ BOOLEAN RTMPSoftDecryptAES(IN PRTMP_ADAPTER pAd,
bitwise_xor(aes_out, mic_header2, chain_buffer);
aes128k128d(pWpaKey[KeyID].Key, chain_buffer, aes_out);
// iterate through each 16 byte payload block
/* iterate through each 16 byte payload block */
for (i = 0; i < num_blocks; i++) {
bitwise_xor(aes_out, pData + payload_index, chain_buffer);
payload_index += 16;
aes128k128d(pWpaKey[KeyID].Key, chain_buffer, aes_out);
}
// Add on the final payload block if it needs padding
/* Add on the final payload block if it needs padding */
if (payload_remainder > 0) {
NdisZeroMemory(padded_buffer, 16);
NdisMoveMemory(padded_buffer, pData + payload_index,
@ -567,13 +567,13 @@ BOOLEAN RTMPSoftDecryptAES(IN PRTMP_ADAPTER pAd,
bitwise_xor(aes_out, padded_buffer, chain_buffer);
aes128k128d(pWpaKey[KeyID].Key, chain_buffer, aes_out);
}
// aes_out contains padded mic, discard most significant
// 8 bytes to generate 64 bit MIC
/* aes_out contains padded mic, discard most significant */
/* 8 bytes to generate 64 bit MIC */
for (i = 0; i < 8; i++)
MIC[i] = aes_out[i];
if (!NdisEqualMemory(MIC, TrailMIC, 8)) {
DBGPRINT(RT_DEBUG_ERROR, ("RTMPSoftDecryptAES, MIC Error !\n")); //MIC error.
DBGPRINT(RT_DEBUG_ERROR, ("RTMPSoftDecryptAES, MIC Error !\n")); /*MIC error. */
return FALSE;
}
@ -1208,27 +1208,27 @@ VOID AES_GTK_KEY_WRAP(IN UCHAR * key,
{
UCHAR A[8], BIN[16], BOUT[16];
UCHAR R[512];
INT num_blocks = p_len / 8; // unit:64bits
INT num_blocks = p_len / 8; /* unit:64bits */
INT i, j;
aes_context aesctx;
UCHAR xor;
rt_aes_set_key(&aesctx, key, 128);
// Init IA
/* Init IA */
for (i = 0; i < 8; i++)
A[i] = 0xa6;
//Input plaintext
/*Input plaintext */
for (i = 0; i < num_blocks; i++) {
for (j = 0; j < 8; j++)
R[8 * (i + 1) + j] = plaintext[8 * i + j];
}
// Key Mix
/* Key Mix */
for (j = 0; j < 6; j++) {
for (i = 1; i <= num_blocks; i++) {
//phase 1
/*phase 1 */
NdisMoveMemory(BIN, A, 8);
NdisMoveMemory(&BIN[8], &R[8 * i], 8);
rt_aes_encrypt(&aesctx, BIN, BOUT);
@ -1240,7 +1240,7 @@ VOID AES_GTK_KEY_WRAP(IN UCHAR * key,
}
}
// Output ciphertext
/* Output ciphertext */
NdisMoveMemory(ciphertext, A, 8);
for (i = 1; i <= num_blocks; i++) {
@ -1273,7 +1273,7 @@ VOID AES_GTK_KEY_UNWRAP(IN UCHAR * key,
INT i, j;
aes_context aesctx;
UCHAR *R;
INT num_blocks = c_len / 8; // unit:64bits
INT num_blocks = c_len / 8; /* unit:64bits */
os_alloc_mem(NULL, (PUCHAR *) & R, 512);
@ -1283,9 +1283,9 @@ VOID AES_GTK_KEY_UNWRAP(IN UCHAR * key,
return;
}
/* End of if */
// Initialize
/* Initialize */
NdisMoveMemory(A, ciphertext, 8);
//Input plaintext
/*Input plaintext */
for (i = 0; i < (c_len - 8); i++) {
R[i] = ciphertext[i + 8];
}
@ -1304,7 +1304,7 @@ VOID AES_GTK_KEY_UNWRAP(IN UCHAR * key,
}
}
// OUTPUT
/* OUTPUT */
for (i = 0; i < c_len; i++) {
plaintext[i] = R[i];
}

File diff suppressed because it is too large Load diff

View file

@ -95,8 +95,8 @@ INT RT_CfgSetCountryRegion(IN PRTMP_ADAPTER pAd, IN PSTRING arg, IN INT band)
regionMax = REGION_MAXIMUM_A_BAND;
}
// TODO: Is it neccesay for following check???
// Country can be set only when EEPROM not programmed
/* TODO: Is it neccesay for following check??? */
/* Country can be set only when EEPROM not programmed */
if (*pCountryRegion & 0x80) {
DBGPRINT(RT_DEBUG_ERROR,
("CfgSetCountryRegion():CountryRegion in eeprom was programmed\n"));
@ -154,7 +154,7 @@ INT RT_CfgSetShortSlot(IN PRTMP_ADAPTER pAd, IN PSTRING arg)
else if (ShortSlot == 0)
pAd->CommonCfg.bUseShortSlotTime = FALSE;
else
return FALSE; //Invalid argument
return FALSE; /*Invalid argument */
return TRUE;
}
@ -176,29 +176,29 @@ INT RT_CfgSetWepKey(IN PRTMP_ADAPTER pAd,
UCHAR CipherAlg = CIPHER_NONE;
BOOLEAN bKeyIsHex = FALSE;
// TODO: Shall we do memset for the original key info??
/* TODO: Shall we do memset for the original key info?? */
memset(pSharedKey, 0, sizeof(CIPHER_KEY));
KeyLen = strlen(keyString);
switch (KeyLen) {
case 5: //wep 40 Ascii type
case 13: //wep 104 Ascii type
case 5: /*wep 40 Ascii type */
case 13: /*wep 104 Ascii type */
bKeyIsHex = FALSE;
pSharedKey->KeyLen = KeyLen;
NdisMoveMemory(pSharedKey->Key, keyString, KeyLen);
break;
case 10: //wep 40 Hex type
case 26: //wep 104 Hex type
case 10: /*wep 40 Hex type */
case 26: /*wep 104 Hex type */
for (i = 0; i < KeyLen; i++) {
if (!isxdigit(*(keyString + i)))
return FALSE; //Not Hex value;
return FALSE; /*Not Hex value; */
}
bKeyIsHex = TRUE;
pSharedKey->KeyLen = KeyLen / 2;
AtoH(keyString, pSharedKey->Key, pSharedKey->KeyLen);
break;
default: //Invalid argument
default: /*Invalid argument */
DBGPRINT(RT_DEBUG_TRACE,
("RT_CfgSetWepKey(keyIdx=%d):Invalid argument (arg=%s)\n",
keyIdx, keyString));

File diff suppressed because it is too large Load diff

View file

@ -44,23 +44,23 @@ USHORT RtmpPCI_WriteTxResource(IN PRTMP_ADAPTER pAd,
PRTMP_TX_RING pTxRing;
USHORT hwHeaderLen;
//
// get Tx Ring Resource
//
/* */
/* get Tx Ring Resource */
/* */
pTxRing = &pAd->TxRing[pTxBlk->QueIdx];
TxIdx = pAd->TxRing[pTxBlk->QueIdx].TxCpuIdx;
pDMAHeaderBufVA = (PUCHAR) pTxRing->Cell[TxIdx].DmaBuf.AllocVa;
BufBasePaLow =
RTMP_GetPhysicalAddressLow(pTxRing->Cell[TxIdx].DmaBuf.AllocPa);
// copy TXINFO + TXWI + WLAN Header + LLC into DMA Header Buffer
/* copy TXINFO + TXWI + WLAN Header + LLC into DMA Header Buffer */
if (pTxBlk->TxFrameType == TX_AMSDU_FRAME) {
//hwHeaderLen = ROUND_UP(pTxBlk->MpduHeaderLen-LENGTH_AMSDU_SUBFRAMEHEAD, 4)+LENGTH_AMSDU_SUBFRAMEHEAD;
/*hwHeaderLen = ROUND_UP(pTxBlk->MpduHeaderLen-LENGTH_AMSDU_SUBFRAMEHEAD, 4)+LENGTH_AMSDU_SUBFRAMEHEAD; */
hwHeaderLen =
pTxBlk->MpduHeaderLen - LENGTH_AMSDU_SUBFRAMEHEAD +
pTxBlk->HdrPadLen + LENGTH_AMSDU_SUBFRAMEHEAD;
} else {
//hwHeaderLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4);
/*hwHeaderLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4); */
hwHeaderLen = pTxBlk->MpduHeaderLen + pTxBlk->HdrPadLen;
}
NdisMoveMemory(pDMAHeaderBufVA, pTxBlk->HeaderBuf,
@ -69,15 +69,15 @@ USHORT RtmpPCI_WriteTxResource(IN PRTMP_ADAPTER pAd,
pTxRing->Cell[TxIdx].pNdisPacket = pTxBlk->pPacket;
pTxRing->Cell[TxIdx].pNextNdisPacket = NULL;
//
// build Tx Descriptor
//
/* */
/* build Tx Descriptor */
/* */
pTxD = (PTXD_STRUC) pTxRing->Cell[TxIdx].AllocVa;
NdisZeroMemory(pTxD, TXD_SIZE);
pTxD->SDPtr0 = BufBasePaLow;
pTxD->SDLen0 = TXINFO_SIZE + TXWI_SIZE + hwHeaderLen; // include padding
pTxD->SDLen0 = TXINFO_SIZE + TXWI_SIZE + hwHeaderLen; /* include padding */
pTxD->SDPtr1 = PCI_MAP_SINGLE(pAd, pTxBlk, 0, 1, PCI_DMA_TODEVICE);
pTxD->SDLen1 = pTxBlk->SrcBufLen;
pTxD->LastSec0 = 0;
@ -86,9 +86,9 @@ USHORT RtmpPCI_WriteTxResource(IN PRTMP_ADAPTER pAd,
RTMPWriteTxDescriptor(pAd, pTxD, FALSE, FIFO_EDCA);
RetTxIdx = TxIdx;
//
// Update Tx index
//
/* */
/* Update Tx index */
/* */
INC_RING_INDEX(TxIdx, TX_RING_SIZE);
pTxRing->TxCpuIdx = TxIdx;
@ -110,17 +110,17 @@ USHORT RtmpPCI_WriteSingleTxResource(IN PRTMP_ADAPTER pAd,
PRTMP_TX_RING pTxRing;
USHORT hwHeaderLen;
//
// get Tx Ring Resource
//
/* */
/* get Tx Ring Resource */
/* */
pTxRing = &pAd->TxRing[pTxBlk->QueIdx];
TxIdx = pAd->TxRing[pTxBlk->QueIdx].TxCpuIdx;
pDMAHeaderBufVA = (PUCHAR) pTxRing->Cell[TxIdx].DmaBuf.AllocVa;
BufBasePaLow =
RTMP_GetPhysicalAddressLow(pTxRing->Cell[TxIdx].DmaBuf.AllocPa);
// copy TXINFO + TXWI + WLAN Header + LLC into DMA Header Buffer
//hwHeaderLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4);
/* copy TXINFO + TXWI + WLAN Header + LLC into DMA Header Buffer */
/*hwHeaderLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4); */
hwHeaderLen = pTxBlk->MpduHeaderLen + pTxBlk->HdrPadLen;
NdisMoveMemory(pDMAHeaderBufVA, pTxBlk->HeaderBuf,
@ -129,14 +129,14 @@ USHORT RtmpPCI_WriteSingleTxResource(IN PRTMP_ADAPTER pAd,
pTxRing->Cell[TxIdx].pNdisPacket = pTxBlk->pPacket;
pTxRing->Cell[TxIdx].pNextNdisPacket = NULL;
//
// build Tx Descriptor
//
/* */
/* build Tx Descriptor */
/* */
pTxD = (PTXD_STRUC) pTxRing->Cell[TxIdx].AllocVa;
NdisZeroMemory(pTxD, TXD_SIZE);
pTxD->SDPtr0 = BufBasePaLow;
pTxD->SDLen0 = TXINFO_SIZE + TXWI_SIZE + hwHeaderLen; // include padding
pTxD->SDLen0 = TXINFO_SIZE + TXWI_SIZE + hwHeaderLen; /* include padding */
pTxD->SDPtr1 = PCI_MAP_SINGLE(pAd, pTxBlk, 0, 1, PCI_DMA_TODEVICE);;
pTxD->SDLen1 = pTxBlk->SrcBufLen;
pTxD->LastSec0 = 0;
@ -145,9 +145,9 @@ USHORT RtmpPCI_WriteSingleTxResource(IN PRTMP_ADAPTER pAd,
RTMPWriteTxDescriptor(pAd, pTxD, FALSE, FIFO_EDCA);
RetTxIdx = TxIdx;
//
// Update Tx index
//
/* */
/* Update Tx index */
/* */
INC_RING_INDEX(TxIdx, TX_RING_SIZE);
pTxRing->TxCpuIdx = TxIdx;
@ -171,9 +171,9 @@ USHORT RtmpPCI_WriteMultiTxResource(IN PRTMP_ADAPTER pAd,
bIsLast = ((frameNum == (pTxBlk->TotalFrameNum - 1)) ? 1 : 0);
//
// get Tx Ring Resource
//
/* */
/* get Tx Ring Resource */
/* */
pTxRing = &pAd->TxRing[pTxBlk->QueIdx];
TxIdx = pAd->TxRing[pTxBlk->QueIdx].TxCpuIdx;
pDMAHeaderBufVA = (PUCHAR) pTxRing->Cell[TxIdx].DmaBuf.AllocVa;
@ -181,20 +181,20 @@ USHORT RtmpPCI_WriteMultiTxResource(IN PRTMP_ADAPTER pAd,
RTMP_GetPhysicalAddressLow(pTxRing->Cell[TxIdx].DmaBuf.AllocPa);
if (frameNum == 0) {
// copy TXINFO + TXWI + WLAN Header + LLC into DMA Header Buffer
/* copy TXINFO + TXWI + WLAN Header + LLC into DMA Header Buffer */
if (pTxBlk->TxFrameType == TX_AMSDU_FRAME)
//hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen-LENGTH_AMSDU_SUBFRAMEHEAD, 4)+LENGTH_AMSDU_SUBFRAMEHEAD;
/*hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen-LENGTH_AMSDU_SUBFRAMEHEAD, 4)+LENGTH_AMSDU_SUBFRAMEHEAD; */
hwHdrLen =
pTxBlk->MpduHeaderLen - LENGTH_AMSDU_SUBFRAMEHEAD +
pTxBlk->HdrPadLen + LENGTH_AMSDU_SUBFRAMEHEAD;
else if (pTxBlk->TxFrameType == TX_RALINK_FRAME)
//hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen-LENGTH_ARALINK_HEADER_FIELD, 4)+LENGTH_ARALINK_HEADER_FIELD;
/*hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen-LENGTH_ARALINK_HEADER_FIELD, 4)+LENGTH_ARALINK_HEADER_FIELD; */
hwHdrLen =
pTxBlk->MpduHeaderLen -
LENGTH_ARALINK_HEADER_FIELD + pTxBlk->HdrPadLen +
LENGTH_ARALINK_HEADER_FIELD;
else
//hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4);
/*hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4); */
hwHdrLen = pTxBlk->MpduHeaderLen + pTxBlk->HdrPadLen;
firstDMALen = TXINFO_SIZE + TXWI_SIZE + hwHdrLen;
@ -207,14 +207,14 @@ USHORT RtmpPCI_WriteMultiTxResource(IN PRTMP_ADAPTER pAd,
pTxRing->Cell[TxIdx].pNdisPacket = pTxBlk->pPacket;
pTxRing->Cell[TxIdx].pNextNdisPacket = NULL;
//
// build Tx Descriptor
//
/* */
/* build Tx Descriptor */
/* */
pTxD = (PTXD_STRUC) pTxRing->Cell[TxIdx].AllocVa;
NdisZeroMemory(pTxD, TXD_SIZE);
pTxD->SDPtr0 = BufBasePaLow;
pTxD->SDLen0 = firstDMALen; // include padding
pTxD->SDLen0 = firstDMALen; /* include padding */
pTxD->SDPtr1 = PCI_MAP_SINGLE(pAd, pTxBlk, 0, 1, PCI_DMA_TODEVICE);;
pTxD->SDLen1 = pTxBlk->SrcBufLen;
pTxD->LastSec0 = 0;
@ -223,9 +223,9 @@ USHORT RtmpPCI_WriteMultiTxResource(IN PRTMP_ADAPTER pAd,
RTMPWriteTxDescriptor(pAd, pTxD, FALSE, FIFO_EDCA);
RetTxIdx = TxIdx;
//
// Update Tx index
//
/* */
/* Update Tx index */
/* */
INC_RING_INDEX(TxIdx, TX_RING_SIZE);
pTxRing->TxCpuIdx = TxIdx;
@ -243,9 +243,9 @@ VOID RtmpPCI_FinalWriteTxResource(IN PRTMP_ADAPTER pAd,
PTXWI_STRUC pTxWI;
PRTMP_TX_RING pTxRing;
//
// get Tx Ring Resource
//
/* */
/* get Tx Ring Resource */
/* */
pTxRing = &pAd->TxRing[pTxBlk->QueIdx];
pTxWI = (PTXWI_STRUC) pTxRing->Cell[FirstTxIdx].DmaBuf.AllocVa;
pTxWI->MPDUtotalByteCount = totalMPDUSize;
@ -258,14 +258,14 @@ VOID RtmpPCIDataLastTxIdx(IN PRTMP_ADAPTER pAd,
PTXD_STRUC pTxD;
PRTMP_TX_RING pTxRing;
//
// get Tx Ring Resource
//
/* */
/* get Tx Ring Resource */
/* */
pTxRing = &pAd->TxRing[QueIdx];
//
// build Tx Descriptor
//
/* */
/* build Tx Descriptor */
/* */
pTxD = (PTXD_STRUC) pTxRing->Cell[LastTxIdx].AllocVa;
pTxD->LastSec1 = 1;
@ -284,27 +284,27 @@ USHORT RtmpPCI_WriteFragTxResource(IN PRTMP_ADAPTER pAd,
USHORT hwHeaderLen;
UINT32 firstDMALen;
//
// Get Tx Ring Resource
//
/* */
/* Get Tx Ring Resource */
/* */
pTxRing = &pAd->TxRing[pTxBlk->QueIdx];
TxIdx = pAd->TxRing[pTxBlk->QueIdx].TxCpuIdx;
pDMAHeaderBufVA = (PUCHAR) pTxRing->Cell[TxIdx].DmaBuf.AllocVa;
BufBasePaLow =
RTMP_GetPhysicalAddressLow(pTxRing->Cell[TxIdx].DmaBuf.AllocPa);
//
// Copy TXINFO + TXWI + WLAN Header + LLC into DMA Header Buffer
//
//hwHeaderLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4);
/* */
/* Copy TXINFO + TXWI + WLAN Header + LLC into DMA Header Buffer */
/* */
/*hwHeaderLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4); */
hwHeaderLen = pTxBlk->MpduHeaderLen + pTxBlk->HdrPadLen;
firstDMALen = TXINFO_SIZE + TXWI_SIZE + hwHeaderLen;
NdisMoveMemory(pDMAHeaderBufVA, pTxBlk->HeaderBuf, firstDMALen);
//
// Build Tx Descriptor
//
/* */
/* Build Tx Descriptor */
/* */
pTxD = (PTXD_STRUC) pTxRing->Cell[TxIdx].AllocVa;
NdisZeroMemory(pTxD, TXD_SIZE);
@ -314,7 +314,7 @@ USHORT RtmpPCI_WriteFragTxResource(IN PRTMP_ADAPTER pAd,
}
pTxD->SDPtr0 = BufBasePaLow;
pTxD->SDLen0 = firstDMALen; // include padding
pTxD->SDLen0 = firstDMALen; /* include padding */
pTxD->SDPtr1 = PCI_MAP_SINGLE(pAd, pTxBlk, 0, 1, PCI_DMA_TODEVICE);
pTxD->SDLen1 = pTxBlk->SrcBufLen;
pTxD->LastSec0 = 0;
@ -325,9 +325,9 @@ USHORT RtmpPCI_WriteFragTxResource(IN PRTMP_ADAPTER pAd,
RetTxIdx = TxIdx;
pTxBlk->Priv += pTxBlk->SrcBufLen;
//
// Update Tx index
//
/* */
/* Update Tx index */
/* */
INC_RING_INDEX(TxIdx, TX_RING_SIZE);
pTxRing->TxCpuIdx = TxIdx;
@ -363,7 +363,7 @@ int RtmpPCIMgmtKickOut(IN RTMP_ADAPTER * pAd,
PCI_MAP_SINGLE(pAd, pSrcBufVA, SrcBufLen, 0, PCI_DMA_TODEVICE);
pTxD->SDLen0 = SrcBufLen;
//==================================================================
/*================================================================== */
/* DBGPRINT_RAW(RT_DEBUG_TRACE, ("MLMEHardTransmit\n"));
for (i = 0; i < (TXWI_SIZE+24); i++)
{
@ -375,12 +375,12 @@ int RtmpPCIMgmtKickOut(IN RTMP_ADAPTER * pAd,
DBGPRINT_RAW(RT_DEBUG_TRACE, ("\n "));
}
DBGPRINT_RAW(RT_DEBUG_TRACE, ("\n "));*/
//=======================================================================
/*======================================================================= */
pAd->RalinkCounters.KickTxCount++;
pAd->RalinkCounters.OneSecTxDoneCount++;
// Increase TX_CTX_IDX, but write to register later.
/* Increase TX_CTX_IDX, but write to register later. */
INC_RING_INDEX(pAd->MgmtRing.TxCpuIdx, MGMT_RING_SIZE);
RTMP_IO_WRITE32(pAd, TX_MGMTCTX_IDX, pAd->MgmtRing.TxCpuIdx);
@ -412,9 +412,9 @@ NDIS_STATUS RTMPCheckRxError(IN PRTMP_ADAPTER pAd,
PCIPHER_KEY pWpaKey;
INT dBm;
// Phy errors & CRC errors
/* Phy errors & CRC errors */
if ( /*(pRxD->PhyErr) || */ (pRxD->Crc)) {
// Check RSSI for Noise Hist statistic collection.
/* Check RSSI for Noise Hist statistic collection. */
dBm = (INT) (pRxWI->RSSI0) - pAd->BbpRssiToDbmDelta;
if (dBm <= -87)
pAd->StaCfg.RPIDensity[0] += 1;
@ -435,21 +435,21 @@ NDIS_STATUS RTMPCheckRxError(IN PRTMP_ADAPTER pAd,
return (NDIS_STATUS_FAILURE);
}
// Add Rx size to channel load counter, we should ignore error counts
/* Add Rx size to channel load counter, we should ignore error counts */
pAd->StaCfg.CLBusyBytes += (pRxD->SDL0 + 14);
// Drop ToDs promiscous frame, it is opened due to CCX 2 channel load statistics
/* Drop ToDs promiscous frame, it is opened due to CCX 2 channel load statistics */
if (pHeader != NULL) {
if (pHeader->FC.ToDs) {
return (NDIS_STATUS_FAILURE);
}
}
// Drop not U2M frames, cant's drop here because we will drop beacon in this case
// I am kind of doubting the U2M bit operation
// if (pRxD->U2M == 0)
// return(NDIS_STATUS_FAILURE);
/* Drop not U2M frames, cant's drop here because we will drop beacon in this case */
/* I am kind of doubting the U2M bit operation */
/* if (pRxD->U2M == 0) */
/* return(NDIS_STATUS_FAILURE); */
// drop decyption fail frame
/* drop decyption fail frame */
if (pRxD->CipherErr) {
if (pRxD->CipherErr == 2) {
DBGPRINT_RAW(RT_DEBUG_TRACE,
@ -471,12 +471,12 @@ NDIS_STATUS RTMPCheckRxError(IN PRTMP_ADAPTER pAd,
pRxD->CipherErr, pRxD->SDL0,
pRxD->Mcast | pRxD->Bcast, pRxD->MyBss,
pRxWI->WirelessCliID,
// CipherName[pRxD->CipherAlg],
/* CipherName[pRxD->CipherAlg], */
pRxWI->KeyIndex));
//
// MIC Error
//
/* */
/* MIC Error */
/* */
if (pRxD->CipherErr == 2) {
pWpaKey = &pAd->SharedKey[BSS0][pRxWI->KeyIndex];
if (pAd->StaCfg.WpaSupplicantUP)
@ -523,7 +523,7 @@ BOOLEAN RTMPFreeTXDUponTxDmaDone(IN PRTMP_ADAPTER pAd, IN UCHAR QueIdx)
PNDIS_PACKET pPacket;
UCHAR FREE = 0;
TXD_STRUC TxD, *pOriTxD;
//ULONG IrqFlags;
/*ULONG IrqFlags; */
BOOLEAN bReschedule = FALSE;
ASSERT(QueIdx < NUM_OF_TX_RING);
@ -532,10 +532,10 @@ BOOLEAN RTMPFreeTXDUponTxDmaDone(IN PRTMP_ADAPTER pAd, IN UCHAR QueIdx)
RTMP_IO_READ32(pAd, TX_DTX_IDX0 + QueIdx * RINGREG_DIFF,
&pTxRing->TxDmaIdx);
while (pTxRing->TxSwFreeIdx != pTxRing->TxDmaIdx) {
// RTMP_IRQ_LOCK(&pAd->irq_lock, IrqFlags);
/* RTMP_IRQ_LOCK(&pAd->irq_lock, IrqFlags); */
// static rate also need NICUpdateFifoStaCounters() function.
//if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED))
/* static rate also need NICUpdateFifoStaCounters() function. */
/*if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED)) */
NICUpdateFifoStaCounters(pAd);
/* Note : If (pAd->ate.bQATxStart == TRUE), we will never reach here. */
@ -558,7 +558,7 @@ BOOLEAN RTMPFreeTXDUponTxDmaDone(IN PRTMP_ADAPTER pAd, IN UCHAR QueIdx)
RELEASE_NDIS_PACKET(pAd, pPacket,
NDIS_STATUS_SUCCESS);
}
//Always assign pNdisPacket as NULL after clear
/*Always assign pNdisPacket as NULL after clear */
pTxRing->Cell[pTxRing->TxSwFreeIdx].pNdisPacket = NULL;
pPacket =
@ -572,7 +572,7 @@ BOOLEAN RTMPFreeTXDUponTxDmaDone(IN PRTMP_ADAPTER pAd, IN UCHAR QueIdx)
RELEASE_NDIS_PACKET(pAd, pPacket,
NDIS_STATUS_SUCCESS);
}
//Always assign pNextNdisPacket as NULL after clear
/*Always assign pNextNdisPacket as NULL after clear */
pTxRing->Cell[pTxRing->TxSwFreeIdx].pNextNdisPacket =
NULL;
}
@ -586,7 +586,7 @@ BOOLEAN RTMPFreeTXDUponTxDmaDone(IN PRTMP_ADAPTER pAd, IN UCHAR QueIdx)
&pTxRing->TxDmaIdx);
NdisMoveMemory(pOriTxD, pTxD, sizeof(TXD_STRUC));
// RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags);
/* RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags); */
}
return bReschedule;
@ -612,12 +612,12 @@ BOOLEAN RTMPFreeTXDUponTxDmaDone(IN PRTMP_ADAPTER pAd, IN UCHAR QueIdx)
BOOLEAN RTMPHandleTxRingDmaDoneInterrupt(IN PRTMP_ADAPTER pAd,
IN INT_SOURCE_CSR_STRUC TxRingBitmap)
{
// UCHAR Count = 0;
/* UCHAR Count = 0; */
unsigned long IrqFlags;
BOOLEAN bReschedule = FALSE;
// Make sure Tx ring resource won't be used by other threads
//NdisAcquireSpinLock(&pAd->TxRingLock);
/* Make sure Tx ring resource won't be used by other threads */
/*NdisAcquireSpinLock(&pAd->TxRingLock); */
RTMP_IRQ_LOCK(&pAd->irq_lock, IrqFlags);
@ -633,11 +633,11 @@ BOOLEAN RTMPHandleTxRingDmaDoneInterrupt(IN PRTMP_ADAPTER pAd,
if (TxRingBitmap.field.Ac1DmaDone)
bReschedule |= RTMPFreeTXDUponTxDmaDone(pAd, QID_AC_BK);
// Make sure to release Tx ring resource
//NdisReleaseSpinLock(&pAd->TxRingLock);
/* Make sure to release Tx ring resource */
/*NdisReleaseSpinLock(&pAd->TxRingLock); */
RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags);
// Dequeue outgoing frames from TxSwQueue[] and process it
/* Dequeue outgoing frames from TxSwQueue[] and process it */
RTMPDeQueuePacket(pAd, FALSE, NUM_OF_TX_RING, MAX_TX_PROCESS);
return bReschedule;
@ -665,7 +665,7 @@ VOID RTMPHandleMgmtRingDmaDoneInterrupt(IN PRTMP_ADAPTER pAd)
{
PTXD_STRUC pTxD;
PNDIS_PACKET pPacket;
// int i;
/* int i; */
UCHAR FREE = 0;
PRTMP_MGMT_RING pMgmtRing = &pAd->MgmtRing;
@ -789,15 +789,15 @@ PNDIS_PACKET GetPacketFromRxRing(IN PRTMP_ADAPTER pAd,
RTMP_SEM_LOCK(&pAd->RxRingLock);
if (*pRxPending == 0) {
// Get how may packets had been received
/* Get how may packets had been received */
RTMP_IO_READ32(pAd, RX_DRX_IDX, &pAd->RxRing.RxDmaIdx);
if (pAd->RxRing.RxSwReadIdx == pAd->RxRing.RxDmaIdx) {
// no more rx packets
/* no more rx packets */
bReschedule = FALSE;
goto done;
}
// get rx pending count
/* get rx pending count */
if (pAd->RxRing.RxDmaIdx > pAd->RxRing.RxSwReadIdx)
*pRxPending =
pAd->RxRing.RxDmaIdx - pAd->RxRing.RxSwReadIdx;
@ -810,17 +810,17 @@ PNDIS_PACKET GetPacketFromRxRing(IN PRTMP_ADAPTER pAd,
pRxCell = &pAd->RxRing.Cell[pAd->RxRing.RxSwReadIdx];
// Point to Rx indexed rx ring descriptor
/* Point to Rx indexed rx ring descriptor */
pRxD = (PRXD_STRUC) pRxCell->AllocVa;
if (pRxD->DDONE == 0) {
*pRxPending = 0;
// DMAIndx had done but DDONE bit not ready
/* DMAIndx had done but DDONE bit not ready */
bReschedule = TRUE;
goto done;
}
// return rx descriptor
/* return rx descriptor */
NdisMoveMemory(pSaveRxD, pRxD, RXD_SIZE);
pNewPacket =
@ -828,7 +828,7 @@ PNDIS_PACKET GetPacketFromRxRing(IN PRTMP_ADAPTER pAd,
&AllocVa, &AllocPa);
if (pNewPacket) {
// unmap the rx buffer
/* unmap the rx buffer */
PCI_UNMAP_SINGLE(pAd, pRxCell->DmaBuf.AllocPa,
pRxCell->DmaBuf.AllocSize, PCI_DMA_FROMDEVICE);
pRxPacket = pRxCell->pNdisPacket;
@ -840,17 +840,17 @@ PNDIS_PACKET GetPacketFromRxRing(IN PRTMP_ADAPTER pAd,
/* update SDP0 to new buffer of rx packet */
pRxD->SDP0 = AllocPa;
} else {
//DBGPRINT(RT_DEBUG_TRACE,("No Rx Buffer\n"));
/*DBGPRINT(RT_DEBUG_TRACE,("No Rx Buffer\n")); */
pRxPacket = NULL;
bReschedule = TRUE;
}
pRxD->DDONE = 0;
// had handled one rx packet
/* had handled one rx packet */
*pRxPending = *pRxPending - 1;
// update rx descriptor and kick rx
/* update rx descriptor and kick rx */
INC_RING_INDEX(pAd->RxRing.RxSwReadIdx, RX_RING_SIZE);
pAd->RxRing.RxCpuIdx =
@ -874,28 +874,28 @@ NDIS_STATUS MlmeHardTransmitTxRing(IN PRTMP_ADAPTER pAd,
PHEADER_802_11 pHeader_802_11;
BOOLEAN bAckRequired, bInsertTimestamp;
ULONG SrcBufPA;
//UCHAR TxBufIdx;
/*UCHAR TxBufIdx; */
UCHAR MlmeRate;
ULONG SwIdx = pAd->TxRing[QueIdx].TxCpuIdx;
PTXWI_STRUC pFirstTxWI;
//ULONG i;
//HTTRANSMIT_SETTING MlmeTransmit; //Rate for this MGMT frame.
/*ULONG i; */
/*HTTRANSMIT_SETTING MlmeTransmit; //Rate for this MGMT frame. */
ULONG FreeNum;
MAC_TABLE_ENTRY *pMacEntry = NULL;
RTMP_QueryPacketInfo(pPacket, &PacketInfo, &pSrcBufVA, &SrcBufLen);
if (pSrcBufVA == NULL) {
// The buffer shouldn't be NULL
/* The buffer shouldn't be NULL */
return NDIS_STATUS_FAILURE;
}
// Make sure MGMT ring resource won't be used by other threads
//NdisAcquireSpinLock(&pAd->TxRingLock);
/* Make sure MGMT ring resource won't be used by other threads */
/*NdisAcquireSpinLock(&pAd->TxRingLock); */
FreeNum = GET_TXRING_FREENO(pAd, QueIdx);
if (FreeNum == 0) {
//NdisReleaseSpinLock(&pAd->TxRingLock);
/*NdisReleaseSpinLock(&pAd->TxRingLock); */
return NDIS_STATUS_FAILURE;
}
@ -905,13 +905,13 @@ NDIS_STATUS MlmeHardTransmitTxRing(IN PRTMP_ADAPTER pAd,
if (pAd->TxRing[QueIdx].Cell[SwIdx].pNdisPacket) {
DBGPRINT(RT_DEBUG_OFF, ("MlmeHardTransmit Error\n"));
//NdisReleaseSpinLock(&pAd->TxRingLock);
/*NdisReleaseSpinLock(&pAd->TxRingLock); */
return NDIS_STATUS_FAILURE;
}
{
// outgoing frame always wakeup PHY to prevent frame lost
// if (pAd->StaCfg.Psm == PWR_SAVE)
/* outgoing frame always wakeup PHY to prevent frame lost */
/* if (pAd->StaCfg.Psm == PWR_SAVE) */
if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE))
AsicForceWakeup(pAd, TRUE);
}
@ -928,18 +928,18 @@ NDIS_STATUS MlmeHardTransmitTxRing(IN PRTMP_ADAPTER pAd,
(pHeader_802_11->FC.SubType == SUBTYPE_QOS_NULL)) {
pMacEntry = MacTableLookup(pAd, pHeader_802_11->Addr1);
}
// Verify Mlme rate for a / g bands.
if ((pAd->LatchRfRegs.Channel > 14) && (MlmeRate < RATE_6)) // 11A band
/* Verify Mlme rate for a / g bands. */
if ((pAd->LatchRfRegs.Channel > 14) && (MlmeRate < RATE_6)) /* 11A band */
MlmeRate = RATE_6;
//
// Should not be hard code to set PwrMgmt to 0 (PWR_ACTIVE)
// Snice it's been set to 0 while on MgtMacHeaderInit
// By the way this will cause frame to be send on PWR_SAVE failed.
//
//
// In WMM-UAPSD, mlme frame should be set psm as power saving but probe request frame
// Data-Null packets alse pass through MMRequest in RT2860, however, we hope control the psm bit to pass APSD
/* */
/* Should not be hard code to set PwrMgmt to 0 (PWR_ACTIVE) */
/* Snice it's been set to 0 while on MgtMacHeaderInit */
/* By the way this will cause frame to be send on PWR_SAVE failed. */
/* */
/* */
/* In WMM-UAPSD, mlme frame should be set psm as power saving but probe request frame */
/* Data-Null packets alse pass through MMRequest in RT2860, however, we hope control the psm bit to pass APSD */
if (pHeader_802_11->FC.Type != BTYPE_DATA) {
if ((pHeader_802_11->FC.SubType == SUBTYPE_PROBE_REQ)
|| !(pAd->CommonCfg.bAPSDCapable
@ -952,12 +952,12 @@ NDIS_STATUS MlmeHardTransmitTxRing(IN PRTMP_ADAPTER pAd,
}
bInsertTimestamp = FALSE;
if (pHeader_802_11->FC.Type == BTYPE_CNTL) // must be PS-POLL
if (pHeader_802_11->FC.Type == BTYPE_CNTL) /* must be PS-POLL */
{
bAckRequired = FALSE;
} else // BTYPE_MGMT or BTYPE_DATA(must be NULL frame)
} else /* BTYPE_MGMT or BTYPE_DATA(must be NULL frame) */
{
if (pHeader_802_11->Addr1[0] & 0x01) // MULTICAST, BROADCAST
if (pHeader_802_11->Addr1[0] & 0x01) /* MULTICAST, BROADCAST */
{
bAckRequired = FALSE;
pHeader_802_11->Duration = 0;
@ -973,29 +973,29 @@ NDIS_STATUS MlmeHardTransmitTxRing(IN PRTMP_ADAPTER pAd,
pHeader_802_11->Sequence = pAd->Sequence++;
if (pAd->Sequence > 0xfff)
pAd->Sequence = 0;
// Before radar detection done, mgmt frame can not be sent but probe req
// Because we need to use probe req to trigger driver to send probe req in passive scan
/* Before radar detection done, mgmt frame can not be sent but probe req */
/* Because we need to use probe req to trigger driver to send probe req in passive scan */
if ((pHeader_802_11->FC.SubType != SUBTYPE_PROBE_REQ)
&& (pAd->CommonCfg.bIEEE80211H == 1)
&& (pAd->CommonCfg.RadarDetect.RDMode != RD_NORMAL_MODE)) {
DBGPRINT(RT_DEBUG_ERROR,
("MlmeHardTransmit --> radar detect not in normal mode !!!\n"));
//NdisReleaseSpinLock(&pAd->TxRingLock);
/*NdisReleaseSpinLock(&pAd->TxRingLock); */
return (NDIS_STATUS_FAILURE);
}
//
// fill scatter-and-gather buffer list into TXD. Internally created NDIS PACKET
// should always has only one ohysical buffer, and the whole frame size equals
// to the first scatter buffer size
//
/* */
/* fill scatter-and-gather buffer list into TXD. Internally created NDIS PACKET */
/* should always has only one ohysical buffer, and the whole frame size equals */
/* to the first scatter buffer size */
/* */
// Initialize TX Descriptor
// For inter-frame gap, the number is for this frame and next frame
// For MLME rate, we will fix as 2Mb to match other vendor's implement
// pAd->CommonCfg.MlmeTransmit.field.MODE = 1;
/* Initialize TX Descriptor */
/* For inter-frame gap, the number is for this frame and next frame */
/* For MLME rate, we will fix as 2Mb to match other vendor's implement */
/* pAd->CommonCfg.MlmeTransmit.field.MODE = 1; */
// management frame doesn't need encryption. so use RESERVED_WCID no matter u are sending to specific wcid or not.
// Only beacon use Nseq=TRUE. So here we use Nseq=FALSE.
/* management frame doesn't need encryption. so use RESERVED_WCID no matter u are sending to specific wcid or not. */
/* Only beacon use Nseq=TRUE. So here we use Nseq=FALSE. */
if (pMacEntry == NULL) {
RTMPWriteTxWI(pAd, pFirstTxWI, FALSE, FALSE, bInsertTimestamp,
FALSE, bAckRequired, FALSE, 0, RESERVED_WCID,
@ -1013,7 +1013,7 @@ NDIS_STATUS MlmeHardTransmitTxRing(IN PRTMP_ADAPTER pAd,
pAd->TxRing[QueIdx].Cell[SwIdx].pNdisPacket = pPacket;
pAd->TxRing[QueIdx].Cell[SwIdx].pNextNdisPacket = NULL;
// pFirstTxWI->MPDUtotalByteCount = SrcBufLen - TXWI_SIZE;
/* pFirstTxWI->MPDUtotalByteCount = SrcBufLen - TXWI_SIZE; */
SrcBufPA =
PCI_MAP_SINGLE(pAd, pSrcBufVA, SrcBufLen, 0, PCI_DMA_TODEVICE);
@ -1028,14 +1028,14 @@ NDIS_STATUS MlmeHardTransmitTxRing(IN PRTMP_ADAPTER pAd,
pAd->RalinkCounters.KickTxCount++;
pAd->RalinkCounters.OneSecTxDoneCount++;
// Increase TX_CTX_IDX, but write to register later.
/* Increase TX_CTX_IDX, but write to register later. */
INC_RING_INDEX(pAd->TxRing[QueIdx].TxCpuIdx, TX_RING_SIZE);
RTMP_IO_WRITE32(pAd, TX_CTX_IDX0 + QueIdx * 0x10,
pAd->TxRing[QueIdx].TxCpuIdx);
// Make sure to release MGMT ring resource
// NdisReleaseSpinLock(&pAd->TxRingLock);
/* Make sure to release MGMT ring resource */
/* NdisReleaseSpinLock(&pAd->TxRingLock); */
return NDIS_STATUS_SUCCESS;
}
@ -1082,15 +1082,15 @@ VOID RTMPWriteTxDescriptor(IN PRTMP_ADAPTER pAd,
IN PTXD_STRUC pTxD,
IN BOOLEAN bWIV, IN UCHAR QueueSEL)
{
//
// Always use Long preamble before verifiation short preamble functionality works well.
// Todo: remove the following line if short preamble functionality works
//
/* */
/* Always use Long preamble before verifiation short preamble functionality works well. */
/* Todo: remove the following line if short preamble functionality works */
/* */
OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_SHORT_PREAMBLE_INUSED);
pTxD->WIV = (bWIV) ? 1 : 0;
pTxD->QSEL = (QueueSEL);
//RT2860c?? fixed using EDCA queue for test... We doubt Queue1 has problem. 2006-09-26 Jan
//pTxD->QSEL= FIFO_EDCA;
/*RT2860c?? fixed using EDCA queue for test... We doubt Queue1 has problem. 2006-09-26 Jan */
/*pTxD->QSEL= FIFO_EDCA; */
pTxD->DMADONE = 0;
}

View file

@ -73,7 +73,7 @@ USHORT RtmpUSB_WriteSubTxResource(IN PRTMP_ADAPTER pAd,
IN BOOLEAN bIsLast, OUT USHORT * FreeNumber)
{
// Dummy function. Should be removed in the future.
/* Dummy function. Should be removed in the future. */
return 0;
}
@ -83,7 +83,7 @@ USHORT RtmpUSB_WriteFragTxResource(IN PRTMP_ADAPTER pAd,
IN UCHAR fragNum, OUT USHORT * FreeNumber)
{
HT_TX_CONTEXT *pHTTXContext;
USHORT hwHdrLen; // The hwHdrLen consist of 802.11 header length plus the header padding length.
USHORT hwHdrLen; /* The hwHdrLen consist of 802.11 header length plus the header padding length. */
UINT32 fillOffset;
TXINFO_STRUC *pTxInfo;
TXWI_STRUC *pTxWI;
@ -94,9 +94,9 @@ USHORT RtmpUSB_WriteFragTxResource(IN PRTMP_ADAPTER pAd,
UINT32 USBDMApktLen = 0, DMAHdrLen, padding;
BOOLEAN TxQLastRound = FALSE;
//
// get Tx Ring Resource & Dma Buffer address
//
/* */
/* get Tx Ring Resource & Dma Buffer address */
/* */
QueIdx = pTxBlk->QueIdx;
pHTTXContext = &pAd->TxContext[QueIdx];
@ -106,12 +106,12 @@ USHORT RtmpUSB_WriteFragTxResource(IN PRTMP_ADAPTER pAd,
fillOffset = pHTTXContext->CurWritePosition;
if (fragNum == 0) {
// Check if we have enough space for this bulk-out batch.
/* Check if we have enough space for this bulk-out batch. */
Status = RtmpUSBCanDoWrite(pAd, QueIdx, pHTTXContext);
if (Status == NDIS_STATUS_SUCCESS) {
pHTTXContext->bCurWriting = TRUE;
// Reserve space for 8 bytes padding.
/* Reserve space for 8 bytes padding. */
if ((pHTTXContext->ENextBulkOutPosition ==
pHTTXContext->CurWritePosition)) {
pHTTXContext->ENextBulkOutPosition += 8;
@ -130,7 +130,7 @@ USHORT RtmpUSB_WriteFragTxResource(IN PRTMP_ADAPTER pAd,
return (Status);
}
} else {
// For sub-sequent frames of this bulk-out batch. Just copy it to our bulk-out buffer.
/* For sub-sequent frames of this bulk-out batch. Just copy it to our bulk-out buffer. */
Status =
((pHTTXContext->bCurWriting ==
TRUE) ? NDIS_STATUS_SUCCESS : NDIS_STATUS_FAILURE);
@ -153,19 +153,19 @@ USHORT RtmpUSB_WriteFragTxResource(IN PRTMP_ADAPTER pAd,
pWirelessPacket =
&pHTTXContext->TransferBuffer->field.WirelessPacket[fillOffset];
// copy TXWI + WLAN Header + LLC into DMA Header Buffer
//hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4);
/* copy TXWI + WLAN Header + LLC into DMA Header Buffer */
/*hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4); */
hwHdrLen = pTxBlk->MpduHeaderLen + pTxBlk->HdrPadLen;
// Build our URB for USBD
/* Build our URB for USBD */
DMAHdrLen = TXWI_SIZE + hwHdrLen;
USBDMApktLen = DMAHdrLen + pTxBlk->SrcBufLen;
padding = (4 - (USBDMApktLen % 4)) & 0x03; // round up to 4 byte alignment
padding = (4 - (USBDMApktLen % 4)) & 0x03; /* round up to 4 byte alignment */
USBDMApktLen += padding;
pTxBlk->Priv += (TXINFO_SIZE + USBDMApktLen);
// For TxInfo, the length of USBDMApktLen = TXWI_SIZE + 802.11 header + payload
/* For TxInfo, the length of USBDMApktLen = TXWI_SIZE + 802.11 header + payload */
RTMPWriteTxInfo(pAd, pTxInfo, (USHORT) (USBDMApktLen), FALSE, FIFO_EDCA,
FALSE /*NextValid */ , FALSE);
@ -189,25 +189,25 @@ USHORT RtmpUSB_WriteFragTxResource(IN PRTMP_ADAPTER pAd,
NdisMoveMemory(pWirelessPacket, pTxBlk->pSrcBufData, pTxBlk->SrcBufLen);
// Zero the last padding.
/* Zero the last padding. */
pWirelessPacket += pTxBlk->SrcBufLen;
NdisZeroMemory(pWirelessPacket, padding + 8);
if (fragNum == pTxBlk->TotalFragNum) {
RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[QueIdx], IrqFlags);
// Update the pHTTXContext->CurWritePosition. 3906 used to prevent the NextBulkOut is a A-RALINK/A-MSDU Frame.
/* Update the pHTTXContext->CurWritePosition. 3906 used to prevent the NextBulkOut is a A-RALINK/A-MSDU Frame. */
pHTTXContext->CurWritePosition += pTxBlk->Priv;
if (TxQLastRound == TRUE)
pHTTXContext->CurWritePosition = 8;
pHTTXContext->CurWriteRealPos = pHTTXContext->CurWritePosition;
// Finally, set bCurWriting as FALSE
/* Finally, set bCurWriting as FALSE */
pHTTXContext->bCurWriting = FALSE;
RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[QueIdx], IrqFlags);
// succeed and release the skb buffer
/* succeed and release the skb buffer */
RELEASE_NDIS_PACKET(pAd, pTxBlk->pPacket, NDIS_STATUS_SUCCESS);
}
@ -232,19 +232,19 @@ USHORT RtmpUSB_WriteSingleTxResource(IN PRTMP_ADAPTER pAd,
UINT32 USBDMApktLen = 0, DMAHdrLen, padding;
BOOLEAN bTxQLastRound = FALSE;
// For USB, didn't need PCI_MAP_SINGLE()
//SrcBufPA = PCI_MAP_SINGLE(pAd, (char *) pTxBlk->pSrcBufData, pTxBlk->SrcBufLen, PCI_DMA_TODEVICE);
/* For USB, didn't need PCI_MAP_SINGLE() */
/*SrcBufPA = PCI_MAP_SINGLE(pAd, (char *) pTxBlk->pSrcBufData, pTxBlk->SrcBufLen, PCI_DMA_TODEVICE); */
//
// get Tx Ring Resource & Dma Buffer address
//
/* */
/* get Tx Ring Resource & Dma Buffer address */
/* */
QueIdx = pTxBlk->QueIdx;
RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[QueIdx], IrqFlags);
pHTTXContext = &pAd->TxContext[QueIdx];
fillOffset = pHTTXContext->CurWritePosition;
// Check ring full.
/* Check ring full. */
Status = RtmpUSBCanDoWrite(pAd, QueIdx, pHTTXContext);
if (Status == NDIS_STATUS_SUCCESS) {
pHTTXContext->bCurWriting = TRUE;
@ -252,7 +252,7 @@ USHORT RtmpUSB_WriteSingleTxResource(IN PRTMP_ADAPTER pAd,
pTxInfo = (PTXINFO_STRUC) (&pTxBlk->HeaderBuf[0]);
pTxWI = (PTXWI_STRUC) (&pTxBlk->HeaderBuf[TXINFO_SIZE]);
// Reserve space for 8 bytes padding.
/* Reserve space for 8 bytes padding. */
if ((pHTTXContext->ENextBulkOutPosition ==
pHTTXContext->CurWritePosition)) {
pHTTXContext->ENextBulkOutPosition += 8;
@ -265,19 +265,19 @@ USHORT RtmpUSB_WriteSingleTxResource(IN PRTMP_ADAPTER pAd,
&pHTTXContext->TransferBuffer->field.
WirelessPacket[fillOffset];
// copy TXWI + WLAN Header + LLC into DMA Header Buffer
//hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4);
/* copy TXWI + WLAN Header + LLC into DMA Header Buffer */
/*hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4); */
hwHdrLen = pTxBlk->MpduHeaderLen + pTxBlk->HdrPadLen;
// Build our URB for USBD
/* Build our URB for USBD */
DMAHdrLen = TXWI_SIZE + hwHdrLen;
USBDMApktLen = DMAHdrLen + pTxBlk->SrcBufLen;
padding = (4 - (USBDMApktLen % 4)) & 0x03; // round up to 4 byte alignment
padding = (4 - (USBDMApktLen % 4)) & 0x03; /* round up to 4 byte alignment */
USBDMApktLen += padding;
pTxBlk->Priv = (TXINFO_SIZE + USBDMApktLen);
// For TxInfo, the length of USBDMApktLen = TXWI_SIZE + 802.11 header + payload
/* For TxInfo, the length of USBDMApktLen = TXWI_SIZE + 802.11 header + payload */
RTMPWriteTxInfo(pAd, pTxInfo, (USHORT) (USBDMApktLen), FALSE,
FIFO_EDCA, FALSE /*NextValid */ , FALSE);
@ -290,16 +290,16 @@ USHORT RtmpUSB_WriteSingleTxResource(IN PRTMP_ADAPTER pAd,
TXINFO_SIZE + TXWI_SIZE + hwHdrLen);
pWirelessPacket += (TXINFO_SIZE + TXWI_SIZE + hwHdrLen);
// We unlock it here to prevent the first 8 bytes maybe over-writed issue.
// 1. First we got CurWritePosition but the first 8 bytes still not write to the pTxcontext.
// 2. An interrupt break our routine and handle bulk-out complete.
// 3. In the bulk-out compllete, it need to do another bulk-out,
// if the ENextBulkOutPosition is just the same as CurWritePosition, it will save the first 8 bytes from CurWritePosition,
// but the payload still not copyed. the pTxContext->SavedPad[] will save as allzero. and set the bCopyPad = TRUE.
// 4. Interrupt complete.
// 5. Our interrupted routine go back and fill the first 8 bytes to pTxContext.
// 6. Next time when do bulk-out, it found the bCopyPad==TRUE and will copy the SavedPad[] to pTxContext->NextBulkOutPosition.
// and the packet will wrong.
/* We unlock it here to prevent the first 8 bytes maybe over-writed issue. */
/* 1. First we got CurWritePosition but the first 8 bytes still not write to the pTxcontext. */
/* 2. An interrupt break our routine and handle bulk-out complete. */
/* 3. In the bulk-out compllete, it need to do another bulk-out, */
/* if the ENextBulkOutPosition is just the same as CurWritePosition, it will save the first 8 bytes from CurWritePosition, */
/* but the payload still not copyed. the pTxContext->SavedPad[] will save as allzero. and set the bCopyPad = TRUE. */
/* 4. Interrupt complete. */
/* 5. Our interrupted routine go back and fill the first 8 bytes to pTxContext. */
/* 6. Next time when do bulk-out, it found the bCopyPad==TRUE and will copy the SavedPad[] to pTxContext->NextBulkOutPosition. */
/* and the packet will wrong. */
pHTTXContext->CurWriteRealPos +=
(TXINFO_SIZE + TXWI_SIZE + hwHdrLen);
RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[QueIdx], IrqFlags);
@ -321,7 +321,7 @@ USHORT RtmpUSB_WriteSingleTxResource(IN PRTMP_ADAPTER pAd,
RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[QueIdx], IrqFlags);
// succeed and release the skb buffer
/* succeed and release the skb buffer */
RELEASE_NDIS_PACKET(pAd, pTxBlk->pPacket, NDIS_STATUS_SUCCESS);
return (Status);
@ -333,7 +333,7 @@ USHORT RtmpUSB_WriteMultiTxResource(IN PRTMP_ADAPTER pAd,
IN UCHAR frameNum, OUT USHORT * FreeNumber)
{
HT_TX_CONTEXT *pHTTXContext;
USHORT hwHdrLen; // The hwHdrLen consist of 802.11 header length plus the header padding length.
USHORT hwHdrLen; /* The hwHdrLen consist of 802.11 header length plus the header padding length. */
UINT32 fillOffset;
TXINFO_STRUC *pTxInfo;
TXWI_STRUC *pTxWI;
@ -341,18 +341,18 @@ USHORT RtmpUSB_WriteMultiTxResource(IN PRTMP_ADAPTER pAd,
UCHAR QueIdx;
NDIS_STATUS Status;
unsigned long IrqFlags;
//UINT32 USBDMApktLen = 0, DMAHdrLen, padding;
/*UINT32 USBDMApktLen = 0, DMAHdrLen, padding; */
//
// get Tx Ring Resource & Dma Buffer address
//
/* */
/* get Tx Ring Resource & Dma Buffer address */
/* */
QueIdx = pTxBlk->QueIdx;
pHTTXContext = &pAd->TxContext[QueIdx];
RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[QueIdx], IrqFlags);
if (frameNum == 0) {
// Check if we have enough space for this bulk-out batch.
/* Check if we have enough space for this bulk-out batch. */
Status = RtmpUSBCanDoWrite(pAd, QueIdx, pHTTXContext);
if (Status == NDIS_STATUS_SUCCESS) {
pHTTXContext->bCurWriting = TRUE;
@ -360,7 +360,7 @@ USHORT RtmpUSB_WriteMultiTxResource(IN PRTMP_ADAPTER pAd,
pTxInfo = (PTXINFO_STRUC) (&pTxBlk->HeaderBuf[0]);
pTxWI = (PTXWI_STRUC) (&pTxBlk->HeaderBuf[TXINFO_SIZE]);
// Reserve space for 8 bytes padding.
/* Reserve space for 8 bytes padding. */
if ((pHTTXContext->ENextBulkOutPosition ==
pHTTXContext->CurWritePosition)) {
@ -375,43 +375,43 @@ USHORT RtmpUSB_WriteMultiTxResource(IN PRTMP_ADAPTER pAd,
&pHTTXContext->TransferBuffer->field.
WirelessPacket[fillOffset];
//
// Copy TXINFO + TXWI + WLAN Header + LLC into DMA Header Buffer
//
/* */
/* Copy TXINFO + TXWI + WLAN Header + LLC into DMA Header Buffer */
/* */
if (pTxBlk->TxFrameType == TX_AMSDU_FRAME)
//hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen-LENGTH_AMSDU_SUBFRAMEHEAD, 4)+LENGTH_AMSDU_SUBFRAMEHEAD;
/*hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen-LENGTH_AMSDU_SUBFRAMEHEAD, 4)+LENGTH_AMSDU_SUBFRAMEHEAD; */
hwHdrLen =
pTxBlk->MpduHeaderLen -
LENGTH_AMSDU_SUBFRAMEHEAD +
pTxBlk->HdrPadLen +
LENGTH_AMSDU_SUBFRAMEHEAD;
else if (pTxBlk->TxFrameType == TX_RALINK_FRAME)
//hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen-LENGTH_ARALINK_HEADER_FIELD, 4)+LENGTH_ARALINK_HEADER_FIELD;
/*hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen-LENGTH_ARALINK_HEADER_FIELD, 4)+LENGTH_ARALINK_HEADER_FIELD; */
hwHdrLen =
pTxBlk->MpduHeaderLen -
LENGTH_ARALINK_HEADER_FIELD +
pTxBlk->HdrPadLen +
LENGTH_ARALINK_HEADER_FIELD;
else
//hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4);
/*hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4); */
hwHdrLen =
pTxBlk->MpduHeaderLen + pTxBlk->HdrPadLen;
// Update the pTxBlk->Priv.
/* Update the pTxBlk->Priv. */
pTxBlk->Priv = TXINFO_SIZE + TXWI_SIZE + hwHdrLen;
// pTxInfo->USBDMApktLen now just a temp value and will to correct latter.
/* pTxInfo->USBDMApktLen now just a temp value and will to correct latter. */
RTMPWriteTxInfo(pAd, pTxInfo, (USHORT) (pTxBlk->Priv),
FALSE, FIFO_EDCA, FALSE /*NextValid */ ,
FALSE);
// Copy it.
/* Copy it. */
NdisMoveMemory(pWirelessPacket, pTxBlk->HeaderBuf,
pTxBlk->Priv);
pHTTXContext->CurWriteRealPos += pTxBlk->Priv;
pWirelessPacket += pTxBlk->Priv;
}
} else { // For sub-sequent frames of this bulk-out batch. Just copy it to our bulk-out buffer.
} else { /* For sub-sequent frames of this bulk-out batch. Just copy it to our bulk-out buffer. */
Status =
((pHTTXContext->bCurWriting ==
@ -423,28 +423,28 @@ USHORT RtmpUSB_WriteMultiTxResource(IN PRTMP_ADAPTER pAd,
&pHTTXContext->TransferBuffer->field.
WirelessPacket[fillOffset];
//hwHdrLen = pTxBlk->MpduHeaderLen;
/*hwHdrLen = pTxBlk->MpduHeaderLen; */
NdisMoveMemory(pWirelessPacket, pTxBlk->HeaderBuf,
pTxBlk->MpduHeaderLen);
pWirelessPacket += (pTxBlk->MpduHeaderLen);
pTxBlk->Priv += pTxBlk->MpduHeaderLen;
} else { // It should not happened now unless we are going to shutdown.
} else { /* It should not happened now unless we are going to shutdown. */
DBGPRINT(RT_DEBUG_ERROR,
("WriteMultiTxResource():bCurWriting is FALSE when handle sub-sequent frames.\n"));
Status = NDIS_STATUS_FAILURE;
}
}
// We unlock it here to prevent the first 8 bytes maybe over-write issue.
// 1. First we got CurWritePosition but the first 8 bytes still not write to the pTxContext.
// 2. An interrupt break our routine and handle bulk-out complete.
// 3. In the bulk-out compllete, it need to do another bulk-out,
// if the ENextBulkOutPosition is just the same as CurWritePosition, it will save the first 8 bytes from CurWritePosition,
// but the payload still not copyed. the pTxContext->SavedPad[] will save as allzero. and set the bCopyPad = TRUE.
// 4. Interrupt complete.
// 5. Our interrupted routine go back and fill the first 8 bytes to pTxContext.
// 6. Next time when do bulk-out, it found the bCopyPad==TRUE and will copy the SavedPad[] to pTxContext->NextBulkOutPosition.
// and the packet will wrong.
/* We unlock it here to prevent the first 8 bytes maybe over-write issue. */
/* 1. First we got CurWritePosition but the first 8 bytes still not write to the pTxContext. */
/* 2. An interrupt break our routine and handle bulk-out complete. */
/* 3. In the bulk-out compllete, it need to do another bulk-out, */
/* if the ENextBulkOutPosition is just the same as CurWritePosition, it will save the first 8 bytes from CurWritePosition, */
/* but the payload still not copyed. the pTxContext->SavedPad[] will save as allzero. and set the bCopyPad = TRUE. */
/* 4. Interrupt complete. */
/* 5. Our interrupted routine go back and fill the first 8 bytes to pTxContext. */
/* 6. Next time when do bulk-out, it found the bCopyPad==TRUE and will copy the SavedPad[] to pTxContext->NextBulkOutPosition. */
/* and the packet will wrong. */
RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[QueIdx], IrqFlags);
if (Status != NDIS_STATUS_SUCCESS) {
@ -454,13 +454,13 @@ USHORT RtmpUSB_WriteMultiTxResource(IN PRTMP_ADAPTER pAd,
pHTTXContext->NextBulkOutPosition));
goto done;
}
// Copy the frame content into DMA buffer and update the pTxBlk->Priv
/* Copy the frame content into DMA buffer and update the pTxBlk->Priv */
NdisMoveMemory(pWirelessPacket, pTxBlk->pSrcBufData, pTxBlk->SrcBufLen);
pWirelessPacket += pTxBlk->SrcBufLen;
pTxBlk->Priv += pTxBlk->SrcBufLen;
done:
// Release the skb buffer here
/* Release the skb buffer here */
RELEASE_NDIS_PACKET(pAd, pTxBlk->pPacket, NDIS_STATUS_SUCCESS);
return (Status);
@ -498,47 +498,47 @@ VOID RtmpUSB_FinalWriteTxResource(IN PRTMP_ADAPTER pAd,
(PUCHAR) (&pHTTXContext->TransferBuffer->field.
WirelessPacket[fillOffset]);
//
// Update TxInfo->USBDMApktLen ,
// the length = TXWI_SIZE + 802.11_hdr + 802.11_hdr_pad + payload_of_all_batch_frames + Bulk-Out-padding
//
/* */
/* Update TxInfo->USBDMApktLen , */
/* the length = TXWI_SIZE + 802.11_hdr + 802.11_hdr_pad + payload_of_all_batch_frames + Bulk-Out-padding */
/* */
pTxInfo = (PTXINFO_STRUC) (pWirelessPacket);
// Calculate the bulk-out padding
/* Calculate the bulk-out padding */
USBDMApktLen = pTxBlk->Priv - TXINFO_SIZE;
padding = (4 - (USBDMApktLen % 4)) & 0x03; // round up to 4 byte alignment
padding = (4 - (USBDMApktLen % 4)) & 0x03; /* round up to 4 byte alignment */
USBDMApktLen += padding;
pTxInfo->USBDMATxPktLen = USBDMApktLen;
//
// Update TXWI->MPDUtotalByteCount ,
// the length = 802.11 header + payload_of_all_batch_frames
/* */
/* Update TXWI->MPDUtotalByteCount , */
/* the length = 802.11 header + payload_of_all_batch_frames */
pTxWI = (PTXWI_STRUC) (pWirelessPacket + TXINFO_SIZE);
pTxWI->MPDUtotalByteCount = totalMPDUSize;
//
// Update the pHTTXContext->CurWritePosition
//
/* */
/* Update the pHTTXContext->CurWritePosition */
/* */
pHTTXContext->CurWritePosition += (TXINFO_SIZE + USBDMApktLen);
if ((pHTTXContext->CurWritePosition + 3906) > MAX_TXBULK_LIMIT) { // Add 3906 for prevent the NextBulkOut packet size is a A-RALINK/A-MSDU Frame.
if ((pHTTXContext->CurWritePosition + 3906) > MAX_TXBULK_LIMIT) { /* Add 3906 for prevent the NextBulkOut packet size is a A-RALINK/A-MSDU Frame. */
pHTTXContext->CurWritePosition = 8;
pTxInfo->SwUseLastRound = 1;
}
pHTTXContext->CurWriteRealPos = pHTTXContext->CurWritePosition;
//
// Zero the last padding.
//
/* */
/* Zero the last padding. */
/* */
pWirelessPacket =
(&pHTTXContext->TransferBuffer->field.
WirelessPacket[fillOffset + pTxBlk->Priv]);
NdisZeroMemory(pWirelessPacket, padding + 8);
// Finally, set bCurWriting as FALSE
/* Finally, set bCurWriting as FALSE */
pHTTXContext->bCurWriting = FALSE;
} else { // It should not happened now unless we are going to shutdown.
} else { /* It should not happened now unless we are going to shutdown. */
DBGPRINT(RT_DEBUG_ERROR,
("FinalWriteTxResource():bCurWriting is FALSE when handle last frames.\n"));
}
@ -550,7 +550,7 @@ VOID RtmpUSB_FinalWriteTxResource(IN PRTMP_ADAPTER pAd,
VOID RtmpUSBDataLastTxIdx(IN PRTMP_ADAPTER pAd,
IN UCHAR QueIdx, IN USHORT TxIdx)
{
// DO nothing for USB.
/* DO nothing for USB. */
}
/*
@ -589,22 +589,22 @@ int RtmpUSBMgmtKickOut(IN RTMP_ADAPTER * pAd,
pTxInfo = (PTXINFO_STRUC) (pSrcBufVA);
// Build our URB for USBD
/* Build our URB for USBD */
BulkOutSize = SrcBufLen;
BulkOutSize = (BulkOutSize + 3) & (~3);
RTMPWriteTxInfo(pAd, pTxInfo, (USHORT) (BulkOutSize - TXINFO_SIZE),
TRUE, EpToQueue[MGMTPIPEIDX], FALSE, FALSE);
BulkOutSize += 4; // Always add 4 extra bytes at every packet.
BulkOutSize += 4; /* Always add 4 extra bytes at every packet. */
// If BulkOutSize is multiple of BulkOutMaxPacketSize, add extra 4 bytes again.
/* If BulkOutSize is multiple of BulkOutMaxPacketSize, add extra 4 bytes again. */
if ((BulkOutSize % pAd->BulkOutMaxPacketSize) == 0)
BulkOutSize += 4;
padLen = BulkOutSize - SrcBufLen;
ASSERT((padLen <= RTMP_PKT_TAIL_PADDING));
// Now memzero all extra padding bytes.
/* Now memzero all extra padding bytes. */
pDest = (PUCHAR) (pSrcBufVA + SrcBufLen);
skb_put(GET_OS_PKT_TYPE(pPacket), padLen);
NdisZeroMemory(pDest, padLen);
@ -615,28 +615,28 @@ int RtmpUSBMgmtKickOut(IN RTMP_ADAPTER * pAd,
pMLMEContext->TransferBuffer =
(PTX_BUFFER) (GET_OS_PKT_DATAPTR(pPacket));
// Length in TxInfo should be 8 less than bulkout size.
/* Length in TxInfo should be 8 less than bulkout size. */
pMLMEContext->BulkOutSize = BulkOutSize;
pMLMEContext->InUse = TRUE;
pMLMEContext->bWaitingBulkOut = TRUE;
//for debug
//hex_dump("RtmpUSBMgmtKickOut", &pMLMEContext->TransferBuffer->field.WirelessPacket[0], (pMLMEContext->BulkOutSize > 16 ? 16 : pMLMEContext->BulkOutSize));
/*for debug */
/*hex_dump("RtmpUSBMgmtKickOut", &pMLMEContext->TransferBuffer->field.WirelessPacket[0], (pMLMEContext->BulkOutSize > 16 ? 16 : pMLMEContext->BulkOutSize)); */
//pAd->RalinkCounters.KickTxCount++;
//pAd->RalinkCounters.OneSecTxDoneCount++;
/*pAd->RalinkCounters.KickTxCount++; */
/*pAd->RalinkCounters.OneSecTxDoneCount++; */
//if (pAd->MgmtRing.TxSwFreeIdx == MGMT_RING_SIZE)
// needKickOut = TRUE;
/*if (pAd->MgmtRing.TxSwFreeIdx == MGMT_RING_SIZE) */
/* needKickOut = TRUE; */
// Decrease the TxSwFreeIdx and Increase the TX_CTX_IDX
/* Decrease the TxSwFreeIdx and Increase the TX_CTX_IDX */
pAd->MgmtRing.TxSwFreeIdx--;
INC_RING_INDEX(pAd->MgmtRing.TxCpuIdx, MGMT_RING_SIZE);
RTMP_IRQ_UNLOCK(&pAd->MLMEBulkOutLock, IrqFlags);
RTUSB_SET_BULK_FLAG(pAd, fRTUSB_BULK_OUT_MLME);
//if (needKickOut)
/*if (needKickOut) */
RTUSBKickBulkOut(pAd);
return 0;
@ -654,7 +654,7 @@ VOID RtmpUSBNullFrameKickOut(IN RTMP_ADAPTER * pAd,
pNullContext = &(pAd->NullContext);
// Set the in use bit
/* Set the in use bit */
pNullContext->InUse = TRUE;
pWirelessPkt =
(PUCHAR) & pNullContext->TransferBuffer->field.
@ -677,14 +677,14 @@ VOID RtmpUSBNullFrameKickOut(IN RTMP_ADAPTER * pAd,
pAd->NullContext.BulkOutSize =
TXINFO_SIZE + TXWI_SIZE + sizeof(pAd->NullFrame) + 4;
// Fill out frame length information for global Bulk out arbitor
//pNullContext->BulkOutSize = TransferBufferLength;
/* Fill out frame length information for global Bulk out arbitor */
/*pNullContext->BulkOutSize = TransferBufferLength; */
DBGPRINT(RT_DEBUG_TRACE,
("SYNC - send NULL Frame @%d Mbps...\n",
RateIdToMbps[pAd->CommonCfg.TxRate]));
RTUSB_SET_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NULL);
// Kick bulk out
/* Kick bulk out */
RTUSBKickBulkOut(pAd);
}
@ -731,7 +731,7 @@ PNDIS_PACKET GetPacketFromRxRing(IN PRTMP_ADAPTER pAd,
}
pData = &pRxContext->TransferBuffer[pAd->ReadPosition]; /* 4KB */
// The RXDMA field is 4 bytes, now just use the first 2 bytes. The Length including the (RXWI + MSDU + Padding)
/* The RXDMA field is 4 bytes, now just use the first 2 bytes. The Length including the (RXWI + MSDU + Padding) */
ThisFrameLen = *pData + (*(pData + 1) << 8);
if (ThisFrameLen == 0) {
DBGPRINT(RT_DEBUG_TRACE,
@ -748,7 +748,7 @@ PNDIS_PACKET GetPacketFromRxRing(IN PRTMP_ADAPTER pAd,
goto label_null;
}
if ((ThisFrameLen + 8) > RxBufferLength) // 8 for (RT2870_RXDMALEN_FIELD_SIZE + sizeof(RXINFO_STRUC))
if ((ThisFrameLen + 8) > RxBufferLength) /* 8 for (RT2870_RXDMALEN_FIELD_SIZE + sizeof(RXINFO_STRUC)) */
{
DBGPRINT(RT_DEBUG_TRACE,
("BIRIdx(%d):FrameLen(0x%lx) outranges. BulkInLen=0x%lx, remaining RxBufLen=0x%lx, ReadPos=0x%lx\n",
@ -756,10 +756,10 @@ PNDIS_PACKET GetPacketFromRxRing(IN PRTMP_ADAPTER pAd,
pRxContext->BulkInOffset, RxBufferLength,
pAd->ReadPosition));
// error frame. finish this loop
/* error frame. finish this loop */
goto label_null;
}
// skip USB frame length field
/* skip USB frame length field */
pData += RT2870_RXDMALEN_FIELD_SIZE;
pRxWI = (PRXWI_STRUC) pData;
if (pRxWI->MPDUtotalByteCount > ThisFrameLen) {
@ -769,7 +769,7 @@ PNDIS_PACKET GetPacketFromRxRing(IN PRTMP_ADAPTER pAd,
ThisFrameLen));
goto label_null;
}
// allocate a rx packet
/* allocate a rx packet */
pSkb = dev_alloc_skb(ThisFrameLen);
if (pSkb == NULL) {
DBGPRINT(RT_DEBUG_ERROR,
@ -777,16 +777,16 @@ PNDIS_PACKET GetPacketFromRxRing(IN PRTMP_ADAPTER pAd,
__FUNCTION__));
goto label_null;
}
// copy the rx packet
/* copy the rx packet */
memcpy(skb_put(pSkb, ThisFrameLen), pData, ThisFrameLen);
RTPKT_TO_OSPKT(pSkb)->dev = get_netdev_from_bssid(pAd, BSS0);
RTMP_SET_PACKET_SOURCE(OSPKT_TO_RTPKT(pSkb), PKTSRC_NDIS);
// copy RxD
/* copy RxD */
*pSaveRxD = *(PRXINFO_STRUC) (pData + ThisFrameLen);
// update next packet read position.
pAd->ReadPosition += (ThisFrameLen + RT2870_RXDMALEN_FIELD_SIZE + RXINFO_SIZE); // 8 for (RT2870_RXDMALEN_FIELD_SIZE + sizeof(RXINFO_STRUC))
/* update next packet read position. */
pAd->ReadPosition += (ThisFrameLen + RT2870_RXDMALEN_FIELD_SIZE + RXINFO_SIZE); /* 8 for (RT2870_RXDMALEN_FIELD_SIZE + sizeof(RXINFO_STRUC)) */
return pSkb;
@ -824,9 +824,9 @@ NDIS_STATUS RTMPCheckRxError(IN PRTMP_ADAPTER pAd,
if (pRxINFO == NULL)
return (NDIS_STATUS_FAILURE);
// Phy errors & CRC errors
/* Phy errors & CRC errors */
if (pRxINFO->Crc) {
// Check RSSI for Noise Hist statistic collection.
/* Check RSSI for Noise Hist statistic collection. */
dBm = (INT) (pRxWI->RSSI0) - pAd->BbpRssiToDbmDelta;
if (dBm <= -87)
pAd->StaCfg.RPIDensity[0] += 1;
@ -847,25 +847,25 @@ NDIS_STATUS RTMPCheckRxError(IN PRTMP_ADAPTER pAd,
return (NDIS_STATUS_FAILURE);
}
// Add Rx size to channel load counter, we should ignore error counts
/* Add Rx size to channel load counter, we should ignore error counts */
pAd->StaCfg.CLBusyBytes += (pRxWI->MPDUtotalByteCount + 14);
// Drop ToDs promiscous frame, it is opened due to CCX 2 channel load statistics
/* Drop ToDs promiscous frame, it is opened due to CCX 2 channel load statistics */
if (pHeader->FC.ToDs) {
DBGPRINT_RAW(RT_DEBUG_ERROR, ("Err;FC.ToDs\n"));
return NDIS_STATUS_FAILURE;
}
// Paul 04-03 for OFDM Rx length issue
/* Paul 04-03 for OFDM Rx length issue */
if (pRxWI->MPDUtotalByteCount > MAX_AGGREGATION_SIZE) {
DBGPRINT_RAW(RT_DEBUG_ERROR, ("received packet too long\n"));
return NDIS_STATUS_FAILURE;
}
// Drop not U2M frames, cant's drop here because we will drop beacon in this case
// I am kind of doubting the U2M bit operation
// if (pRxD->U2M == 0)
// return(NDIS_STATUS_FAILURE);
/* Drop not U2M frames, cant's drop here because we will drop beacon in this case */
/* I am kind of doubting the U2M bit operation */
/* if (pRxD->U2M == 0) */
/* return(NDIS_STATUS_FAILURE); */
// drop decyption fail frame
/* drop decyption fail frame */
if (pRxINFO->Decrypted && pRxINFO->CipherErr) {
if (((pRxINFO->CipherErr & 1) == 1)
@ -879,9 +879,9 @@ NDIS_STATUS RTMPCheckRxError(IN PRTMP_ADAPTER pAd,
RTMPSendWirelessEvent(pAd, IW_MIC_ERROR_EVENT_FLAG,
pAd->MacTab.Content[BSSID_WCID].
Addr, BSS0, 0);
//
// MIC Error
//
/* */
/* MIC Error */
/* */
if ((pRxINFO->CipherErr == 2) && pRxINFO->MyBss) {
pWpaKey = &pAd->SharedKey[BSS0][pRxWI->KeyIndex];
RTMPReportMicError(pAd, pWpaKey);
@ -892,9 +892,9 @@ NDIS_STATUS RTMPCheckRxError(IN PRTMP_ADAPTER pAd,
(pAd->SharedKey[BSS0][pRxWI->KeyIndex].CipherAlg ==
CIPHER_AES)
&& (pHeader->Sequence == pAd->FragFrame.Sequence)) {
//
// Acceptable since the First FragFrame no CipherErr problem.
//
/* */
/* Acceptable since the First FragFrame no CipherErr problem. */
/* */
return (NDIS_STATUS_SUCCESS);
}
@ -935,17 +935,17 @@ VOID RT28xxUsbStaAsicSleepThenAutoWakeup(IN PRTMP_ADAPTER pAd,
IN USHORT TbttNumToNextWakeUp)
{
// we have decided to SLEEP, so at least do it for a BEACON period.
/* we have decided to SLEEP, so at least do it for a BEACON period. */
if (TbttNumToNextWakeUp == 0)
TbttNumToNextWakeUp = 1;
RTMPSetTimer(&pAd->Mlme.AutoWakeupTimer, AUTO_WAKEUP_TIMEOUT);
pAd->Mlme.AutoWakeupTimerRunning = TRUE;
AsicSendCommandToMcu(pAd, 0x30, 0xff, 0xff, 0x02); // send POWER-SAVE command to MCU. Timeout 40us.
AsicSendCommandToMcu(pAd, 0x30, 0xff, 0xff, 0x02); /* send POWER-SAVE command to MCU. Timeout 40us. */
OPSTATUS_SET_FLAG(pAd, fOP_STATUS_DOZE);
}
#endif // RTMP_MAC_USB //
#endif /* RTMP_MAC_USB // */

View file

@ -53,144 +53,144 @@ VOID RTMPSetDesiredRates(IN PRTMP_ADAPTER pAdapter, IN LONG Rates)
memset(&aryRates, 0x00, sizeof(NDIS_802_11_RATES));
switch (pAdapter->CommonCfg.PhyMode) {
case PHY_11A: // A only
case PHY_11A: /* A only */
switch (Rates) {
case 6000000: //6M
aryRates[0] = 0x0c; // 6M
case 6000000: /*6M */
aryRates[0] = 0x0c; /* 6M */
pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
MCS_0;
break;
case 9000000: //9M
aryRates[0] = 0x12; // 9M
case 9000000: /*9M */
aryRates[0] = 0x12; /* 9M */
pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
MCS_1;
break;
case 12000000: //12M
aryRates[0] = 0x18; // 12M
case 12000000: /*12M */
aryRates[0] = 0x18; /* 12M */
pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
MCS_2;
break;
case 18000000: //18M
aryRates[0] = 0x24; // 18M
case 18000000: /*18M */
aryRates[0] = 0x24; /* 18M */
pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
MCS_3;
break;
case 24000000: //24M
aryRates[0] = 0x30; // 24M
case 24000000: /*24M */
aryRates[0] = 0x30; /* 24M */
pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
MCS_4;
break;
case 36000000: //36M
aryRates[0] = 0x48; // 36M
case 36000000: /*36M */
aryRates[0] = 0x48; /* 36M */
pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
MCS_5;
break;
case 48000000: //48M
aryRates[0] = 0x60; // 48M
case 48000000: /*48M */
aryRates[0] = 0x60; /* 48M */
pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
MCS_6;
break;
case 54000000: //54M
aryRates[0] = 0x6c; // 54M
case 54000000: /*54M */
aryRates[0] = 0x6c; /* 54M */
pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
MCS_7;
break;
case -1: //Auto
case -1: /*Auto */
default:
aryRates[0] = 0x6c; // 54Mbps
aryRates[1] = 0x60; // 48Mbps
aryRates[2] = 0x48; // 36Mbps
aryRates[3] = 0x30; // 24Mbps
aryRates[4] = 0x24; // 18M
aryRates[5] = 0x18; // 12M
aryRates[6] = 0x12; // 9M
aryRates[7] = 0x0c; // 6M
aryRates[0] = 0x6c; /* 54Mbps */
aryRates[1] = 0x60; /* 48Mbps */
aryRates[2] = 0x48; /* 36Mbps */
aryRates[3] = 0x30; /* 24Mbps */
aryRates[4] = 0x24; /* 18M */
aryRates[5] = 0x18; /* 12M */
aryRates[6] = 0x12; /* 9M */
aryRates[7] = 0x0c; /* 6M */
pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
MCS_AUTO;
break;
}
break;
case PHY_11BG_MIXED: // B/G Mixed
case PHY_11B: // B only
case PHY_11ABG_MIXED: // A/B/G Mixed
case PHY_11BG_MIXED: /* B/G Mixed */
case PHY_11B: /* B only */
case PHY_11ABG_MIXED: /* A/B/G Mixed */
default:
switch (Rates) {
case 1000000: //1M
case 1000000: /*1M */
aryRates[0] = 0x02;
pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
MCS_0;
break;
case 2000000: //2M
case 2000000: /*2M */
aryRates[0] = 0x04;
pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
MCS_1;
break;
case 5000000: //5.5M
aryRates[0] = 0x0b; // 5.5M
case 5000000: /*5.5M */
aryRates[0] = 0x0b; /* 5.5M */
pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
MCS_2;
break;
case 11000000: //11M
aryRates[0] = 0x16; // 11M
case 11000000: /*11M */
aryRates[0] = 0x16; /* 11M */
pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
MCS_3;
break;
case 6000000: //6M
aryRates[0] = 0x0c; // 6M
case 6000000: /*6M */
aryRates[0] = 0x0c; /* 6M */
pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
MCS_0;
break;
case 9000000: //9M
aryRates[0] = 0x12; // 9M
case 9000000: /*9M */
aryRates[0] = 0x12; /* 9M */
pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
MCS_1;
break;
case 12000000: //12M
aryRates[0] = 0x18; // 12M
case 12000000: /*12M */
aryRates[0] = 0x18; /* 12M */
pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
MCS_2;
break;
case 18000000: //18M
aryRates[0] = 0x24; // 18M
case 18000000: /*18M */
aryRates[0] = 0x24; /* 18M */
pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
MCS_3;
break;
case 24000000: //24M
aryRates[0] = 0x30; // 24M
case 24000000: /*24M */
aryRates[0] = 0x30; /* 24M */
pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
MCS_4;
break;
case 36000000: //36M
aryRates[0] = 0x48; // 36M
case 36000000: /*36M */
aryRates[0] = 0x48; /* 36M */
pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
MCS_5;
break;
case 48000000: //48M
aryRates[0] = 0x60; // 48M
case 48000000: /*48M */
aryRates[0] = 0x60; /* 48M */
pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
MCS_6;
break;
case 54000000: //54M
aryRates[0] = 0x6c; // 54M
case 54000000: /*54M */
aryRates[0] = 0x6c; /* 54M */
pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
MCS_7;
break;
case -1: //Auto
case -1: /*Auto */
default:
if (pAdapter->CommonCfg.PhyMode == PHY_11B) { //B Only
aryRates[0] = 0x16; // 11Mbps
aryRates[1] = 0x0b; // 5.5Mbps
aryRates[2] = 0x04; // 2Mbps
aryRates[3] = 0x02; // 1Mbps
} else { //(B/G) Mixed or (A/B/G) Mixed
aryRates[0] = 0x6c; // 54Mbps
aryRates[1] = 0x60; // 48Mbps
aryRates[2] = 0x48; // 36Mbps
aryRates[3] = 0x30; // 24Mbps
aryRates[4] = 0x16; // 11Mbps
aryRates[5] = 0x0b; // 5.5Mbps
aryRates[6] = 0x04; // 2Mbps
aryRates[7] = 0x02; // 1Mbps
if (pAdapter->CommonCfg.PhyMode == PHY_11B) { /*B Only */
aryRates[0] = 0x16; /* 11Mbps */
aryRates[1] = 0x0b; /* 5.5Mbps */
aryRates[2] = 0x04; /* 2Mbps */
aryRates[3] = 0x02; /* 1Mbps */
} else { /*(B/G) Mixed or (A/B/G) Mixed */
aryRates[0] = 0x6c; /* 54Mbps */
aryRates[1] = 0x60; /* 48Mbps */
aryRates[2] = 0x48; /* 36Mbps */
aryRates[3] = 0x30; /* 24Mbps */
aryRates[4] = 0x16; /* 11Mbps */
aryRates[5] = 0x0b; /* 5.5Mbps */
aryRates[6] = 0x04; /* 2Mbps */
aryRates[7] = 0x02; /* 1Mbps */
}
pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
MCS_AUTO;
@ -213,7 +213,7 @@ VOID RTMPSetDesiredRates(IN PRTMP_ADAPTER pAdapter, IN LONG Rates)
pAdapter->CommonCfg.DesireRate[5],
pAdapter->CommonCfg.DesireRate[6],
pAdapter->CommonCfg.DesireRate[7]));
// Changing DesiredRate may affect the MAX TX rate we used to TX frames out
/* Changing DesiredRate may affect the MAX TX rate we used to TX frames out */
MlmeUpdateTxRates(pAdapter, FALSE, 0);
}
@ -244,20 +244,20 @@ VOID RTMPWPARemoveAllKeys(IN PRTMP_ADAPTER pAd)
("RTMPWPARemoveAllKeys(AuthMode=%d, WepStatus=%d)\n",
pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus));
RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP);
// For WEP/CKIP, there is no need to remove it, since WinXP won't set it again after
// Link up. And it will be replaced if user changed it.
/* For WEP/CKIP, there is no need to remove it, since WinXP won't set it again after */
/* Link up. And it will be replaced if user changed it. */
if (pAd->StaCfg.AuthMode < Ndis802_11AuthModeWPA)
return;
// For WPA-None, there is no need to remove it, since WinXP won't set it again after
// Link up. And it will be replaced if user changed it.
/* For WPA-None, there is no need to remove it, since WinXP won't set it again after */
/* Link up. And it will be replaced if user changed it. */
if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone)
return;
// set BSSID wcid entry of the Pair-wise Key table as no-security mode
/* set BSSID wcid entry of the Pair-wise Key table as no-security mode */
AsicRemovePairwiseKeyEntry(pAd, BSS0, BSSID_WCID);
// set all shared key mode as no-security.
/* set all shared key mode as no-security. */
for (i = 0; i < SHARE_KEY_NUM; i++) {
DBGPRINT(RT_DEBUG_TRACE,
("remove %s key #%d\n",
@ -310,9 +310,9 @@ VOID RTMPWPARemoveAllKeys(IN PRTMP_ADAPTER pAd)
VOID RTMPSetPhyMode(IN PRTMP_ADAPTER pAd, IN ULONG phymode)
{
INT i;
// the selected phymode must be supported by the RF IC encoded in E2PROM
/* the selected phymode must be supported by the RF IC encoded in E2PROM */
// if no change, do nothing
/* if no change, do nothing */
/* bug fix
if (pAd->CommonCfg.PhyMode == phymode)
return;
@ -325,7 +325,7 @@ VOID RTMPSetPhyMode(IN PRTMP_ADAPTER pAd, IN ULONG phymode)
BuildChannelList(pAd);
// sanity check user setting
/* sanity check user setting */
for (i = 0; i < pAd->ChannelListNum; i++) {
if (pAd->CommonCfg.Channel == pAd->ChannelList[i].Channel)
break;
@ -343,17 +343,17 @@ VOID RTMPSetPhyMode(IN PRTMP_ADAPTER pAd, IN ULONG phymode)
NdisZeroMemory(pAd->CommonCfg.DesireRate, MAX_LEN_OF_SUPPORTED_RATES);
switch (phymode) {
case PHY_11B:
pAd->CommonCfg.SupRate[0] = 0x82; // 1 mbps, in units of 0.5 Mbps, basic rate
pAd->CommonCfg.SupRate[1] = 0x84; // 2 mbps, in units of 0.5 Mbps, basic rate
pAd->CommonCfg.SupRate[2] = 0x8B; // 5.5 mbps, in units of 0.5 Mbps, basic rate
pAd->CommonCfg.SupRate[3] = 0x96; // 11 mbps, in units of 0.5 Mbps, basic rate
pAd->CommonCfg.SupRate[0] = 0x82; /* 1 mbps, in units of 0.5 Mbps, basic rate */
pAd->CommonCfg.SupRate[1] = 0x84; /* 2 mbps, in units of 0.5 Mbps, basic rate */
pAd->CommonCfg.SupRate[2] = 0x8B; /* 5.5 mbps, in units of 0.5 Mbps, basic rate */
pAd->CommonCfg.SupRate[3] = 0x96; /* 11 mbps, in units of 0.5 Mbps, basic rate */
pAd->CommonCfg.SupRateLen = 4;
pAd->CommonCfg.ExtRateLen = 0;
pAd->CommonCfg.DesireRate[0] = 2; // 1 mbps, in units of 0.5 Mbps
pAd->CommonCfg.DesireRate[1] = 4; // 2 mbps, in units of 0.5 Mbps
pAd->CommonCfg.DesireRate[2] = 11; // 5.5 mbps, in units of 0.5 Mbps
pAd->CommonCfg.DesireRate[3] = 22; // 11 mbps, in units of 0.5 Mbps
//pAd->CommonCfg.HTPhyMode.field.MODE = MODE_CCK; // This MODE is only FYI. not use
pAd->CommonCfg.DesireRate[0] = 2; /* 1 mbps, in units of 0.5 Mbps */
pAd->CommonCfg.DesireRate[1] = 4; /* 2 mbps, in units of 0.5 Mbps */
pAd->CommonCfg.DesireRate[2] = 11; /* 5.5 mbps, in units of 0.5 Mbps */
pAd->CommonCfg.DesireRate[3] = 22; /* 11 mbps, in units of 0.5 Mbps */
/*pAd->CommonCfg.HTPhyMode.field.MODE = MODE_CCK; // This MODE is only FYI. not use */
break;
case PHY_11G:
@ -363,57 +363,57 @@ VOID RTMPSetPhyMode(IN PRTMP_ADAPTER pAd, IN ULONG phymode)
case PHY_11ABGN_MIXED:
case PHY_11BGN_MIXED:
case PHY_11GN_MIXED:
pAd->CommonCfg.SupRate[0] = 0x82; // 1 mbps, in units of 0.5 Mbps, basic rate
pAd->CommonCfg.SupRate[1] = 0x84; // 2 mbps, in units of 0.5 Mbps, basic rate
pAd->CommonCfg.SupRate[2] = 0x8B; // 5.5 mbps, in units of 0.5 Mbps, basic rate
pAd->CommonCfg.SupRate[3] = 0x96; // 11 mbps, in units of 0.5 Mbps, basic rate
pAd->CommonCfg.SupRate[4] = 0x12; // 9 mbps, in units of 0.5 Mbps
pAd->CommonCfg.SupRate[5] = 0x24; // 18 mbps, in units of 0.5 Mbps
pAd->CommonCfg.SupRate[6] = 0x48; // 36 mbps, in units of 0.5 Mbps
pAd->CommonCfg.SupRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps
pAd->CommonCfg.SupRate[0] = 0x82; /* 1 mbps, in units of 0.5 Mbps, basic rate */
pAd->CommonCfg.SupRate[1] = 0x84; /* 2 mbps, in units of 0.5 Mbps, basic rate */
pAd->CommonCfg.SupRate[2] = 0x8B; /* 5.5 mbps, in units of 0.5 Mbps, basic rate */
pAd->CommonCfg.SupRate[3] = 0x96; /* 11 mbps, in units of 0.5 Mbps, basic rate */
pAd->CommonCfg.SupRate[4] = 0x12; /* 9 mbps, in units of 0.5 Mbps */
pAd->CommonCfg.SupRate[5] = 0x24; /* 18 mbps, in units of 0.5 Mbps */
pAd->CommonCfg.SupRate[6] = 0x48; /* 36 mbps, in units of 0.5 Mbps */
pAd->CommonCfg.SupRate[7] = 0x6c; /* 54 mbps, in units of 0.5 Mbps */
pAd->CommonCfg.SupRateLen = 8;
pAd->CommonCfg.ExtRate[0] = 0x0C; // 6 mbps, in units of 0.5 Mbps
pAd->CommonCfg.ExtRate[1] = 0x18; // 12 mbps, in units of 0.5 Mbps
pAd->CommonCfg.ExtRate[2] = 0x30; // 24 mbps, in units of 0.5 Mbps
pAd->CommonCfg.ExtRate[3] = 0x60; // 48 mbps, in units of 0.5 Mbps
pAd->CommonCfg.ExtRate[0] = 0x0C; /* 6 mbps, in units of 0.5 Mbps */
pAd->CommonCfg.ExtRate[1] = 0x18; /* 12 mbps, in units of 0.5 Mbps */
pAd->CommonCfg.ExtRate[2] = 0x30; /* 24 mbps, in units of 0.5 Mbps */
pAd->CommonCfg.ExtRate[3] = 0x60; /* 48 mbps, in units of 0.5 Mbps */
pAd->CommonCfg.ExtRateLen = 4;
pAd->CommonCfg.DesireRate[0] = 2; // 1 mbps, in units of 0.5 Mbps
pAd->CommonCfg.DesireRate[1] = 4; // 2 mbps, in units of 0.5 Mbps
pAd->CommonCfg.DesireRate[2] = 11; // 5.5 mbps, in units of 0.5 Mbps
pAd->CommonCfg.DesireRate[3] = 22; // 11 mbps, in units of 0.5 Mbps
pAd->CommonCfg.DesireRate[4] = 12; // 6 mbps, in units of 0.5 Mbps
pAd->CommonCfg.DesireRate[5] = 18; // 9 mbps, in units of 0.5 Mbps
pAd->CommonCfg.DesireRate[6] = 24; // 12 mbps, in units of 0.5 Mbps
pAd->CommonCfg.DesireRate[7] = 36; // 18 mbps, in units of 0.5 Mbps
pAd->CommonCfg.DesireRate[8] = 48; // 24 mbps, in units of 0.5 Mbps
pAd->CommonCfg.DesireRate[9] = 72; // 36 mbps, in units of 0.5 Mbps
pAd->CommonCfg.DesireRate[10] = 96; // 48 mbps, in units of 0.5 Mbps
pAd->CommonCfg.DesireRate[11] = 108; // 54 mbps, in units of 0.5 Mbps
pAd->CommonCfg.DesireRate[0] = 2; /* 1 mbps, in units of 0.5 Mbps */
pAd->CommonCfg.DesireRate[1] = 4; /* 2 mbps, in units of 0.5 Mbps */
pAd->CommonCfg.DesireRate[2] = 11; /* 5.5 mbps, in units of 0.5 Mbps */
pAd->CommonCfg.DesireRate[3] = 22; /* 11 mbps, in units of 0.5 Mbps */
pAd->CommonCfg.DesireRate[4] = 12; /* 6 mbps, in units of 0.5 Mbps */
pAd->CommonCfg.DesireRate[5] = 18; /* 9 mbps, in units of 0.5 Mbps */
pAd->CommonCfg.DesireRate[6] = 24; /* 12 mbps, in units of 0.5 Mbps */
pAd->CommonCfg.DesireRate[7] = 36; /* 18 mbps, in units of 0.5 Mbps */
pAd->CommonCfg.DesireRate[8] = 48; /* 24 mbps, in units of 0.5 Mbps */
pAd->CommonCfg.DesireRate[9] = 72; /* 36 mbps, in units of 0.5 Mbps */
pAd->CommonCfg.DesireRate[10] = 96; /* 48 mbps, in units of 0.5 Mbps */
pAd->CommonCfg.DesireRate[11] = 108; /* 54 mbps, in units of 0.5 Mbps */
break;
case PHY_11A:
case PHY_11AN_MIXED:
case PHY_11AGN_MIXED:
case PHY_11N_5G:
pAd->CommonCfg.SupRate[0] = 0x8C; // 6 mbps, in units of 0.5 Mbps, basic rate
pAd->CommonCfg.SupRate[1] = 0x12; // 9 mbps, in units of 0.5 Mbps
pAd->CommonCfg.SupRate[2] = 0x98; // 12 mbps, in units of 0.5 Mbps, basic rate
pAd->CommonCfg.SupRate[3] = 0x24; // 18 mbps, in units of 0.5 Mbps
pAd->CommonCfg.SupRate[4] = 0xb0; // 24 mbps, in units of 0.5 Mbps, basic rate
pAd->CommonCfg.SupRate[5] = 0x48; // 36 mbps, in units of 0.5 Mbps
pAd->CommonCfg.SupRate[6] = 0x60; // 48 mbps, in units of 0.5 Mbps
pAd->CommonCfg.SupRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps
pAd->CommonCfg.SupRate[0] = 0x8C; /* 6 mbps, in units of 0.5 Mbps, basic rate */
pAd->CommonCfg.SupRate[1] = 0x12; /* 9 mbps, in units of 0.5 Mbps */
pAd->CommonCfg.SupRate[2] = 0x98; /* 12 mbps, in units of 0.5 Mbps, basic rate */
pAd->CommonCfg.SupRate[3] = 0x24; /* 18 mbps, in units of 0.5 Mbps */
pAd->CommonCfg.SupRate[4] = 0xb0; /* 24 mbps, in units of 0.5 Mbps, basic rate */
pAd->CommonCfg.SupRate[5] = 0x48; /* 36 mbps, in units of 0.5 Mbps */
pAd->CommonCfg.SupRate[6] = 0x60; /* 48 mbps, in units of 0.5 Mbps */
pAd->CommonCfg.SupRate[7] = 0x6c; /* 54 mbps, in units of 0.5 Mbps */
pAd->CommonCfg.SupRateLen = 8;
pAd->CommonCfg.ExtRateLen = 0;
pAd->CommonCfg.DesireRate[0] = 12; // 6 mbps, in units of 0.5 Mbps
pAd->CommonCfg.DesireRate[1] = 18; // 9 mbps, in units of 0.5 Mbps
pAd->CommonCfg.DesireRate[2] = 24; // 12 mbps, in units of 0.5 Mbps
pAd->CommonCfg.DesireRate[3] = 36; // 18 mbps, in units of 0.5 Mbps
pAd->CommonCfg.DesireRate[4] = 48; // 24 mbps, in units of 0.5 Mbps
pAd->CommonCfg.DesireRate[5] = 72; // 36 mbps, in units of 0.5 Mbps
pAd->CommonCfg.DesireRate[6] = 96; // 48 mbps, in units of 0.5 Mbps
pAd->CommonCfg.DesireRate[7] = 108; // 54 mbps, in units of 0.5 Mbps
//pAd->CommonCfg.HTPhyMode.field.MODE = MODE_OFDM; // This MODE is only FYI. not use
pAd->CommonCfg.DesireRate[0] = 12; /* 6 mbps, in units of 0.5 Mbps */
pAd->CommonCfg.DesireRate[1] = 18; /* 9 mbps, in units of 0.5 Mbps */
pAd->CommonCfg.DesireRate[2] = 24; /* 12 mbps, in units of 0.5 Mbps */
pAd->CommonCfg.DesireRate[3] = 36; /* 18 mbps, in units of 0.5 Mbps */
pAd->CommonCfg.DesireRate[4] = 48; /* 24 mbps, in units of 0.5 Mbps */
pAd->CommonCfg.DesireRate[5] = 72; /* 36 mbps, in units of 0.5 Mbps */
pAd->CommonCfg.DesireRate[6] = 96; /* 48 mbps, in units of 0.5 Mbps */
pAd->CommonCfg.DesireRate[7] = 108; /* 54 mbps, in units of 0.5 Mbps */
/*pAd->CommonCfg.HTPhyMode.field.MODE = MODE_OFDM; // This MODE is only FYI. not use */
break;
default:
@ -437,7 +437,7 @@ VOID RTMPSetPhyMode(IN PRTMP_ADAPTER pAd, IN ULONG phymode)
*/
VOID RTMPSetHT(IN PRTMP_ADAPTER pAd, IN OID_SET_HT_PHYMODE * pHTPhyMode)
{
//ULONG *pmcs;
/*ULONG *pmcs; */
UINT32 Value = 0;
UCHAR BBPValue = 0;
UCHAR BBP3Value = 0;
@ -448,7 +448,7 @@ VOID RTMPSetHT(IN PRTMP_ADAPTER pAd, IN OID_SET_HT_PHYMODE * pHTPhyMode)
pHTPhyMode->HtMode, pHTPhyMode->ExtOffset, pHTPhyMode->MCS,
pHTPhyMode->BW, pHTPhyMode->STBC, pHTPhyMode->SHORTGI));
// Don't zero supportedHyPhy structure.
/* Don't zero supportedHyPhy structure. */
RTMPZeroMemory(&pAd->CommonCfg.HtCapability,
sizeof(pAd->CommonCfg.HtCapability));
RTMPZeroMemory(&pAd->CommonCfg.AddHTInfo,
@ -473,7 +473,7 @@ VOID RTMPSetHT(IN PRTMP_ADAPTER pAd, IN OID_SET_HT_PHYMODE * pHTPhyMode)
("RTMPSetHT : RxBAWinLimit = %d\n",
pAd->CommonCfg.BACapability.field.RxBAWinLimit));
// Mimo power save, A-MSDU size,
/* Mimo power save, A-MSDU size, */
pAd->CommonCfg.DesiredHtPhy.AmsduEnable =
(USHORT) pAd->CommonCfg.BACapability.field.AmsduEnable;
pAd->CommonCfg.DesiredHtPhy.AmsduSize =
@ -503,7 +503,7 @@ VOID RTMPSetHT(IN PRTMP_ADAPTER pAd, IN OID_SET_HT_PHYMODE * pHTPhyMode)
} else
pAd->CommonCfg.DesiredHtPhy.GF = 0;
// Decide Rx MCSSet
/* Decide Rx MCSSet */
switch (RxStream) {
case 1:
pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff;
@ -515,7 +515,7 @@ VOID RTMPSetHT(IN PRTMP_ADAPTER pAd, IN OID_SET_HT_PHYMODE * pHTPhyMode)
pAd->CommonCfg.HtCapability.MCSSet[1] = 0xff;
break;
case 3: // 3*3
case 3: /* 3*3 */
pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff;
pAd->CommonCfg.HtCapability.MCSSet[1] = 0xff;
pAd->CommonCfg.HtCapability.MCSSet[2] = 0xff;
@ -529,7 +529,7 @@ VOID RTMPSetHT(IN PRTMP_ADAPTER pAd, IN OID_SET_HT_PHYMODE * pHTPhyMode)
}
if (pHTPhyMode->BW == BW_40) {
pAd->CommonCfg.HtCapability.MCSSet[4] = 0x1; // MCS 32
pAd->CommonCfg.HtCapability.MCSSet[4] = 0x1; /* MCS 32 */
pAd->CommonCfg.HtCapability.HtCapInfo.ChannelWidth = 1;
if (pAd->CommonCfg.Channel <= 14)
pAd->CommonCfg.HtCapability.HtCapInfo.CCKmodein40 = 1;
@ -539,7 +539,7 @@ VOID RTMPSetHT(IN PRTMP_ADAPTER pAd, IN OID_SET_HT_PHYMODE * pHTPhyMode)
pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset =
(pHTPhyMode->ExtOffset ==
EXTCHA_BELOW) ? (EXTCHA_BELOW) : EXTCHA_ABOVE;
// Set Regsiter for extension channel position.
/* Set Regsiter for extension channel position. */
RTMP_IO_READ32(pAd, TX_BAND_CFG, &Value);
RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &BBP3Value);
if ((pHTPhyMode->ExtOffset == EXTCHA_BELOW)) {
@ -551,8 +551,8 @@ VOID RTMPSetHT(IN PRTMP_ADAPTER pAd, IN OID_SET_HT_PHYMODE * pHTPhyMode)
BBP3Value &= (~0x20);
RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Value);
}
// Turn on BBP 40MHz mode now only as AP .
// Sta can turn on BBP 40MHz after connection with 40MHz AP. Sta only broadcast 40MHz capability before connection.
/* Turn on BBP 40MHz mode now only as AP . */
/* Sta can turn on BBP 40MHz after connection with 40MHz AP. Sta only broadcast 40MHz capability before connection. */
if ((pAd->OpMode == OPMODE_AP) || INFRA_ON(pAd) || ADHOC_ON(pAd)
) {
RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue);
@ -569,7 +569,7 @@ VOID RTMPSetHT(IN PRTMP_ADAPTER pAd, IN OID_SET_HT_PHYMODE * pHTPhyMode)
pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth = 0;
pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset = EXTCHA_NONE;
pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel;
// Turn on BBP 20MHz mode by request here.
/* Turn on BBP 20MHz mode by request here. */
{
RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue);
BBPValue &= (~0x18);
@ -600,12 +600,12 @@ VOID RTMPSetHT(IN PRTMP_ADAPTER pAd, IN OID_SET_HT_PHYMODE * pHTPhyMode)
pAd->CommonCfg.DesiredHtPhy.ShortGIfor40 = 0;
}
// We support link adaptation for unsolicit MCS feedback, set to 2.
pAd->CommonCfg.HtCapability.ExtHtCapInfo.MCSFeedback = MCSFBK_NONE; //MCSFBK_UNSOLICIT;
/* We support link adaptation for unsolicit MCS feedback, set to 2. */
pAd->CommonCfg.HtCapability.ExtHtCapInfo.MCSFeedback = MCSFBK_NONE; /*MCSFBK_UNSOLICIT; */
pAd->CommonCfg.AddHTInfo.ControlChan = pAd->CommonCfg.Channel;
// 1, the extension channel above the control channel.
/* 1, the extension channel above the control channel. */
// EDCA parameters used for AP's own transmission
/* EDCA parameters used for AP's own transmission */
if (pAd->CommonCfg.APEdcaParm.bValid == FALSE) {
pAd->CommonCfg.APEdcaParm.bValid = TRUE;
pAd->CommonCfg.APEdcaParm.Aifsn[0] = 3;
@ -659,7 +659,7 @@ VOID RTMPSetIndividualHT(IN PRTMP_ADAPTER pAd, IN UCHAR apidx)
pDesired_ht_phy = &pAd->StaCfg.DesiredHtPhyInfo;
DesiredMcs =
pAd->StaCfg.DesiredTransmitSetting.field.MCS;
//pAd->StaCfg.bAutoTxRateSwitch = (DesiredMcs == MCS_AUTO) ? TRUE : FALSE;
/*pAd->StaCfg.bAutoTxRateSwitch = (DesiredMcs == MCS_AUTO) ? TRUE : FALSE; */
break;
}
} while (FALSE);
@ -673,7 +673,7 @@ VOID RTMPSetIndividualHT(IN PRTMP_ADAPTER pAd, IN UCHAR apidx)
DBGPRINT(RT_DEBUG_TRACE,
("RTMPSetIndividualHT : Desired MCS = %d\n", DesiredMcs));
// Check the validity of MCS
/* Check the validity of MCS */
if ((TxStream == 1)
&& ((DesiredMcs >= MCS_8) && (DesiredMcs <= MCS_15))) {
DBGPRINT(RT_DEBUG_WARN,
@ -691,7 +691,7 @@ VOID RTMPSetIndividualHT(IN PRTMP_ADAPTER pAd, IN UCHAR apidx)
pDesired_ht_phy->bHtEnable = TRUE;
// Decide desired Tx MCS
/* Decide desired Tx MCS */
switch (TxStream) {
case 1:
if (DesiredMcs == MCS_AUTO) {
@ -717,7 +717,7 @@ VOID RTMPSetIndividualHT(IN PRTMP_ADAPTER pAd, IN UCHAR apidx)
}
break;
case 3: // 3*3
case 3: /* 3*3 */
if (DesiredMcs == MCS_AUTO) {
/* MCS0 ~ MCS23, 3 bytes */
pDesired_ht_phy->MCSSet[0] = 0xff;
@ -738,7 +738,7 @@ VOID RTMPSetIndividualHT(IN PRTMP_ADAPTER pAd, IN UCHAR apidx)
if (DesiredMcs == MCS_AUTO || DesiredMcs == MCS_32)
pDesired_ht_phy->MCSSet[4] = 0x1;
}
// update HT Rate setting
/* update HT Rate setting */
if (pAd->OpMode == OPMODE_STA)
MlmeUpdateHtTxRates(pAd, BSS0);
else
@ -778,7 +778,7 @@ VOID RTMPUpdateHTIE(IN RT_HT_CAPABILITY * pRtHt,
pAddHtInfo->AddHtInfo.RecomWidth = pRtHt->RecomWidth;
pAddHtInfo->AddHtInfo2.OperaionMode = pRtHt->OperaionMode;
pAddHtInfo->AddHtInfo2.NonGfPresent = pRtHt->NonGfPresent;
RTMPMoveMemory(pAddHtInfo->MCSSet, /*pRtHt->MCSSet */ pMcsSet, 4); // rt2860 only support MCS max=32, no need to copy all 16 uchar.
RTMPMoveMemory(pAddHtInfo->MCSSet, /*pRtHt->MCSSet */ pMcsSet, 4); /* rt2860 only support MCS max=32, no need to copy all 16 uchar. */
DBGPRINT(RT_DEBUG_TRACE, ("RTMPUpdateHTIE <== \n"));
}
@ -808,9 +808,9 @@ VOID RTMPAddWcidAttributeEntry(IN PRTMP_ADAPTER pAd,
BssIdx));
return;
}
// 1. In ADHOC mode, the AID is wcid number. And NO mesh link exists.
// 2. In Infra mode, the AID:1 MUST be wcid of infra STA.
// the AID:2~ assign to mesh link entry.
/* 1. In ADHOC mode, the AID is wcid number. And NO mesh link exists. */
/* 2. In Infra mode, the AID:1 MUST be wcid of infra STA. */
/* the AID:2~ assign to mesh link entry. */
if (pEntry)
Wcid = pEntry->Aid;
else
@ -818,7 +818,7 @@ VOID RTMPAddWcidAttributeEntry(IN PRTMP_ADAPTER pAd,
}
}
// Update WCID attribute table
/* Update WCID attribute table */
offset = MAC_WCID_ATTRIBUTE_BASE + (Wcid * HW_WCID_ATTRI_SIZE);
{
@ -830,26 +830,26 @@ VOID RTMPAddWcidAttributeEntry(IN PRTMP_ADAPTER pAd,
RTMP_IO_WRITE32(pAd, offset, WCIDAttri);
// Update IV/EIV table
/* Update IV/EIV table */
offset = MAC_IVEIV_TABLE_BASE + (Wcid * HW_IVEIV_ENTRY_SIZE);
// WPA mode
/* WPA mode */
if ((CipherAlg == CIPHER_TKIP) || (CipherAlg == CIPHER_TKIP_NO_MIC)
|| (CipherAlg == CIPHER_AES)) {
// Eiv bit on. keyid always is 0 for pairwise key
/* Eiv bit on. keyid always is 0 for pairwise key */
IVEIV = (KeyIdx << 6) | 0x20;
} else {
// WEP KeyIdx is default tx key.
/* WEP KeyIdx is default tx key. */
IVEIV = (KeyIdx << 6);
}
// For key index and ext IV bit, so only need to update the position(offset+3).
/* For key index and ext IV bit, so only need to update the position(offset+3). */
#ifdef RTMP_MAC_PCI
RTMP_IO_WRITE8(pAd, offset + 3, IVEIV);
#endif // RTMP_MAC_PCI //
#endif /* RTMP_MAC_PCI // */
#ifdef RTMP_MAC_USB
RTUSBMultiWrite_OneByte(pAd, offset + 3, &IVEIV);
#endif // RTMP_MAC_USB //
#endif /* RTMP_MAC_USB // */
DBGPRINT(RT_DEBUG_TRACE,
("RTMPAddWcidAttributeEntry: WCID #%d, KeyIndex #%d, Alg=%s\n",

File diff suppressed because it is too large Load diff

View file

@ -57,22 +57,22 @@ NDIS_STATUS NICInitRecv(IN PRTMP_ADAPTER pAd)
DBGPRINT(RT_DEBUG_TRACE, ("--> NICInitRecv\n"));
pObj = pObj;
//InterlockedExchange(&pAd->PendingRx, 0);
/*InterlockedExchange(&pAd->PendingRx, 0); */
pAd->PendingRx = 0;
pAd->NextRxBulkInReadIndex = 0; // Next Rx Read index
pAd->NextRxBulkInIndex = 0; //RX_RING_SIZE -1; // Rx Bulk pointer
pAd->NextRxBulkInReadIndex = 0; /* Next Rx Read index */
pAd->NextRxBulkInIndex = 0; /*RX_RING_SIZE -1; // Rx Bulk pointer */
pAd->NextRxBulkInPosition = 0;
for (i = 0; i < (RX_RING_SIZE); i++) {
PRX_CONTEXT pRxContext = &(pAd->RxContext[i]);
//Allocate URB
/*Allocate URB */
pRxContext->pUrb = RTUSB_ALLOC_URB(0);
if (pRxContext->pUrb == NULL) {
Status = NDIS_STATUS_RESOURCES;
goto out1;
}
// Allocate transfer buffer
/* Allocate transfer buffer */
pRxContext->TransferBuffer =
RTUSB_URB_ALLOC_BUFFER(pObj->pUsb_Dev, MAX_RXBULK_SIZE,
&pRxContext->data_dma);
@ -88,7 +88,7 @@ NDIS_STATUS NICInitRecv(IN PRTMP_ADAPTER pAd)
pRxContext->InUse = FALSE;
pRxContext->IRPPending = FALSE;
pRxContext->Readable = FALSE;
//pRxContext->ReorderInUse = FALSE;
/*pRxContext->ReorderInUse = FALSE; */
pRxContext->bRxHandling = FALSE;
pRxContext->BulkInOffset = 0;
}
@ -165,44 +165,44 @@ NDIS_STATUS NICInitTransmit(IN PRTMP_ADAPTER pAd)
PTX_CONTEXT pPsPollContext = &(pAd->PsPollContext);
PTX_CONTEXT pRTSContext = &(pAd->RTSContext);
PTX_CONTEXT pMLMEContext = NULL;
// PHT_TX_CONTEXT pHTTXContext = NULL;
/* PHT_TX_CONTEXT pHTTXContext = NULL; */
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;
PVOID RingBaseVa;
// RTMP_TX_RING *pTxRing;
/* RTMP_TX_RING *pTxRing; */
RTMP_MGMT_RING *pMgmtRing;
DBGPRINT(RT_DEBUG_TRACE, ("--> NICInitTransmit\n"));
pObj = pObj;
// Init 4 set of Tx parameters
/* Init 4 set of Tx parameters */
for (acidx = 0; acidx < NUM_OF_TX_RING; acidx++) {
// Initialize all Transmit releated queues
/* Initialize all Transmit releated queues */
InitializeQueueHeader(&pAd->TxSwQueue[acidx]);
// Next Local tx ring pointer waiting for buck out
/* Next Local tx ring pointer waiting for buck out */
pAd->NextBulkOutIndex[acidx] = acidx;
pAd->BulkOutPending[acidx] = FALSE; // Buck Out control flag
//pAd->DataBulkDoneIdx[acidx] = 0;
pAd->BulkOutPending[acidx] = FALSE; /* Buck Out control flag */
/*pAd->DataBulkDoneIdx[acidx] = 0; */
}
//pAd->NextMLMEIndex = 0;
//pAd->PushMgmtIndex = 0;
//pAd->PopMgmtIndex = 0;
//InterlockedExchange(&pAd->MgmtQueueSize, 0);
//InterlockedExchange(&pAd->TxCount, 0);
/*pAd->NextMLMEIndex = 0; */
/*pAd->PushMgmtIndex = 0; */
/*pAd->PopMgmtIndex = 0; */
/*InterlockedExchange(&pAd->MgmtQueueSize, 0); */
/*InterlockedExchange(&pAd->TxCount, 0); */
//pAd->PrioRingFirstIndex = 0;
//pAd->PrioRingTxCnt = 0;
/*pAd->PrioRingFirstIndex = 0; */
/*pAd->PrioRingTxCnt = 0; */
do {
//
// TX_RING_SIZE, 4 ACs
//
/* */
/* TX_RING_SIZE, 4 ACs */
/* */
for (acidx = 0; acidx < 4; acidx++) {
PHT_TX_CONTEXT pHTTXContext = &(pAd->TxContext[acidx]);
NdisZeroMemory(pHTTXContext, sizeof(HT_TX_CONTEXT));
//Allocate URB
/*Allocate URB */
LM_USB_ALLOC(pObj, pHTTXContext, PHTTX_BUFFER,
sizeof(HTTX_BUFFER), Status,
("<-- ERROR in Alloc TX TxContext[%d] urb!! \n",
@ -226,11 +226,11 @@ NDIS_STATUS NICInitTransmit(IN PRTMP_ADAPTER pAd)
pAd->BulkOutPending[acidx] = FALSE;
}
//
// MGMT_RING_SIZE
//
/* */
/* MGMT_RING_SIZE */
/* */
// Allocate MGMT ring descriptor's memory
/* Allocate MGMT ring descriptor's memory */
pAd->MgmtDescRing.AllocSize =
MGMT_RING_SIZE * sizeof(TX_CONTEXT);
os_alloc_mem(pAd, (PUCHAR *) (&pAd->MgmtDescRing.AllocVa),
@ -244,16 +244,16 @@ NDIS_STATUS NICInitTransmit(IN PRTMP_ADAPTER pAd)
pAd->MgmtDescRing.AllocSize);
RingBaseVa = pAd->MgmtDescRing.AllocVa;
// Initialize MGMT Ring and associated buffer memory
/* Initialize MGMT Ring and associated buffer memory */
pMgmtRing = &pAd->MgmtRing;
for (i = 0; i < MGMT_RING_SIZE; i++) {
// link the pre-allocated Mgmt buffer to MgmtRing.Cell
/* link the pre-allocated Mgmt buffer to MgmtRing.Cell */
pMgmtRing->Cell[i].AllocSize = sizeof(TX_CONTEXT);
pMgmtRing->Cell[i].AllocVa = RingBaseVa;
pMgmtRing->Cell[i].pNdisPacket = NULL;
pMgmtRing->Cell[i].pNextNdisPacket = NULL;
//Allocate URB for MLMEContext
/*Allocate URB for MLMEContext */
pMLMEContext =
(PTX_CONTEXT) pAd->MgmtRing.Cell[i].AllocVa;
pMLMEContext->pUrb = RTUSB_ALLOC_URB(0);
@ -273,27 +273,27 @@ NDIS_STATUS NICInitTransmit(IN PRTMP_ADAPTER pAd)
pMLMEContext->BulkOutSize = 0;
pMLMEContext->SelfIdx = i;
// Offset to next ring descriptor address
/* Offset to next ring descriptor address */
RingBaseVa = (PUCHAR) RingBaseVa + sizeof(TX_CONTEXT);
}
DBGPRINT(RT_DEBUG_TRACE,
("MGMT Ring: total %d entry allocated\n", i));
//pAd->MgmtRing.TxSwFreeIdx = (MGMT_RING_SIZE - 1);
/*pAd->MgmtRing.TxSwFreeIdx = (MGMT_RING_SIZE - 1); */
pAd->MgmtRing.TxSwFreeIdx = MGMT_RING_SIZE;
pAd->MgmtRing.TxCpuIdx = 0;
pAd->MgmtRing.TxDmaIdx = 0;
//
// BEACON_RING_SIZE
//
for (i = 0; i < BEACON_RING_SIZE; i++) // 2
/* */
/* BEACON_RING_SIZE */
/* */
for (i = 0; i < BEACON_RING_SIZE; i++) /* 2 */
{
PTX_CONTEXT pBeaconContext = &(pAd->BeaconContext[i]);
NdisZeroMemory(pBeaconContext, sizeof(TX_CONTEXT));
//Allocate URB
/*Allocate URB */
LM_USB_ALLOC(pObj, pBeaconContext, PTX_BUFFER,
sizeof(TX_BUFFER), Status,
("<-- ERROR in Alloc TX BeaconContext[%d] urb!! \n",
@ -307,12 +307,12 @@ NDIS_STATUS NICInitTransmit(IN PRTMP_ADAPTER pAd)
pBeaconContext->IRPPending = FALSE;
}
//
// NullContext
//
/* */
/* NullContext */
/* */
NdisZeroMemory(pNullContext, sizeof(TX_CONTEXT));
//Allocate URB
/*Allocate URB */
LM_USB_ALLOC(pObj, pNullContext, PTX_BUFFER, sizeof(TX_BUFFER),
Status,
("<-- ERROR in Alloc TX NullContext urb!! \n"),
@ -325,12 +325,12 @@ NDIS_STATUS NICInitTransmit(IN PRTMP_ADAPTER pAd)
pNullContext->InUse = FALSE;
pNullContext->IRPPending = FALSE;
//
// RTSContext
//
/* */
/* RTSContext */
/* */
NdisZeroMemory(pRTSContext, sizeof(TX_CONTEXT));
//Allocate URB
/*Allocate URB */
LM_USB_ALLOC(pObj, pRTSContext, PTX_BUFFER, sizeof(TX_BUFFER),
Status,
("<-- ERROR in Alloc TX RTSContext urb!! \n"),
@ -343,11 +343,11 @@ NDIS_STATUS NICInitTransmit(IN PRTMP_ADAPTER pAd)
pRTSContext->InUse = FALSE;
pRTSContext->IRPPending = FALSE;
//
// PsPollContext
//
//NdisZeroMemory(pPsPollContext, sizeof(TX_CONTEXT));
//Allocate URB
/* */
/* PsPollContext */
/* */
/*NdisZeroMemory(pPsPollContext, sizeof(TX_CONTEXT)); */
/*Allocate URB */
LM_USB_ALLOC(pObj, pPsPollContext, PTX_BUFFER,
sizeof(TX_BUFFER), Status,
("<-- ERROR in Alloc TX PsPollContext urb!! \n"),
@ -407,7 +407,7 @@ out1:
LM_URB_FREE(pObj, pTxContext, sizeof(HTTX_BUFFER));
}
// Here we didn't have any pre-allocated memory need to free.
/* Here we didn't have any pre-allocated memory need to free. */
return Status;
}
@ -430,21 +430,21 @@ Note:
*/
NDIS_STATUS RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd)
{
// COUNTER_802_11 pCounter = &pAd->WlanCounters;
/* COUNTER_802_11 pCounter = &pAd->WlanCounters; */
NDIS_STATUS Status;
INT num;
DBGPRINT(RT_DEBUG_TRACE, ("--> RTMPAllocTxRxRingMemory\n"));
do {
// Init the CmdQ and CmdQLock
/* Init the CmdQ and CmdQLock */
NdisAllocateSpinLock(&pAd->CmdQLock);
NdisAcquireSpinLock(&pAd->CmdQLock);
RTUSBInitializeCmdQ(&pAd->CmdQ);
NdisReleaseSpinLock(&pAd->CmdQLock);
NdisAllocateSpinLock(&pAd->MLMEBulkOutLock);
//NdisAllocateSpinLock(&pAd->MLMEWaitQueueLock);
/*NdisAllocateSpinLock(&pAd->MLMEWaitQueueLock); */
NdisAllocateSpinLock(&pAd->BulkOutLock[0]);
NdisAllocateSpinLock(&pAd->BulkOutLock[1]);
NdisAllocateSpinLock(&pAd->BulkOutLock[2]);
@ -457,31 +457,31 @@ NDIS_STATUS RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd)
NdisAllocateSpinLock(&pAd->TxContextQueueLock[num]);
}
// NdisAllocateSpinLock(&pAd->MemLock); // Not used in RT28XX
/* NdisAllocateSpinLock(&pAd->MemLock); // Not used in RT28XX */
// NdisAllocateSpinLock(&pAd->MacTabLock); // init it in UserCfgInit()
// NdisAllocateSpinLock(&pAd->BATabLock); // init it in BATableInit()
/* NdisAllocateSpinLock(&pAd->MacTabLock); // init it in UserCfgInit() */
/* NdisAllocateSpinLock(&pAd->BATabLock); // init it in BATableInit() */
// for(num=0; num<MAX_LEN_OF_BA_REC_TABLE; num++)
// {
// NdisAllocateSpinLock(&pAd->BATable.BARecEntry[num].RxReRingLock);
// }
/* for(num=0; num<MAX_LEN_OF_BA_REC_TABLE; num++) */
/* { */
/* NdisAllocateSpinLock(&pAd->BATable.BARecEntry[num].RxReRingLock); */
/* } */
//
// Init Mac Table
//
// MacTableInitialize(pAd);
/* */
/* Init Mac Table */
/* */
/* MacTableInitialize(pAd); */
//
// Init send data structures and related parameters
//
/* */
/* Init send data structures and related parameters */
/* */
Status = NICInitTransmit(pAd);
if (Status != NDIS_STATUS_SUCCESS)
break;
//
// Init receive data structures and related parameters
//
/* */
/* Init receive data structures and related parameters */
/* */
Status = NICInitRecv(pAd);
if (Status != NDIS_STATUS_SUCCESS)
break;
@ -536,42 +536,42 @@ VOID RTMPFreeTxRxRingMemory(IN PRTMP_ADAPTER pAd)
PTX_CONTEXT pNullContext = &pAd->NullContext;
PTX_CONTEXT pPsPollContext = &pAd->PsPollContext;
PTX_CONTEXT pRTSContext = &pAd->RTSContext;
// PHT_TX_CONTEXT pHTTXContext;
//PRTMP_REORDERBUF pReorderBuf;
/* PHT_TX_CONTEXT pHTTXContext; */
/*PRTMP_REORDERBUF pReorderBuf; */
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;
// RTMP_TX_RING *pTxRing;
/* RTMP_TX_RING *pTxRing; */
DBGPRINT(RT_DEBUG_ERROR, ("---> RTMPFreeTxRxRingMemory\n"));
pObj = pObj;
// Free all resources for the RECEIVE buffer queue.
/* Free all resources for the RECEIVE buffer queue. */
for (i = 0; i < (RX_RING_SIZE); i++) {
PRX_CONTEXT pRxContext = &(pAd->RxContext[i]);
if (pRxContext)
LM_URB_FREE(pObj, pRxContext, MAX_RXBULK_SIZE);
}
// Free PsPoll frame resource
/* Free PsPoll frame resource */
LM_URB_FREE(pObj, pPsPollContext, sizeof(TX_BUFFER));
// Free NULL frame resource
/* Free NULL frame resource */
LM_URB_FREE(pObj, pNullContext, sizeof(TX_BUFFER));
// Free RTS frame resource
/* Free RTS frame resource */
LM_URB_FREE(pObj, pRTSContext, sizeof(TX_BUFFER));
// Free beacon frame resource
/* Free beacon frame resource */
for (i = 0; i < BEACON_RING_SIZE; i++) {
PTX_CONTEXT pBeaconContext = &(pAd->BeaconContext[i]);
if (pBeaconContext)
LM_URB_FREE(pObj, pBeaconContext, sizeof(TX_BUFFER));
}
// Free mgmt frame resource
/* Free mgmt frame resource */
for (i = 0; i < MGMT_RING_SIZE; i++) {
PTX_CONTEXT pMLMEContext =
(PTX_CONTEXT) pAd->MgmtRing.Cell[i].AllocVa;
//LM_URB_FREE(pObj, pMLMEContext, sizeof(TX_BUFFER));
/*LM_URB_FREE(pObj, pMLMEContext, sizeof(TX_BUFFER)); */
if (NULL != pAd->MgmtRing.Cell[i].pNdisPacket) {
RTMPFreeNdisPacket(pAd,
pAd->MgmtRing.Cell[i].pNdisPacket);
@ -590,7 +590,7 @@ VOID RTMPFreeTxRxRingMemory(IN PRTMP_ADAPTER pAd)
if (pAd->MgmtDescRing.AllocVa)
os_free_mem(pAd, pAd->MgmtDescRing.AllocVa);
// Free Tx frame resource
/* Free Tx frame resource */
for (acidx = 0; acidx < 4; acidx++) {
PHT_TX_CONTEXT pHTTXContext = &(pAd->TxContext[acidx]);
if (pHTTXContext)
@ -609,15 +609,15 @@ VOID RTMPFreeTxRxRingMemory(IN PRTMP_ADAPTER pAd)
NdisFreeSpinLock(&pAd->MLMEBulkOutLock);
NdisFreeSpinLock(&pAd->CmdQLock);
// Clear all pending bulk-out request flags.
/* Clear all pending bulk-out request flags. */
RTUSB_CLEAR_BULK_FLAG(pAd, 0xffffffff);
// NdisFreeSpinLock(&pAd->MacTabLock);
/* NdisFreeSpinLock(&pAd->MacTabLock); */
// for(i=0; i<MAX_LEN_OF_BA_REC_TABLE; i++)
// {
// NdisFreeSpinLock(&pAd->BATable.BARecEntry[i].RxReRingLock);
// }
/* for(i=0; i<MAX_LEN_OF_BA_REC_TABLE; i++) */
/* { */
/* NdisFreeSpinLock(&pAd->BATable.BARecEntry[i].RxReRingLock); */
/* } */
DBGPRINT(RT_DEBUG_ERROR, ("<--- RTMPFreeTxRxRingMemory\n"));
}
@ -643,7 +643,7 @@ NDIS_STATUS RTUSBWriteHWMACAddress(IN PRTMP_ADAPTER pAd)
NDIS_STATUS Status = NDIS_STATUS_SUCCESS;
LARGE_INTEGER NOW;
// initialize the random number generator
/* initialize the random number generator */
RTMP_GetCurrentSystemTime(&NOW);
if (pAd->bLocalAdminMAC != TRUE) {
@ -654,7 +654,7 @@ NDIS_STATUS RTUSBWriteHWMACAddress(IN PRTMP_ADAPTER pAd)
pAd->CurrentAddress[4] = pAd->PermanentAddress[4];
pAd->CurrentAddress[5] = pAd->PermanentAddress[5];
}
// Write New MAC address to MAC_CSR2 & MAC_CSR3 & let ASIC know our new MAC
/* Write New MAC address to MAC_CSR2 & MAC_CSR3 & let ASIC know our new MAC */
StaMacReg0.field.Byte0 = pAd->CurrentAddress[0];
StaMacReg0.field.Byte1 = pAd->CurrentAddress[1];
StaMacReg0.field.Byte2 = pAd->CurrentAddress[2];
@ -689,7 +689,7 @@ Note:
*/
VOID RT28XXDMADisable(IN RTMP_ADAPTER * pAd)
{
// no use
/* no use */
}
/*
@ -776,7 +776,7 @@ VOID RT28xx_UpdateBeaconToAsic(IN RTMP_ADAPTER * pAd,
UINT i, padding;
BEACON_SYNC_STRUCT *pBeaconSync = pAd->CommonCfg.pBeaconSync;
UINT32 longValue;
// USHORT shortValue;
/* USHORT shortValue; */
BOOLEAN bBcnReq = FALSE;
UCHAR bcn_idx = 0;
@ -789,9 +789,9 @@ VOID RT28xx_UpdateBeaconToAsic(IN RTMP_ADAPTER * pAd,
DBGPRINT(RT_DEBUG_ERROR, ("pBeaconSync is NULL!\n"));
return;
}
//if ((pAd->WdsTab.Mode == WDS_BRIDGE_MODE) ||
// ((pAd->ApCfg.MBSSID[apidx].MSSIDDev == NULL) || !(pAd->ApCfg.MBSSID[apidx].MSSIDDev->flags & IFF_UP))
// )
/*if ((pAd->WdsTab.Mode == WDS_BRIDGE_MODE) || */
/* ((pAd->ApCfg.MBSSID[apidx].MSSIDDev == NULL) || !(pAd->ApCfg.MBSSID[apidx].MSSIDDev->flags & IFF_UP)) */
/* ) */
if (bBcnReq == FALSE) {
/* when the ra interface is down, do not send its beacon frame */
/* clear all zero */
@ -804,7 +804,7 @@ VOID RT28xx_UpdateBeaconToAsic(IN RTMP_ADAPTER * pAd,
NdisZeroMemory(pBeaconSync->BeaconTxWI[bcn_idx], TXWI_SIZE);
} else {
ptr = (PUCHAR) & pAd->BeaconTxWI;
if (NdisEqualMemory(pBeaconSync->BeaconTxWI[bcn_idx], &pAd->BeaconTxWI, TXWI_SIZE) == FALSE) { // If BeaconTxWI changed, we need to rewrite the TxWI for the Beacon frames.
if (NdisEqualMemory(pBeaconSync->BeaconTxWI[bcn_idx], &pAd->BeaconTxWI, TXWI_SIZE) == FALSE) { /* If BeaconTxWI changed, we need to rewrite the TxWI for the Beacon frames. */
pBeaconSync->BeaconBitMap &=
(~(BEACON_BITMAP_MASK & (1 << bcn_idx)));
NdisMoveMemory(pBeaconSync->BeaconTxWI[bcn_idx],
@ -813,7 +813,7 @@ VOID RT28xx_UpdateBeaconToAsic(IN RTMP_ADAPTER * pAd,
if ((pBeaconSync->BeaconBitMap & (1 << bcn_idx)) !=
(1 << bcn_idx)) {
for (i = 0; i < TXWI_SIZE; i += 4) // 16-byte TXWI field
for (i = 0; i < TXWI_SIZE; i += 4) /* 16-byte TXWI field */
{
longValue =
*ptr + (*(ptr + 1) << 8) +
@ -832,8 +832,8 @@ VOID RT28xx_UpdateBeaconToAsic(IN RTMP_ADAPTER * pAd,
for (i = 0; i < FrameLen /*HW_BEACON_OFFSET */ ; i += 2) {
if (NdisEqualMemory(ptr, pBeaconFrame, 2) == FALSE) {
NdisMoveMemory(ptr, pBeaconFrame, 2);
//shortValue = *ptr + (*(ptr+1)<<8);
//RTMP_IO_WRITE8(pAd, pAd->BeaconOffset[bcn_idx] + TXWI_SIZE + i, shortValue);
/*shortValue = *ptr + (*(ptr+1)<<8); */
/*RTMP_IO_WRITE8(pAd, pAd->BeaconOffset[bcn_idx] + TXWI_SIZE + i, shortValue); */
RTUSBMultiWrite(pAd,
pAd->BeaconOffset[bcn_idx] +
TXWI_SIZE + i, ptr, 2);
@ -844,7 +844,7 @@ VOID RT28xx_UpdateBeaconToAsic(IN RTMP_ADAPTER * pAd,
pBeaconSync->BeaconBitMap |= (1 << bcn_idx);
// For AP interface, set the DtimBitOn so that we can send Bcast/Mcast frame out after this beacon frame.
/* For AP interface, set the DtimBitOn so that we can send Bcast/Mcast frame out after this beacon frame. */
}
}
@ -887,7 +887,7 @@ VOID RTUSBBssBeaconStart(IN RTMP_ADAPTER * pAd)
{
int apidx;
BEACON_SYNC_STRUCT *pBeaconSync;
// LARGE_INTEGER tsfTime, deltaTime;
/* LARGE_INTEGER tsfTime, deltaTime; */
pBeaconSync = pAd->CommonCfg.pBeaconSync;
if (pBeaconSync && pBeaconSync->EnableBeacon) {
@ -936,7 +936,7 @@ VOID RTUSBBssBeaconInit(IN RTMP_ADAPTER * pAd)
os_alloc_mem(pAd, (PUCHAR *) (&pAd->CommonCfg.pBeaconSync),
sizeof(BEACON_SYNC_STRUCT));
//NdisAllocMemory(pAd->CommonCfg.pBeaconSync, sizeof(BEACON_SYNC_STRUCT), MEM_ALLOC_FLAG);
/*NdisAllocMemory(pAd->CommonCfg.pBeaconSync, sizeof(BEACON_SYNC_STRUCT), MEM_ALLOC_FLAG); */
if (pAd->CommonCfg.pBeaconSync) {
pBeaconSync = pAd->CommonCfg.pBeaconSync;
NdisZeroMemory(pBeaconSync, sizeof(BEACON_SYNC_STRUCT));
@ -949,7 +949,7 @@ VOID RTUSBBssBeaconInit(IN RTMP_ADAPTER * pAd)
}
pBeaconSync->BeaconBitMap = 0;
//RTMPInitTimer(pAd, &pAd->CommonCfg.BeaconUpdateTimer, GET_TIMER_FUNCTION(BeaconUpdateExec), pAd, TRUE);
/*RTMPInitTimer(pAd, &pAd->CommonCfg.BeaconUpdateTimer, GET_TIMER_FUNCTION(BeaconUpdateExec), pAd, TRUE); */
pBeaconSync->EnableBeacon = TRUE;
}
}
@ -1002,9 +1002,9 @@ VOID BeaconUpdateExec(IN PVOID SystemSpecific1,
IN PVOID SystemSpecific2, IN PVOID SystemSpecific3)
{
PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) FunctionContext;
LARGE_INTEGER tsfTime_a; //, tsfTime_b, deltaTime_exp, deltaTime_ab;
LARGE_INTEGER tsfTime_a; /*, tsfTime_b, deltaTime_exp, deltaTime_ab; */
UINT32 delta, delta2MS, period2US, remain, remain_low, remain_high;
// BOOLEAN positive;
/* BOOLEAN positive; */
if (pAd->CommonCfg.IsUpdateBeacon == TRUE) {
ReSyncBeaconTime(pAd);
@ -1014,7 +1014,7 @@ VOID BeaconUpdateExec(IN PVOID SystemSpecific1,
RTMP_IO_READ32(pAd, TSF_TIMER_DW0, &tsfTime_a.u.LowPart);
RTMP_IO_READ32(pAd, TSF_TIMER_DW1, &tsfTime_a.u.HighPart);
//positive=getDeltaTime(tsfTime_a, expectedTime, &deltaTime_exp);
/*positive=getDeltaTime(tsfTime_a, expectedTime, &deltaTime_exp); */
period2US = (pAd->CommonCfg.BeaconPeriod << 10);
remain_high = pAd->CommonCfg.BeaconRemain * tsfTime_a.u.HighPart;
remain_low = tsfTime_a.u.LowPart % (pAd->CommonCfg.BeaconPeriod << 10);
@ -1051,20 +1051,20 @@ VOID RT28xxUsbMlmeRadioOn(IN PRTMP_ADAPTER pAd)
AsicSendCommandToMcu(pAd, 0x31, 0xff, 0x00, 0x02);
RTMPusecDelay(10000);
}
//NICResetFromError(pAd);
/*NICResetFromError(pAd); */
// Enable Tx/Rx
/* Enable Tx/Rx */
RTMPEnableRxTx(pAd);
if (pChipOps->AsicReverseRfFromSleepMode)
pChipOps->AsicReverseRfFromSleepMode(pAd);
// Clear Radio off flag
/* Clear Radio off flag */
RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF);
RTUSBBulkReceive(pAd);
// Set LED
/* Set LED */
RTMPSetLED(pAd, LED_RADIO_ON);
}
@ -1078,11 +1078,11 @@ VOID RT28xxUsbMlmeRadioOFF(IN PRTMP_ADAPTER pAd)
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF))
return;
// Clear PMKID cache.
/* Clear PMKID cache. */
pAd->StaCfg.SavedPMKNum = 0;
RTMPZeroMemory(pAd->StaCfg.SavedPMK, (PMKID_NO * sizeof(BSSID_INFO)));
// Link down first if any association exists
/* Link down first if any association exists */
if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) {
if (INFRA_ON(pAd) || ADHOC_ON(pAd)) {
MLME_DISASSOC_REQ_STRUCT DisReq;
@ -1110,38 +1110,38 @@ VOID RT28xxUsbMlmeRadioOFF(IN PRTMP_ADAPTER pAd)
}
}
}
// Set Radio off flag
/* Set Radio off flag */
RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF);
{
// Link down first if any association exists
/* Link down first if any association exists */
if (INFRA_ON(pAd) || ADHOC_ON(pAd))
LinkDown(pAd, FALSE);
RTMPusecDelay(10000);
//==========================================
// Clean up old bss table
/*========================================== */
/* Clean up old bss table */
BssTableInit(&pAd->ScanTab);
}
// Set LED
/* Set LED */
RTMPSetLED(pAd, LED_RADIO_OFF);
if (pAd->CommonCfg.BBPCurrentBW == BW_40) {
// Must using 40MHz.
/* Must using 40MHz. */
AsicTurnOffRFClk(pAd, pAd->CommonCfg.CentralChannel);
} else {
// Must using 20MHz.
/* Must using 20MHz. */
AsicTurnOffRFClk(pAd, pAd->CommonCfg.Channel);
}
// Disable Tx/Rx DMA
RTUSBReadMACRegister(pAd, WPDMA_GLO_CFG, &GloCfg.word); // disable DMA
/* Disable Tx/Rx DMA */
RTUSBReadMACRegister(pAd, WPDMA_GLO_CFG, &GloCfg.word); /* disable DMA */
GloCfg.field.EnableTxDMA = 0;
GloCfg.field.EnableRxDMA = 0;
RTUSBWriteMACRegister(pAd, WPDMA_GLO_CFG, GloCfg.word); // abort all TX rings
RTUSBWriteMACRegister(pAd, WPDMA_GLO_CFG, GloCfg.word); /* abort all TX rings */
// Waiting for DMA idle
/* Waiting for DMA idle */
i = 0;
do {
RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &GloCfg.word);
@ -1152,7 +1152,7 @@ VOID RT28xxUsbMlmeRadioOFF(IN PRTMP_ADAPTER pAd)
RTMPusecDelay(1000);
} while (i++ < 100);
// Disable MAC Tx/Rx
/* Disable MAC Tx/Rx */
RTMP_IO_READ32(pAd, MAC_SYS_CTRL, &Value);
Value &= (0xfffffff3);
RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, Value);
@ -1162,4 +1162,4 @@ VOID RT28xxUsbMlmeRadioOFF(IN PRTMP_ADAPTER pAd)
}
}
#endif // RTMP_MAC_USB //
#endif /* RTMP_MAC_USB // */

View file

@ -144,7 +144,7 @@ BOOLEAN PeerAddBAReqActionSanity(IN PRTMP_ADAPTER pAd,
MsgLen));
return FALSE;
}
// we support immediate BA.
/* we support immediate BA. */
*(USHORT *) (&pAddFrame->BaParm) =
cpu2le16(*(USHORT *) (&pAddFrame->BaParm));
pAddFrame->TimeOutValue = cpu2le16(pAddFrame->TimeOutValue);
@ -160,7 +160,7 @@ BOOLEAN PeerAddBAReqActionSanity(IN PRTMP_ADAPTER pAd,
pAddFrame->BaParm.AMSDUSupported));
return FALSE;
}
// we support immediate BA.
/* we support immediate BA. */
if (pAddFrame->BaParm.TID & 0xfff0) {
DBGPRINT(RT_DEBUG_ERROR,
("PeerAddBAReqActionSanity: ADDBA Request incorrect TID = %d\n",
@ -183,7 +183,7 @@ BOOLEAN PeerAddBARspActionSanity(IN PRTMP_ADAPTER pAd,
MsgLen));
return FALSE;
}
// we support immediate BA.
/* we support immediate BA. */
*(USHORT *) (&pAddFrame->BaParm) =
cpu2le16(*(USHORT *) (&pAddFrame->BaParm));
pAddFrame->StatusCode = cpu2le16(pAddFrame->StatusCode);
@ -195,7 +195,7 @@ BOOLEAN PeerAddBARspActionSanity(IN PRTMP_ADAPTER pAd,
pAddFrame->BaParm.BAPolicy));
return FALSE;
}
// we support immediate BA.
/* we support immediate BA. */
if (pAddFrame->BaParm.TID & 0xfff0) {
DBGPRINT(RT_DEBUG_ERROR,
("PeerAddBARspActionSanity: ADDBA Response incorrect TID = %d\n",
@ -209,7 +209,7 @@ BOOLEAN PeerAddBARspActionSanity(IN PRTMP_ADAPTER pAd,
BOOLEAN PeerDelBAActionSanity(IN PRTMP_ADAPTER pAd,
IN UCHAR Wcid, IN VOID * pMsg, IN ULONG MsgLen)
{
//PFRAME_802_11 pFrame = (PFRAME_802_11)pMsg;
/*PFRAME_802_11 pFrame = (PFRAME_802_11)pMsg; */
PFRAME_DELBA_REQ pDelFrame;
if (MsgLen != (sizeof(FRAME_DELBA_REQ)))
return FALSE;
@ -240,7 +240,7 @@ BOOLEAN PeerDelBAActionSanity(IN PRTMP_ADAPTER pAd,
==========================================================================
*/
BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULONG MsgLen, IN UCHAR MsgChannel, OUT PUCHAR pAddr2, OUT PUCHAR pBssid, OUT CHAR Ssid[], OUT UCHAR * pSsidLen, OUT UCHAR * pBssType, OUT USHORT * pBeaconPeriod, OUT UCHAR * pChannel, OUT UCHAR * pNewChannel, OUT LARGE_INTEGER * pTimestamp, OUT CF_PARM * pCfParm, OUT USHORT * pAtimWin, OUT USHORT * pCapabilityInfo, OUT UCHAR * pErp, OUT UCHAR * pDtimCount, OUT UCHAR * pDtimPeriod, OUT UCHAR * pBcastFlag, OUT UCHAR * pMessageToMe, OUT UCHAR SupRate[], OUT UCHAR * pSupRateLen, OUT UCHAR ExtRate[], OUT UCHAR * pExtRateLen, OUT UCHAR * pCkipFlag, OUT UCHAR * pAironetCellPowerLimit, OUT PEDCA_PARM pEdcaParm, OUT PQBSS_LOAD_PARM pQbssLoad, OUT PQOS_CAPABILITY_PARM pQosCapability, OUT ULONG * pRalinkIe, OUT UCHAR * pHtCapabilityLen, OUT UCHAR * pPreNHtCapabilityLen, OUT HT_CAPABILITY_IE * pHtCapability, OUT UCHAR * AddHtInfoLen, OUT ADD_HT_INFO_IE * AddHtInfo, OUT UCHAR * NewExtChannelOffset, // Ht extension channel offset(above or below)
BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULONG MsgLen, IN UCHAR MsgChannel, OUT PUCHAR pAddr2, OUT PUCHAR pBssid, OUT CHAR Ssid[], OUT UCHAR * pSsidLen, OUT UCHAR * pBssType, OUT USHORT * pBeaconPeriod, OUT UCHAR * pChannel, OUT UCHAR * pNewChannel, OUT LARGE_INTEGER * pTimestamp, OUT CF_PARM * pCfParm, OUT USHORT * pAtimWin, OUT USHORT * pCapabilityInfo, OUT UCHAR * pErp, OUT UCHAR * pDtimCount, OUT UCHAR * pDtimPeriod, OUT UCHAR * pBcastFlag, OUT UCHAR * pMessageToMe, OUT UCHAR SupRate[], OUT UCHAR * pSupRateLen, OUT UCHAR ExtRate[], OUT UCHAR * pExtRateLen, OUT UCHAR * pCkipFlag, OUT UCHAR * pAironetCellPowerLimit, OUT PEDCA_PARM pEdcaParm, OUT PQBSS_LOAD_PARM pQbssLoad, OUT PQOS_CAPABILITY_PARM pQosCapability, OUT ULONG * pRalinkIe, OUT UCHAR * pHtCapabilityLen, OUT UCHAR * pPreNHtCapabilityLen, OUT HT_CAPABILITY_IE * pHtCapability, OUT UCHAR * AddHtInfoLen, OUT ADD_HT_INFO_IE * AddHtInfo, OUT UCHAR * NewExtChannelOffset, /* Ht extension channel offset(above or below) */
OUT USHORT * LengthVIE,
OUT PNDIS_802_11_VARIABLE_IEs pVIE)
{
@ -250,16 +250,16 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON
PEID_STRUCT pEid;
UCHAR SubType;
UCHAR Sanity;
//UCHAR ECWMin, ECWMax;
//MAC_CSR9_STRUC Csr9;
/*UCHAR ECWMin, ECWMax; */
/*MAC_CSR9_STRUC Csr9; */
ULONG Length = 0;
// For some 11a AP which didn't have DS_IE, we use two conditions to decide the channel
// 1. If the AP is 11n enabled, then check the control channel.
// 2. If the AP didn't have any info about channel, use the channel we received this frame as the channel. (May inaccuracy!!)
/* For some 11a AP which didn't have DS_IE, we use two conditions to decide the channel */
/* 1. If the AP is 11n enabled, then check the control channel. */
/* 2. If the AP didn't have any info about channel, use the channel we received this frame as the channel. (May inaccuracy!!) */
UCHAR CtrlChannel = 0;
// Add for 3 necessary EID field check
/* Add for 3 necessary EID field check */
Sanity = 0;
*pAtimWin = 0;
@ -269,34 +269,34 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON
*pBcastFlag = 0;
*pMessageToMe = 0;
*pExtRateLen = 0;
*pCkipFlag = 0; // Default of CkipFlag is 0
*pAironetCellPowerLimit = 0xFF; // Default of AironetCellPowerLimit is 0xFF
*LengthVIE = 0; // Set the length of VIE to init value 0
*pHtCapabilityLen = 0; // Set the length of VIE to init value 0
*pCkipFlag = 0; /* Default of CkipFlag is 0 */
*pAironetCellPowerLimit = 0xFF; /* Default of AironetCellPowerLimit is 0xFF */
*LengthVIE = 0; /* Set the length of VIE to init value 0 */
*pHtCapabilityLen = 0; /* Set the length of VIE to init value 0 */
if (pAd->OpMode == OPMODE_STA)
*pPreNHtCapabilityLen = 0; // Set the length of VIE to init value 0
*AddHtInfoLen = 0; // Set the length of VIE to init value 0
*pPreNHtCapabilityLen = 0; /* Set the length of VIE to init value 0 */
*AddHtInfoLen = 0; /* Set the length of VIE to init value 0 */
*pRalinkIe = 0;
*pNewChannel = 0;
*NewExtChannelOffset = 0xff; //Default 0xff means no such IE
pCfParm->bValid = FALSE; // default: no IE_CF found
pQbssLoad->bValid = FALSE; // default: no IE_QBSS_LOAD found
pEdcaParm->bValid = FALSE; // default: no IE_EDCA_PARAMETER found
pQosCapability->bValid = FALSE; // default: no IE_QOS_CAPABILITY found
*NewExtChannelOffset = 0xff; /*Default 0xff means no such IE */
pCfParm->bValid = FALSE; /* default: no IE_CF found */
pQbssLoad->bValid = FALSE; /* default: no IE_QBSS_LOAD found */
pEdcaParm->bValid = FALSE; /* default: no IE_EDCA_PARAMETER found */
pQosCapability->bValid = FALSE; /* default: no IE_QOS_CAPABILITY found */
pFrame = (PFRAME_802_11) Msg;
// get subtype from header
/* get subtype from header */
SubType = (UCHAR) pFrame->Hdr.FC.SubType;
// get Addr2 and BSSID from header
/* get Addr2 and BSSID from header */
COPY_MAC_ADDR(pAddr2, pFrame->Hdr.Addr2);
COPY_MAC_ADDR(pBssid, pFrame->Hdr.Addr3);
Ptr = pFrame->Octet;
Length += LENGTH_802_11;
// get timestamp from payload and advance the pointer
/* get timestamp from payload and advance the pointer */
NdisMoveMemory(pTimestamp, Ptr, TIMESTAMP_LEN);
pTimestamp->u.LowPart = cpu2le32(pTimestamp->u.LowPart);
@ -305,12 +305,12 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON
Ptr += TIMESTAMP_LEN;
Length += TIMESTAMP_LEN;
// get beacon interval from payload and advance the pointer
/* get beacon interval from payload and advance the pointer */
NdisMoveMemory(pBeaconPeriod, Ptr, 2);
Ptr += 2;
Length += 2;
// get capability info from payload and advance the pointer
/* get capability info from payload and advance the pointer */
NdisMoveMemory(pCapabilityInfo, Ptr, 2);
Ptr += 2;
Length += 2;
@ -322,11 +322,11 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON
pEid = (PEID_STRUCT) Ptr;
// get variable fields from payload and advance the pointer
/* get variable fields from payload and advance the pointer */
while ((Length + 2 + pEid->Len) <= MsgLen) {
//
// Secure copy VIE to VarIE[MAX_VIE_LEN] didn't overflow.
//
/* */
/* Secure copy VIE to VarIE[MAX_VIE_LEN] didn't overflow. */
/* */
if ((*LengthVIE + pEid->Len + 2) >= MAX_VIE_LEN) {
DBGPRINT(RT_DEBUG_WARN,
("PeerBeaconAndProbeRspSanity - Variable IEs out of resource [len(=%d) > MAX_VIE_LEN(=%d)]\n",
@ -336,7 +336,7 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON
switch (pEid->Eid) {
case IE_SSID:
// Already has one SSID EID in this beacon, ignore the second one
/* Already has one SSID EID in this beacon, ignore the second one */
if (Sanity & 0x1)
break;
if (pEid->Len <= MAX_LEN_OF_SSID) {
@ -357,11 +357,11 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON
NdisMoveMemory(SupRate, pEid->Octet, pEid->Len);
*pSupRateLen = pEid->Len;
// TODO: 2004-09-14 not a good design here, cause it exclude extra rates
// from ScanTab. We should report as is. And filter out unsupported
// rates in MlmeAux.
// Check against the supported rates
// RTMPCheckRates(pAd, SupRate, pSupRateLen);
/* TODO: 2004-09-14 not a good design here, cause it exclude extra rates */
/* from ScanTab. We should report as is. And filter out unsupported */
/* rates in MlmeAux. */
/* Check against the supported rates */
/* RTMPCheckRates(pAd, SupRate, pSupRateLen); */
} else {
DBGPRINT(RT_DEBUG_TRACE,
("PeerBeaconAndProbeRspSanity - wrong IE_SUPP_RATES (len=%d)\n",
@ -371,11 +371,11 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON
break;
case IE_HT_CAP:
if (pEid->Len >= SIZE_HT_CAP_IE) //Note: allow extension.!!
if (pEid->Len >= SIZE_HT_CAP_IE) /*Note: allow extension.!! */
{
NdisMoveMemory(pHtCapability, pEid->Octet,
sizeof(HT_CAPABILITY_IE));
*pHtCapabilityLen = SIZE_HT_CAP_IE; // Nnow we only support 26 bytes.
*pHtCapabilityLen = SIZE_HT_CAP_IE; /* Nnow we only support 26 bytes. */
*(USHORT *) (&pHtCapability->HtCapInfo) =
cpu2le16(*(USHORT *)
@ -385,7 +385,7 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON
(&pHtCapability->ExtHtCapInfo));
{
*pPreNHtCapabilityLen = 0; // Nnow we only support 26 bytes.
*pPreNHtCapabilityLen = 0; /* Nnow we only support 26 bytes. */
Ptr = (PUCHAR) pVIE;
NdisMoveMemory(Ptr + *LengthVIE,
@ -402,8 +402,8 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON
break;
case IE_ADD_HT:
if (pEid->Len >= sizeof(ADD_HT_INFO_IE)) {
// This IE allows extension, but we can ignore extra bytes beyond our knowledge , so only
// copy first sizeof(ADD_HT_INFO_IE)
/* This IE allows extension, but we can ignore extra bytes beyond our knowledge , so only */
/* copy first sizeof(ADD_HT_INFO_IE) */
NdisMoveMemory(AddHtInfo, pEid->Octet,
sizeof(ADD_HT_INFO_IE));
*AddHtInfoLen = SIZE_ADD_HT_INFO_IE;
@ -500,17 +500,17 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON
break;
case IE_CHANNEL_SWITCH_ANNOUNCEMENT:
if (pEid->Len == 3) {
*pNewChannel = pEid->Octet[1]; //extract new channel number
*pNewChannel = pEid->Octet[1]; /*extract new channel number */
}
break;
// New for WPA
// CCX v2 has the same IE, we need to parse that too
// Wifi WMM use the same IE vale, need to parse that too
// case IE_WPA:
/* New for WPA */
/* CCX v2 has the same IE, we need to parse that too */
/* Wifi WMM use the same IE vale, need to parse that too */
/* case IE_WPA: */
case IE_VENDOR_SPECIFIC:
// Check Broadcom/Atheros 802.11n OUI version, for HT Capability IE.
// This HT IE is before IEEE draft set HT IE value.2006-09-28 by Jan.
/* Check Broadcom/Atheros 802.11n OUI version, for HT Capability IE. */
/* This HT IE is before IEEE draft set HT IE value.2006-09-28 by Jan. */
/*if (NdisEqualMemory(pEid->Octet, BROADCOM_OUI, 3) && (pEid->Len >= 4))
{
if ((pEid->Octet[3] == OUI_BROADCOM_HT) && (pEid->Len >= 30))
@ -529,19 +529,19 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON
}
}
*/
// Check the OUI version, filter out non-standard usage
/* Check the OUI version, filter out non-standard usage */
if (NdisEqualMemory(pEid->Octet, RALINK_OUI, 3)
&& (pEid->Len == 7)) {
//*pRalinkIe = pEid->Octet[3];
/**pRalinkIe = pEid->Octet[3]; */
if (pEid->Octet[3] != 0)
*pRalinkIe = pEid->Octet[3];
else
*pRalinkIe = 0xf0000000; // Set to non-zero value (can't set bit0-2) to represent this is Ralink Chip. So at linkup, we will set ralinkchip flag.
*pRalinkIe = 0xf0000000; /* Set to non-zero value (can't set bit0-2) to represent this is Ralink Chip. So at linkup, we will set ralinkchip flag. */
}
// This HT IE is before IEEE draft set HT IE value.2006-09-28 by Jan.
/* This HT IE is before IEEE draft set HT IE value.2006-09-28 by Jan. */
// Other vendors had production before IE_HT_CAP value is assigned. To backward support those old-firmware AP,
// Check broadcom-defiend pre-802.11nD1.0 OUI for HT related IE, including HT Capatilities IE and HT Information IE
/* Other vendors had production before IE_HT_CAP value is assigned. To backward support those old-firmware AP, */
/* Check broadcom-defiend pre-802.11nD1.0 OUI for HT related IE, including HT Capatilities IE and HT Information IE */
else if ((*pHtCapabilityLen == 0)
&& NdisEqualMemory(pEid->Octet, PRE_N_HT_OUI,
3) && (pEid->Len >= 4)
@ -564,7 +564,7 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON
*AddHtInfoLen = SIZE_ADD_HT_INFO_IE;
}
} else if (NdisEqualMemory(pEid->Octet, WPA_OUI, 4)) {
// Copy to pVIE which will report to microsoft bssid list.
/* Copy to pVIE which will report to microsoft bssid list. */
Ptr = (PUCHAR) pVIE;
NdisMoveMemory(Ptr + *LengthVIE, &pEid->Eid,
pEid->Len + 2);
@ -575,39 +575,39 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON
PUCHAR ptr;
int i;
// parsing EDCA parameters
/* parsing EDCA parameters */
pEdcaParm->bValid = TRUE;
pEdcaParm->bQAck = FALSE; // pEid->Octet[0] & 0x10;
pEdcaParm->bQueueRequest = FALSE; // pEid->Octet[0] & 0x20;
pEdcaParm->bTxopRequest = FALSE; // pEid->Octet[0] & 0x40;
pEdcaParm->bQAck = FALSE; /* pEid->Octet[0] & 0x10; */
pEdcaParm->bQueueRequest = FALSE; /* pEid->Octet[0] & 0x20; */
pEdcaParm->bTxopRequest = FALSE; /* pEid->Octet[0] & 0x40; */
pEdcaParm->EdcaUpdateCount =
pEid->Octet[6] & 0x0f;
pEdcaParm->bAPSDCapable =
(pEid->Octet[6] & 0x80) ? 1 : 0;
ptr = &pEid->Octet[8];
for (i = 0; i < 4; i++) {
UCHAR aci = (*ptr & 0x60) >> 5; // b5~6 is AC INDEX
pEdcaParm->bACM[aci] = (((*ptr) & 0x10) == 0x10); // b5 is ACM
pEdcaParm->Aifsn[aci] = (*ptr) & 0x0f; // b0~3 is AIFSN
pEdcaParm->Cwmin[aci] = *(ptr + 1) & 0x0f; // b0~4 is Cwmin
pEdcaParm->Cwmax[aci] = *(ptr + 1) >> 4; // b5~8 is Cwmax
pEdcaParm->Txop[aci] = *(ptr + 2) + 256 * (*(ptr + 3)); // in unit of 32-us
ptr += 4; // point to next AC
UCHAR aci = (*ptr & 0x60) >> 5; /* b5~6 is AC INDEX */
pEdcaParm->bACM[aci] = (((*ptr) & 0x10) == 0x10); /* b5 is ACM */
pEdcaParm->Aifsn[aci] = (*ptr) & 0x0f; /* b0~3 is AIFSN */
pEdcaParm->Cwmin[aci] = *(ptr + 1) & 0x0f; /* b0~4 is Cwmin */
pEdcaParm->Cwmax[aci] = *(ptr + 1) >> 4; /* b5~8 is Cwmax */
pEdcaParm->Txop[aci] = *(ptr + 2) + 256 * (*(ptr + 3)); /* in unit of 32-us */
ptr += 4; /* point to next AC */
}
} else
if (NdisEqualMemory(pEid->Octet, WME_INFO_ELEM, 6)
&& (pEid->Len == 7)) {
// parsing EDCA parameters
/* parsing EDCA parameters */
pEdcaParm->bValid = TRUE;
pEdcaParm->bQAck = FALSE; // pEid->Octet[0] & 0x10;
pEdcaParm->bQueueRequest = FALSE; // pEid->Octet[0] & 0x20;
pEdcaParm->bTxopRequest = FALSE; // pEid->Octet[0] & 0x40;
pEdcaParm->bQAck = FALSE; /* pEid->Octet[0] & 0x10; */
pEdcaParm->bQueueRequest = FALSE; /* pEid->Octet[0] & 0x20; */
pEdcaParm->bTxopRequest = FALSE; /* pEid->Octet[0] & 0x40; */
pEdcaParm->EdcaUpdateCount =
pEid->Octet[6] & 0x0f;
pEdcaParm->bAPSDCapable =
(pEid->Octet[6] & 0x80) ? 1 : 0;
// use default EDCA parameter
/* use default EDCA parameter */
pEdcaParm->bACM[QID_AC_BE] = 0;
pEdcaParm->Aifsn[QID_AC_BE] = 3;
pEdcaParm->Cwmin[QID_AC_BE] = CW_MIN_IN_BITS;
@ -625,7 +625,7 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON
pEdcaParm->Cwmin[QID_AC_VI] =
CW_MIN_IN_BITS - 1;
pEdcaParm->Cwmax[QID_AC_VI] = CW_MAX_IN_BITS;
pEdcaParm->Txop[QID_AC_VI] = 96; // AC_VI: 96*32us ~= 3ms
pEdcaParm->Txop[QID_AC_VI] = 96; /* AC_VI: 96*32us ~= 3ms */
pEdcaParm->bACM[QID_AC_VO] = 0;
pEdcaParm->Aifsn[QID_AC_VO] = 2;
@ -633,7 +633,7 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON
CW_MIN_IN_BITS - 2;
pEdcaParm->Cwmax[QID_AC_VO] =
CW_MAX_IN_BITS - 1;
pEdcaParm->Txop[QID_AC_VO] = 48; // AC_VO: 48*32us ~= 1.5ms
pEdcaParm->Txop[QID_AC_VO] = 48; /* AC_VO: 48*32us ~= 1.5ms */
}
break;
@ -643,11 +643,11 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON
NdisMoveMemory(ExtRate, pEid->Octet, pEid->Len);
*pExtRateLen = pEid->Len;
// TODO: 2004-09-14 not a good design here, cause it exclude extra rates
// from ScanTab. We should report as is. And filter out unsupported
// rates in MlmeAux.
// Check against the supported rates
// RTMPCheckRates(pAd, ExtRate, pExtRateLen);
/* TODO: 2004-09-14 not a good design here, cause it exclude extra rates */
/* from ScanTab. We should report as is. And filter out unsupported */
/* rates in MlmeAux. */
/* Check against the supported rates */
/* RTMPCheckRates(pAd, ExtRate, pExtRateLen); */
}
break;
@ -658,32 +658,32 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON
break;
case IE_AIRONET_CKIP:
// 0. Check Aironet IE length, it must be larger or equal to 28
// Cisco AP350 used length as 28
// Cisco AP12XX used length as 30
/* 0. Check Aironet IE length, it must be larger or equal to 28 */
/* Cisco AP350 used length as 28 */
/* Cisco AP12XX used length as 30 */
if (pEid->Len < (CKIP_NEGOTIATION_LENGTH - 2))
break;
// 1. Copy CKIP flag byte to buffer for process
/* 1. Copy CKIP flag byte to buffer for process */
*pCkipFlag = *(pEid->Octet + 8);
break;
case IE_AP_TX_POWER:
// AP Control of Client Transmit Power
//0. Check Aironet IE length, it must be 6
/* AP Control of Client Transmit Power */
/*0. Check Aironet IE length, it must be 6 */
if (pEid->Len != 0x06)
break;
// Get cell power limit in dBm
/* Get cell power limit in dBm */
if (NdisEqualMemory(pEid->Octet, CISCO_OUI, 3) == 1)
*pAironetCellPowerLimit = *(pEid->Octet + 4);
break;
// WPA2 & 802.11i RSN
/* WPA2 & 802.11i RSN */
case IE_RSN:
// There is no OUI for version anymore, check the group cipher OUI before copying
/* There is no OUI for version anymore, check the group cipher OUI before copying */
if (RTMPEqualMemory(pEid->Octet + 2, RSN_OUI, 3)) {
// Copy to pVIE which will report to microsoft bssid list.
/* Copy to pVIE which will report to microsoft bssid list. */
Ptr = (PUCHAR) pVIE;
NdisMoveMemory(Ptr + *LengthVIE, &pEid->Eid,
pEid->Len + 2);
@ -695,11 +695,11 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON
break;
}
Length = Length + 2 + pEid->Len; // Eid[1] + Len[1]+ content[Len]
Length = Length + 2 + pEid->Len; /* Eid[1] + Len[1]+ content[Len] */
pEid = (PEID_STRUCT) ((UCHAR *) pEid + 2 + pEid->Len);
}
// For some 11a AP. it did not have the channel EID, patch here
/* For some 11a AP. it did not have the channel EID, patch here */
{
UCHAR LatchRfChannel = MsgChannel;
if ((pAd->LatchRfRegs.Channel > 14) && ((Sanity & 0x4) == 0)) {
@ -756,7 +756,7 @@ BOOLEAN MlmeScanReqSanity(IN PRTMP_ADAPTER pAd,
}
}
// IRQL = DISPATCH_LEVEL
/* IRQL = DISPATCH_LEVEL */
UCHAR ChannelSanity(IN PRTMP_ADAPTER pAd, IN UCHAR channel)
{
int i;
@ -897,9 +897,9 @@ BOOLEAN MlmeAssocReqSanity(IN PRTMP_ADAPTER pAd,
MLME_ASSOC_REQ_STRUCT *pInfo;
pInfo = (MLME_ASSOC_REQ_STRUCT *) Msg;
*pTimeout = pInfo->Timeout; // timeout
COPY_MAC_ADDR(pApAddr, pInfo->Addr); // AP address
*pCapabilityInfo = pInfo->CapabilityInfo; // capability info
*pTimeout = pInfo->Timeout; /* timeout */
COPY_MAC_ADDR(pApAddr, pInfo->Addr); /* AP address */
*pCapabilityInfo = pInfo->CapabilityInfo; /* capability info */
*pListenIntv = pInfo->ListenIntv;
return TRUE;
@ -954,36 +954,36 @@ NDIS_802_11_NETWORK_TYPE NetworkTypeInUseSanity(IN PBSS_ENTRY pBss)
NetWorkType = Ndis802_11DS;
if (pBss->Channel <= 14) {
//
// First check support Rate.
//
/* */
/* First check support Rate. */
/* */
for (i = 0; i < pBss->SupRateLen; i++) {
rate = pBss->SupRate[i] & 0x7f; // Mask out basic rate set bit
rate = pBss->SupRate[i] & 0x7f; /* Mask out basic rate set bit */
if ((rate == 2) || (rate == 4) || (rate == 11)
|| (rate == 22)) {
continue;
} else {
//
// Otherwise (even rate > 108) means Ndis802_11OFDM24
//
/* */
/* Otherwise (even rate > 108) means Ndis802_11OFDM24 */
/* */
NetWorkType = Ndis802_11OFDM24;
break;
}
}
//
// Second check Extend Rate.
//
/* */
/* Second check Extend Rate. */
/* */
if (NetWorkType != Ndis802_11OFDM24) {
for (i = 0; i < pBss->ExtRateLen; i++) {
rate = pBss->SupRate[i] & 0x7f; // Mask out basic rate set bit
rate = pBss->SupRate[i] & 0x7f; /* Mask out basic rate set bit */
if ((rate == 2) || (rate == 4) || (rate == 11)
|| (rate == 22)) {
continue;
} else {
//
// Otherwise (even rate > 108) means Ndis802_11OFDM24
//
/* */
/* Otherwise (even rate > 108) means Ndis802_11OFDM24 */
/* */
NetWorkType = Ndis802_11OFDM24;
break;
}
@ -1033,22 +1033,22 @@ BOOLEAN PeerWpaMessageSanity(IN PRTMP_ADAPTER pAd,
*((USHORT *) & EapolKeyInfo) = cpu2le16(*((USHORT *) & EapolKeyInfo));
// Choose WPA2 or not
/* Choose WPA2 or not */
if ((pEntry->AuthMode == Ndis802_11AuthModeWPA2)
|| (pEntry->AuthMode == Ndis802_11AuthModeWPA2PSK))
bWPA2 = TRUE;
// 0. Check MsgType
/* 0. Check MsgType */
if ((MsgType > EAPOL_GROUP_MSG_2) || (MsgType < EAPOL_PAIR_MSG_1)) {
DBGPRINT(RT_DEBUG_ERROR,
("The message type is invalid(%d)! \n", MsgType));
return FALSE;
}
// 1. Replay counter check
if (MsgType == EAPOL_PAIR_MSG_1 || MsgType == EAPOL_PAIR_MSG_3 || MsgType == EAPOL_GROUP_MSG_1) // For supplicant
/* 1. Replay counter check */
if (MsgType == EAPOL_PAIR_MSG_1 || MsgType == EAPOL_PAIR_MSG_3 || MsgType == EAPOL_GROUP_MSG_1) /* For supplicant */
{
// First validate replay counter, only accept message with larger replay counter.
// Let equal pass, some AP start with all zero replay counter
/* First validate replay counter, only accept message with larger replay counter. */
/* Let equal pass, some AP start with all zero replay counter */
UCHAR ZeroReplay[LEN_KEY_DESC_REPLAY];
NdisZeroMemory(ZeroReplay, LEN_KEY_DESC_REPLAY);
@ -1061,18 +1061,18 @@ BOOLEAN PeerWpaMessageSanity(IN PRTMP_ADAPTER pAd,
LEN_KEY_DESC_REPLAY) != 0)) {
bReplayDiff = TRUE;
}
} else if (MsgType == EAPOL_PAIR_MSG_2 || MsgType == EAPOL_PAIR_MSG_4 || MsgType == EAPOL_GROUP_MSG_2) // For authenticator
} else if (MsgType == EAPOL_PAIR_MSG_2 || MsgType == EAPOL_PAIR_MSG_4 || MsgType == EAPOL_GROUP_MSG_2) /* For authenticator */
{
// check Replay Counter coresponds to MSG from authenticator, otherwise discard
/* check Replay Counter coresponds to MSG from authenticator, otherwise discard */
if (!NdisEqualMemory
(pMsg->KeyDesc.ReplayCounter, pEntry->R_Counter,
LEN_KEY_DESC_REPLAY)) {
bReplayDiff = TRUE;
}
}
// Replay Counter different condition
/* Replay Counter different condition */
if (bReplayDiff) {
// send wireless event - for replay counter different
/* send wireless event - for replay counter different */
if (pAd->CommonCfg.bWirelessEvent)
RTMPSendWirelessEvent(pAd,
IW_REPLAY_COUNTER_DIFF_EVENT_FLAG,
@ -1094,20 +1094,20 @@ BOOLEAN PeerWpaMessageSanity(IN PRTMP_ADAPTER pAd,
LEN_KEY_DESC_REPLAY);
return FALSE;
}
// 2. Verify MIC except Pairwise Msg1
/* 2. Verify MIC except Pairwise Msg1 */
if (MsgType != EAPOL_PAIR_MSG_1) {
UCHAR rcvd_mic[LEN_KEY_DESC_MIC];
// Record the received MIC for check later
/* Record the received MIC for check later */
NdisMoveMemory(rcvd_mic, pMsg->KeyDesc.KeyMic,
LEN_KEY_DESC_MIC);
NdisZeroMemory(pMsg->KeyDesc.KeyMic, LEN_KEY_DESC_MIC);
if (EapolKeyInfo.KeyDescVer == DESC_TYPE_TKIP) // TKIP
if (EapolKeyInfo.KeyDescVer == DESC_TYPE_TKIP) /* TKIP */
{
HMAC_MD5(pEntry->PTK, LEN_EAP_MICK, (PUCHAR) pMsg,
MsgLen, mic, MD5_DIGEST_SIZE);
} else if (EapolKeyInfo.KeyDescVer == DESC_TYPE_AES) // AES
} else if (EapolKeyInfo.KeyDescVer == DESC_TYPE_AES) /* AES */
{
HMAC_SHA1(pEntry->PTK, LEN_EAP_MICK, (PUCHAR) pMsg,
MsgLen, digest, SHA1_DIGEST_SIZE);
@ -1115,7 +1115,7 @@ BOOLEAN PeerWpaMessageSanity(IN PRTMP_ADAPTER pAd,
}
if (!NdisEqualMemory(rcvd_mic, mic, LEN_KEY_DESC_MIC)) {
// send wireless event - for MIC different
/* send wireless event - for MIC different */
if (pAd->CommonCfg.bWirelessEvent)
RTMPSendWirelessEvent(pAd,
IW_MIC_DIFF_EVENT_FLAG,
@ -1138,16 +1138,16 @@ BOOLEAN PeerWpaMessageSanity(IN PRTMP_ADAPTER pAd,
return FALSE;
}
}
// 1. Decrypt the Key Data field if GTK is included.
// 2. Extract the context of the Key Data field if it exist.
// The field in pairwise_msg_2_WPA1(WPA2) & pairwise_msg_3_WPA1 is clear.
// The field in group_msg_1_WPA1(WPA2) & pairwise_msg_3_WPA2 is encrypted.
/* 1. Decrypt the Key Data field if GTK is included. */
/* 2. Extract the context of the Key Data field if it exist. */
/* The field in pairwise_msg_2_WPA1(WPA2) & pairwise_msg_3_WPA1 is clear. */
/* The field in group_msg_1_WPA1(WPA2) & pairwise_msg_3_WPA2 is encrypted. */
if (CONV_ARRARY_TO_UINT16(pMsg->KeyDesc.KeyDataLen) > 0) {
// Decrypt this field
/* Decrypt this field */
if ((MsgType == EAPOL_PAIR_MSG_3 && bWPA2)
|| (MsgType == EAPOL_GROUP_MSG_1)) {
if ((EapolKeyInfo.KeyDescVer == DESC_TYPE_AES)) {
// AES
/* AES */
AES_GTK_KEY_UNWRAP(&pEntry->PTK[16], KEYDATA,
CONV_ARRARY_TO_UINT16(pMsg->
KeyDesc.
@ -1156,17 +1156,17 @@ BOOLEAN PeerWpaMessageSanity(IN PRTMP_ADAPTER pAd,
} else {
INT i;
UCHAR Key[32];
// Decrypt TKIP GTK
// Construct 32 bytes RC4 Key
/* Decrypt TKIP GTK */
/* Construct 32 bytes RC4 Key */
NdisMoveMemory(Key, pMsg->KeyDesc.KeyIv, 16);
NdisMoveMemory(&Key[16], &pEntry->PTK[16], 16);
ARCFOUR_INIT(&pAd->PrivateInfo.WEPCONTEXT, Key,
32);
//discard first 256 bytes
/*discard first 256 bytes */
for (i = 0; i < 256; i++)
ARCFOUR_BYTE(&pAd->PrivateInfo.
WEPCONTEXT);
// Decrypt GTK. Becareful, there is no ICV to check the result is correct or not
/* Decrypt GTK. Becareful, there is no ICV to check the result is correct or not */
ARCFOUR_DECRYPT(&pAd->PrivateInfo.WEPCONTEXT,
KEYDATA, pMsg->KeyDesc.KeyData,
CONV_ARRARY_TO_UINT16(pMsg->
@ -1187,10 +1187,10 @@ BOOLEAN PeerWpaMessageSanity(IN PRTMP_ADAPTER pAd,
return TRUE;
}
// Parse Key Data field to
// 1. verify RSN IE for pairwise_msg_2_WPA1(WPA2) ,pairwise_msg_3_WPA1(WPA2)
// 2. verify KDE format for pairwise_msg_3_WPA2, group_msg_1_WPA2
// 3. update shared key for pairwise_msg_3_WPA2, group_msg_1_WPA1(WPA2)
/* Parse Key Data field to */
/* 1. verify RSN IE for pairwise_msg_2_WPA1(WPA2) ,pairwise_msg_3_WPA1(WPA2) */
/* 2. verify KDE format for pairwise_msg_3_WPA2, group_msg_1_WPA2 */
/* 3. update shared key for pairwise_msg_3_WPA2, group_msg_1_WPA1(WPA2) */
if (!RTMPParseEapolKeyData(pAd, KEYDATA,
CONV_ARRARY_TO_UINT16(pMsg->KeyDesc.
KeyDataLen),

View file

@ -36,27 +36,27 @@
*/
#include "../rt_config.h"
// 2.4 Ghz channel plan index in the TxPower arrays.
#define BG_BAND_REGION_0_START 0 // 1,2,3,4,5,6,7,8,9,10,11
/* 2.4 Ghz channel plan index in the TxPower arrays. */
#define BG_BAND_REGION_0_START 0 /* 1,2,3,4,5,6,7,8,9,10,11 */
#define BG_BAND_REGION_0_SIZE 11
#define BG_BAND_REGION_1_START 0 // 1,2,3,4,5,6,7,8,9,10,11,12,13
#define BG_BAND_REGION_1_START 0 /* 1,2,3,4,5,6,7,8,9,10,11,12,13 */
#define BG_BAND_REGION_1_SIZE 13
#define BG_BAND_REGION_2_START 9 // 10,11
#define BG_BAND_REGION_2_START 9 /* 10,11 */
#define BG_BAND_REGION_2_SIZE 2
#define BG_BAND_REGION_3_START 9 // 10,11,12,13
#define BG_BAND_REGION_3_START 9 /* 10,11,12,13 */
#define BG_BAND_REGION_3_SIZE 4
#define BG_BAND_REGION_4_START 13 // 14
#define BG_BAND_REGION_4_START 13 /* 14 */
#define BG_BAND_REGION_4_SIZE 1
#define BG_BAND_REGION_5_START 0 // 1,2,3,4,5,6,7,8,9,10,11,12,13,14
#define BG_BAND_REGION_5_START 0 /* 1,2,3,4,5,6,7,8,9,10,11,12,13,14 */
#define BG_BAND_REGION_5_SIZE 14
#define BG_BAND_REGION_6_START 2 // 3,4,5,6,7,8,9
#define BG_BAND_REGION_6_START 2 /* 3,4,5,6,7,8,9 */
#define BG_BAND_REGION_6_SIZE 7
#define BG_BAND_REGION_7_START 4 // 5,6,7,8,9,10,11,12,13
#define BG_BAND_REGION_7_START 4 /* 5,6,7,8,9,10,11,12,13 */
#define BG_BAND_REGION_7_SIZE 9
#define BG_BAND_REGION_31_START 0 // 1,2,3,4,5,6,7,8,9,10,11,12,13,14
#define BG_BAND_REGION_31_START 0 /* 1,2,3,4,5,6,7,8,9,10,11,12,13,14 */
#define BG_BAND_REGION_31_SIZE 14
// 5 Ghz channel plan index in the TxPower arrays.
/* 5 Ghz channel plan index in the TxPower arrays. */
UCHAR A_BAND_REGION_0_CHANNEL_LIST[] =
{ 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165 };
UCHAR A_BAND_REGION_1_CHANNEL_LIST[] =
@ -90,7 +90,7 @@ UCHAR A_BAND_REGION_14_CHANNEL_LIST[] =
153, 157, 161, 165 };
UCHAR A_BAND_REGION_15_CHANNEL_LIST[] = { 149, 153, 157, 161, 165, 169, 173 };
//BaSizeArray follows the 802.11n definition as MaxRxFactor. 2^(13+factor) bytes. When factor =0, it's about Ba buffer size =8.
/*BaSizeArray follows the 802.11n definition as MaxRxFactor. 2^(13+factor) bytes. When factor =0, it's about Ba buffer size =8. */
UCHAR BaSizeArray[4] = { 8, 16, 32, 64 };
/*
@ -113,76 +113,76 @@ VOID BuildChannelList(IN PRTMP_ADAPTER pAd)
NdisZeroMemory(pAd->ChannelList,
MAX_NUM_OF_CHANNELS * sizeof(CHANNEL_TX_POWER));
// if not 11a-only mode, channel list starts from 2.4Ghz band
/* if not 11a-only mode, channel list starts from 2.4Ghz band */
if ((pAd->CommonCfg.PhyMode != PHY_11A)
&& (pAd->CommonCfg.PhyMode != PHY_11AN_MIXED)
&& (pAd->CommonCfg.PhyMode != PHY_11N_5G)
) {
switch (pAd->CommonCfg.CountryRegion & 0x7f) {
case REGION_0_BG_BAND: // 1 -11
case REGION_0_BG_BAND: /* 1 -11 */
NdisMoveMemory(&pAd->ChannelList[index],
&pAd->TxPower[BG_BAND_REGION_0_START],
sizeof(CHANNEL_TX_POWER) *
BG_BAND_REGION_0_SIZE);
index += BG_BAND_REGION_0_SIZE;
break;
case REGION_1_BG_BAND: // 1 - 13
case REGION_1_BG_BAND: /* 1 - 13 */
NdisMoveMemory(&pAd->ChannelList[index],
&pAd->TxPower[BG_BAND_REGION_1_START],
sizeof(CHANNEL_TX_POWER) *
BG_BAND_REGION_1_SIZE);
index += BG_BAND_REGION_1_SIZE;
break;
case REGION_2_BG_BAND: // 10 - 11
case REGION_2_BG_BAND: /* 10 - 11 */
NdisMoveMemory(&pAd->ChannelList[index],
&pAd->TxPower[BG_BAND_REGION_2_START],
sizeof(CHANNEL_TX_POWER) *
BG_BAND_REGION_2_SIZE);
index += BG_BAND_REGION_2_SIZE;
break;
case REGION_3_BG_BAND: // 10 - 13
case REGION_3_BG_BAND: /* 10 - 13 */
NdisMoveMemory(&pAd->ChannelList[index],
&pAd->TxPower[BG_BAND_REGION_3_START],
sizeof(CHANNEL_TX_POWER) *
BG_BAND_REGION_3_SIZE);
index += BG_BAND_REGION_3_SIZE;
break;
case REGION_4_BG_BAND: // 14
case REGION_4_BG_BAND: /* 14 */
NdisMoveMemory(&pAd->ChannelList[index],
&pAd->TxPower[BG_BAND_REGION_4_START],
sizeof(CHANNEL_TX_POWER) *
BG_BAND_REGION_4_SIZE);
index += BG_BAND_REGION_4_SIZE;
break;
case REGION_5_BG_BAND: // 1 - 14
case REGION_5_BG_BAND: /* 1 - 14 */
NdisMoveMemory(&pAd->ChannelList[index],
&pAd->TxPower[BG_BAND_REGION_5_START],
sizeof(CHANNEL_TX_POWER) *
BG_BAND_REGION_5_SIZE);
index += BG_BAND_REGION_5_SIZE;
break;
case REGION_6_BG_BAND: // 3 - 9
case REGION_6_BG_BAND: /* 3 - 9 */
NdisMoveMemory(&pAd->ChannelList[index],
&pAd->TxPower[BG_BAND_REGION_6_START],
sizeof(CHANNEL_TX_POWER) *
BG_BAND_REGION_6_SIZE);
index += BG_BAND_REGION_6_SIZE;
break;
case REGION_7_BG_BAND: // 5 - 13
case REGION_7_BG_BAND: /* 5 - 13 */
NdisMoveMemory(&pAd->ChannelList[index],
&pAd->TxPower[BG_BAND_REGION_7_START],
sizeof(CHANNEL_TX_POWER) *
BG_BAND_REGION_7_SIZE);
index += BG_BAND_REGION_7_SIZE;
break;
case REGION_31_BG_BAND: // 1 - 14
case REGION_31_BG_BAND: /* 1 - 14 */
NdisMoveMemory(&pAd->ChannelList[index],
&pAd->TxPower[BG_BAND_REGION_31_START],
sizeof(CHANNEL_TX_POWER) *
BG_BAND_REGION_31_SIZE);
index += BG_BAND_REGION_31_SIZE;
break;
default: // Error. should never happen
default: /* Error. should never happen */
break;
}
for (i = 0; i < index; i++)
@ -295,7 +295,7 @@ VOID BuildChannelList(IN PRTMP_ADAPTER pAd)
sizeof(UCHAR);
pChannelList = A_BAND_REGION_15_CHANNEL_LIST;
break;
default: // Error. should never happen
default: /* Error. should never happen */
DBGPRINT(RT_DEBUG_WARN,
("countryregion=%d not support",
pAd->CommonCfg.CountryRegionForABand));
@ -411,12 +411,12 @@ UCHAR NextChannel(IN PRTMP_ADAPTER pAd, IN UCHAR channel)
VOID ChangeToCellPowerLimit(IN PRTMP_ADAPTER pAd,
IN UCHAR AironetCellPowerLimit)
{
//valud 0xFF means that hasn't found power limit information
//from the AP's Beacon/Probe response.
/*valud 0xFF means that hasn't found power limit information */
/*from the AP's Beacon/Probe response. */
if (AironetCellPowerLimit == 0xFF)
return;
if (AironetCellPowerLimit < 6) //Used Lowest Power Percentage.
if (AironetCellPowerLimit < 6) /*Used Lowest Power Percentage. */
pAd->CommonCfg.TxPowerPercentage = 6;
else if (AironetCellPowerLimit < 9)
pAd->CommonCfg.TxPowerPercentage = 10;
@ -427,7 +427,7 @@ VOID ChangeToCellPowerLimit(IN PRTMP_ADAPTER pAd,
else if (AironetCellPowerLimit < 15)
pAd->CommonCfg.TxPowerPercentage = 75;
else
pAd->CommonCfg.TxPowerPercentage = 100; //else used maximum
pAd->CommonCfg.TxPowerPercentage = 100; /*else used maximum */
if (pAd->CommonCfg.TxPowerPercentage > pAd->CommonCfg.TxPowerDefault)
pAd->CommonCfg.TxPowerPercentage =
@ -439,7 +439,7 @@ CHAR ConvertToRssi(IN PRTMP_ADAPTER pAd, IN CHAR Rssi, IN UCHAR RssiNumber)
{
UCHAR RssiOffset, LNAGain;
// Rssi equals to zero should be an invalid value
/* Rssi equals to zero should be an invalid value */
if (Rssi == 0)
return -99;
@ -510,11 +510,11 @@ VOID ScanNextChannel(IN PRTMP_ADAPTER pAd)
}
{
//
// To prevent data lost.
// Send an NULL data with turned PSM bit on to current associated AP before SCAN progress.
// Now, we need to send an NULL data with turned PSM bit off to AP, when scan progress done
//
/* */
/* To prevent data lost. */
/* Send an NULL data with turned PSM bit on to current associated AP before SCAN progress. */
/* Now, we need to send an NULL data with turned PSM bit off to AP, when scan progress done */
/* */
if (OPSTATUS_TEST_FLAG
(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)
&& (INFRA_ON(pAd))) {
@ -532,7 +532,7 @@ VOID ScanNextChannel(IN PRTMP_ADAPTER pAd)
pHdr80211->FC.PwrMgmt =
(pAd->StaCfg.Psm == PWR_SAVE);
// Send using priority queue
/* Send using priority queue */
MiniportMMRequest(pAd, 0, pOutBuffer,
sizeof
(HEADER_802_11));
@ -557,14 +557,14 @@ VOID ScanNextChannel(IN PRTMP_ADAPTER pAd)
pAd->Mlme.SyncMachine.CurrState = SYNC_IDLE;
MlmeCntlConfirm(pAd, MT2_SCAN_CONF, MLME_FAIL_NO_RESOURCE);
}
#endif // RTMP_MAC_USB //
#endif /* RTMP_MAC_USB // */
else {
{
// BBP and RF are not accessible in PS mode, we has to wake them up first
/* BBP and RF are not accessible in PS mode, we has to wake them up first */
if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE))
AsicForceWakeup(pAd, TRUE);
// leave PSM during scanning. otherwise we may lost ProbeRsp & BEACON
/* leave PSM during scanning. otherwise we may lost ProbeRsp & BEACON */
if (pAd->StaCfg.Psm == PWR_SAVE)
RTMP_SET_PSM_BIT(pAd, PWR_ACTIVE);
}
@ -584,18 +584,18 @@ VOID ScanNextChannel(IN PRTMP_ADAPTER pAd)
}
}
//Global country domain(ch1-11:active scan, ch12-14 passive scan)
/*Global country domain(ch1-11:active scan, ch12-14 passive scan) */
if ((pAd->MlmeAux.Channel <= 14) && (pAd->MlmeAux.Channel >= 12)
&& ((pAd->CommonCfg.CountryRegion & 0x7f) ==
REGION_31_BG_BAND)) {
ScanType = SCAN_PASSIVE;
}
// We need to shorten active scan time in order for WZC connect issue
// Chnage the channel scan time for CISCO stuff based on its IAPP announcement
/* We need to shorten active scan time in order for WZC connect issue */
/* Chnage the channel scan time for CISCO stuff based on its IAPP announcement */
if (ScanType == FAST_SCAN_ACTIVE)
RTMPSetTimer(&pAd->MlmeAux.ScanTimer,
FAST_ACTIVE_SCAN_TIME);
else // must be SCAN_PASSIVE or SCAN_ACTIVE
else /* must be SCAN_PASSIVE or SCAN_ACTIVE */
{
if ((pAd->CommonCfg.PhyMode == PHY_11ABG_MIXED)
|| (pAd->CommonCfg.PhyMode == PHY_11ABGN_MIXED)
@ -615,7 +615,7 @@ VOID ScanNextChannel(IN PRTMP_ADAPTER pAd)
if ((ScanType == SCAN_ACTIVE)
|| (ScanType == FAST_SCAN_ACTIVE)
) {
NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory
NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); /*Get an unused nonpaged memory */
if (NStatus != NDIS_STATUS_SUCCESS) {
DBGPRINT(RT_DEBUG_TRACE,
("SYNC - ScanNextChannel() allocate memory fail\n"));
@ -631,7 +631,7 @@ VOID ScanNextChannel(IN PRTMP_ADAPTER pAd)
return;
}
// There is no need to send broadcast probe request if active scan is in effect.
/* There is no need to send broadcast probe request if active scan is in effect. */
if ((ScanType == SCAN_ACTIVE)
|| (ScanType == FAST_SCAN_ACTIVE)
)
@ -694,7 +694,7 @@ VOID ScanNextChannel(IN PRTMP_ADAPTER pAd)
MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen);
MlmeFreeMemory(pAd, pOutBuffer);
}
// For SCAN_CISCO_PASSIVE, do nothing and silently wait for beacon or other probe reponse
/* For SCAN_CISCO_PASSIVE, do nothing and silently wait for beacon or other probe reponse */
pAd->Mlme.SyncMachine.CurrState = SCAN_LISTEN;
}

View file

@ -37,7 +37,7 @@
#include "../rt_config.h"
// Rotation functions on 32 bit values
/* Rotation functions on 32 bit values */
#define ROL32( A, n ) \
( ((A) << (n)) | ( ((A)>>(32-(n))) & ( (1UL << (n)) - 1 ) ) )
#define ROR32( A, n ) ROL32( (A), 32-(n) )
@ -112,9 +112,9 @@ UINT Tkip_Sbox_Upper[256] = {
0x82, 0x29, 0x5A, 0x1E, 0x7B, 0xA8, 0x6D, 0x2C
};
//
// Expanded IV for TKIP function.
//
/* */
/* Expanded IV for TKIP function. */
/* */
typedef struct PACKED _IV_CONTROL_ {
union PACKED {
struct PACKED {
@ -216,10 +216,10 @@ VOID RTMPTkipPutUInt32(IN OUT PUCHAR pDst, IN ULONG val)
*/
VOID RTMPTkipSetMICKey(IN PTKIP_KEY_INFO pTkip, IN PUCHAR pMICKey)
{
// Set the key
/* Set the key */
pTkip->K0 = RTMPTkipGetUInt32(pMICKey);
pTkip->K1 = RTMPTkipGetUInt32(pMICKey + 4);
// and reset the message
/* and reset the message */
pTkip->L = pTkip->K0;
pTkip->R = pTkip->K1;
pTkip->nBytesInM = 0;
@ -247,10 +247,10 @@ VOID RTMPTkipSetMICKey(IN PTKIP_KEY_INFO pTkip, IN PUCHAR pMICKey)
*/
VOID RTMPTkipAppendByte(IN PTKIP_KEY_INFO pTkip, IN UCHAR uChar)
{
// Append the byte to our word-sized buffer
/* Append the byte to our word-sized buffer */
pTkip->M |= (uChar << (8 * pTkip->nBytesInM));
pTkip->nBytesInM++;
// Process the word if it is full.
/* Process the word if it is full. */
if (pTkip->nBytesInM >= 4) {
pTkip->L ^= pTkip->M;
pTkip->R ^= ROL32(pTkip->L, 17);
@ -263,7 +263,7 @@ VOID RTMPTkipAppendByte(IN PTKIP_KEY_INFO pTkip, IN UCHAR uChar)
pTkip->L += pTkip->R;
pTkip->R ^= ROR32(pTkip->L, 2);
pTkip->L += pTkip->R;
// Clear the buffer
/* Clear the buffer */
pTkip->M = 0;
pTkip->nBytesInM = 0;
}
@ -291,7 +291,7 @@ VOID RTMPTkipAppendByte(IN PTKIP_KEY_INFO pTkip, IN UCHAR uChar)
*/
VOID RTMPTkipAppend(IN PTKIP_KEY_INFO pTkip, IN PUCHAR pSrc, IN UINT nBytes)
{
// This is simple
/* This is simple */
while (nBytes > 0) {
RTMPTkipAppendByte(pTkip, *pSrc++);
nBytes--;
@ -318,17 +318,17 @@ VOID RTMPTkipAppend(IN PTKIP_KEY_INFO pTkip, IN PUCHAR pSrc, IN UINT nBytes)
*/
VOID RTMPTkipGetMIC(IN PTKIP_KEY_INFO pTkip)
{
// Append the minimum padding
/* Append the minimum padding */
RTMPTkipAppendByte(pTkip, 0x5a);
RTMPTkipAppendByte(pTkip, 0);
RTMPTkipAppendByte(pTkip, 0);
RTMPTkipAppendByte(pTkip, 0);
RTMPTkipAppendByte(pTkip, 0);
// and then zeroes until the length is a multiple of 4
/* and then zeroes until the length is a multiple of 4 */
while (pTkip->nBytesInM != 0) {
RTMPTkipAppendByte(pTkip, 0);
}
// The appendByte function has already computed the result.
/* The appendByte function has already computed the result. */
RTMPTkipPutUInt32(pTkip->MIC, pTkip->L);
RTMPTkipPutUInt32(pTkip->MIC + 4, pTkip->R);
}
@ -364,15 +364,15 @@ VOID RTMPInitTkipEngine(IN PRTMP_ADAPTER pAd,
{
TKIP_IV tkipIv;
// Prepare 8 bytes TKIP encapsulation for MPDU
/* Prepare 8 bytes TKIP encapsulation for MPDU */
NdisZeroMemory(&tkipIv, sizeof(TKIP_IV));
tkipIv.IV16.field.rc0 = *(pTSC + 1);
tkipIv.IV16.field.rc1 = (tkipIv.IV16.field.rc0 | 0x20) & 0x7f;
tkipIv.IV16.field.rc2 = *pTSC;
tkipIv.IV16.field.CONTROL.field.ExtIV = 1; // 0: non-extended IV, 1: an extended IV
tkipIv.IV16.field.CONTROL.field.ExtIV = 1; /* 0: non-extended IV, 1: an extended IV */
tkipIv.IV16.field.CONTROL.field.KeyID = KeyId;
// tkipIv.IV32 = *(PULONG)(pTSC + 2);
NdisMoveMemory(&tkipIv.IV32, (pTSC + 2), 4); // Copy IV
/* tkipIv.IV32 = *(PULONG)(pTSC + 2); */
NdisMoveMemory(&tkipIv.IV32, (pTSC + 2), 4); /* Copy IV */
*pIV16 = tkipIv.IV16.word;
*pIV32 = tkipIv.IV32;
@ -406,13 +406,13 @@ VOID RTMPInitMICEngine(IN PRTMP_ADAPTER pAd,
{
ULONG Priority = UserPriority;
// Init MIC value calculation
/* Init MIC value calculation */
RTMPTkipSetMICKey(&pAd->PrivateInfo.Tx, pMICKey);
// DA
/* DA */
RTMPTkipAppend(&pAd->PrivateInfo.Tx, pDA, MAC_ADDR_LEN);
// SA
/* SA */
RTMPTkipAppend(&pAd->PrivateInfo.Tx, pSA, MAC_ADDR_LEN);
// Priority + 3 bytes of 0
/* Priority + 3 bytes of 0 */
RTMPTkipAppend(&pAd->PrivateInfo.Tx, (PUCHAR) & Priority, 4);
}
@ -450,28 +450,28 @@ BOOLEAN RTMPTkipCompareMICValue(IN PRTMP_ADAPTER pAd,
UCHAR OldMic[8];
ULONG Priority = UserPriority;
// Init MIC value calculation
/* Init MIC value calculation */
RTMPTkipSetMICKey(&pAd->PrivateInfo.Rx, pMICKey);
// DA
/* DA */
RTMPTkipAppend(&pAd->PrivateInfo.Rx, pDA, MAC_ADDR_LEN);
// SA
/* SA */
RTMPTkipAppend(&pAd->PrivateInfo.Rx, pSA, MAC_ADDR_LEN);
// Priority + 3 bytes of 0
/* Priority + 3 bytes of 0 */
RTMPTkipAppend(&pAd->PrivateInfo.Rx, (PUCHAR) & Priority, 4);
// Calculate MIC value from plain text data
/* Calculate MIC value from plain text data */
RTMPTkipAppend(&pAd->PrivateInfo.Rx, pSrc, Len);
// Get MIC valude from received frame
/* Get MIC valude from received frame */
NdisMoveMemory(OldMic, pSrc + Len, 8);
// Get MIC value from decrypted plain data
/* Get MIC value from decrypted plain data */
RTMPTkipGetMIC(&pAd->PrivateInfo.Rx);
// Move MIC value from MSDU, this steps should move to data path.
// Since the MIC value might cross MPDUs.
/* Move MIC value from MSDU, this steps should move to data path. */
/* Since the MIC value might cross MPDUs. */
if (!NdisEqualMemory(pAd->PrivateInfo.Rx.MIC, OldMic, 8)) {
DBGPRINT_RAW(RT_DEBUG_ERROR, ("RTMPTkipCompareMICValue(): TKIP MIC Error !\n")); //MIC error.
DBGPRINT_RAW(RT_DEBUG_ERROR, ("RTMPTkipCompareMICValue(): TKIP MIC Error !\n")); /*MIC error. */
return (FALSE);
}
@ -517,7 +517,7 @@ VOID RTMPCalculateMICValue(IN PRTMP_ADAPTER pAd,
UserPriority = RTMP_GET_PACKET_UP(pPacket);
pSrc = pSrcBufVA;
// determine if this is a vlan packet
/* determine if this is a vlan packet */
if (((*(pSrc + 12) << 8) + *(pSrc + 13)) == 0x8100)
vlan_offset = 4;
@ -528,9 +528,9 @@ VOID RTMPCalculateMICValue(IN PRTMP_ADAPTER pAd,
}
if (pEncap != NULL) {
// LLC encapsulation
/* LLC encapsulation */
RTMPTkipAppend(&pAd->PrivateInfo.Tx, pEncap, 6);
// Protocol Type
/* Protocol Type */
RTMPTkipAppend(&pAd->PrivateInfo.Tx, pSrc + 12 + vlan_offset,
2);
}
@ -541,11 +541,11 @@ VOID RTMPCalculateMICValue(IN PRTMP_ADAPTER pAd,
RTMPTkipAppend(&pAd->PrivateInfo.Tx, pSrc, SrcBufLen);
}
break; // No need handle next packet
break; /* No need handle next packet */
} while (TRUE); // End of copying payload
} while (TRUE); /* End of copying payload */
// Compute the final MIC Value
/* Compute the final MIC Value */
RTMPTkipGetMIC(&pAd->PrivateInfo.Tx);
}
@ -694,10 +694,10 @@ VOID RTMPTkipMixKey(UCHAR * key, UCHAR * ta, ULONG pnl, /* Least significant 16
rc4key[15] = (ppk5 >> 8) % 256;
}
//
// TRUE: Success!
// FALSE: Decrypt Error!
//
/* */
/* TRUE: Success! */
/* FALSE: Decrypt Error! */
/* */
BOOLEAN RTMPSoftDecryptTKIP(IN PRTMP_ADAPTER pAd,
IN PUCHAR pData,
IN ULONG DataByteCnt,
@ -721,7 +721,7 @@ BOOLEAN RTMPSoftDecryptTKIP(IN PRTMP_ADAPTER pAd,
UCHAR DA[MAC_ADDR_LEN];
UCHAR SA[MAC_ADDR_LEN];
UCHAR RC4Key[16];
UINT p1k[5]; //for mix_key;
UINT p1k[5]; /*for mix_key; */
ULONG pnl; /* Least significant 16 bits of PN */
ULONG pnh; /* Most significant 32 bits of PN */
UINT num_blocks;
@ -778,7 +778,7 @@ BOOLEAN RTMPSoftDecryptTKIP(IN PRTMP_ADAPTER pAd,
if (to_ds == 0 && from_ds == 1) {
NdisMoveMemory(DA, pData + 4, MAC_ADDR_LEN);
NdisMoveMemory(SA, pData + 16, MAC_ADDR_LEN);
NdisMoveMemory(TA, pData + 10, MAC_ADDR_LEN); //BSSID
NdisMoveMemory(TA, pData + 10, MAC_ADDR_LEN); /*BSSID */
} else if (to_ds == 0 && from_ds == 0) {
NdisMoveMemory(TA, pData + 10, MAC_ADDR_LEN);
NdisMoveMemory(DA, pData + 4, MAC_ADDR_LEN);
@ -806,11 +806,11 @@ BOOLEAN RTMPSoftDecryptTKIP(IN PRTMP_ADAPTER pAd,
ARCFOUR_DECRYPT(&ArcFourContext, pData + HeaderLen,
pData + HeaderLen + 8, DataByteCnt - HeaderLen - 8);
NdisMoveMemory(&trailfcs, pData + DataByteCnt - 8 - 4, 4);
crc32 = RTMP_CALC_FCS32(PPPINITFCS32, pData + HeaderLen, DataByteCnt - HeaderLen - 8 - 4); //Skip IV+EIV 8 bytes & Skip last 4 bytes(FCS).
crc32 = RTMP_CALC_FCS32(PPPINITFCS32, pData + HeaderLen, DataByteCnt - HeaderLen - 8 - 4); /*Skip IV+EIV 8 bytes & Skip last 4 bytes(FCS). */
crc32 ^= 0xffffffff; /* complement */
if (crc32 != cpu2le32(trailfcs)) {
DBGPRINT(RT_DEBUG_TRACE, ("RTMPSoftDecryptTKIP, WEP Data ICV Error !\n")); //ICV error.
DBGPRINT(RT_DEBUG_TRACE, ("RTMPSoftDecryptTKIP, WEP Data ICV Error !\n")); /*ICV error. */
return (FALSE);
}
@ -824,10 +824,10 @@ BOOLEAN RTMPSoftDecryptTKIP(IN PRTMP_ADAPTER pAd,
NdisMoveMemory(MIC, pAd->PrivateInfo.Tx.MIC, 8);
if (!NdisEqualMemory(MIC, TrailMIC, 8)) {
DBGPRINT(RT_DEBUG_ERROR, ("RTMPSoftDecryptTKIP, WEP Data MIC Error !\n")); //MIC error.
//RTMPReportMicError(pAd, &pWpaKey[KeyID]); // marked by AlbertY @ 20060630
DBGPRINT(RT_DEBUG_ERROR, ("RTMPSoftDecryptTKIP, WEP Data MIC Error !\n")); /*MIC error. */
/*RTMPReportMicError(pAd, &pWpaKey[KeyID]); // marked by AlbertY @ 20060630 */
return (FALSE);
}
//DBGPRINT(RT_DEBUG_TRACE, "RTMPSoftDecryptTKIP Decript done!!\n");
/*DBGPRINT(RT_DEBUG_TRACE, "RTMPSoftDecryptTKIP Decript done!!\n"); */
return TRUE;
}

View file

@ -141,25 +141,25 @@ VOID RTMPInitWepEngine(IN PRTMP_ADAPTER pAd,
{
UINT i;
UCHAR WEPKEY[] = {
//IV
/*IV */
0x00, 0x11, 0x22,
//WEP KEY
/*WEP KEY */
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99,
0xAA, 0xBB, 0xCC
};
pAd->PrivateInfo.FCSCRC32 = PPPINITFCS32; //Init crc32.
pAd->PrivateInfo.FCSCRC32 = PPPINITFCS32; /*Init crc32. */
{
NdisMoveMemory(WEPKEY + 3, pKey, KeyLen);
for (i = 0; i < 3; i++)
WEPKEY[i] = RandomByte(pAd); //Call mlme RandomByte() function.
ARCFOUR_INIT(&pAd->PrivateInfo.WEPCONTEXT, WEPKEY, KeyLen + 3); //INIT SBOX, KEYLEN+3(IV)
WEPKEY[i] = RandomByte(pAd); /*Call mlme RandomByte() function. */
ARCFOUR_INIT(&pAd->PrivateInfo.WEPCONTEXT, WEPKEY, KeyLen + 3); /*INIT SBOX, KEYLEN+3(IV) */
NdisMoveMemory(pDest, WEPKEY, 3); //Append Init Vector
NdisMoveMemory(pDest, WEPKEY, 3); /*Append Init Vector */
}
*(pDest + 3) = (KeyId << 6); //Append KEYID
*(pDest + 3) = (KeyId << 6); /*Append KEYID */
}
@ -219,16 +219,16 @@ BOOLEAN RTMPSoftDecryptWEP(IN PRTMP_ADAPTER pAd,
UINT crc32;
UCHAR KeyIdx;
UCHAR WEPKEY[] = {
//IV
/*IV */
0x00, 0x11, 0x22,
//WEP KEY
/*WEP KEY */
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99,
0xAA, 0xBB, 0xCC
};
UCHAR *pPayload = (UCHAR *) pData + LENGTH_802_11;
ULONG payload_len = DataByteCnt - LENGTH_802_11;
NdisMoveMemory(WEPKEY, pPayload, 3); //Get WEP IV
NdisMoveMemory(WEPKEY, pPayload, 3); /*Get WEP IV */
KeyIdx = (*(pPayload + 3) & 0xc0) >> 6;
if (pGroupKey[KeyIdx].KeyLen == 0)
@ -241,11 +241,11 @@ BOOLEAN RTMPSoftDecryptWEP(IN PRTMP_ADAPTER pAd,
ARCFOUR_DECRYPT(&pAd->PrivateInfo.WEPCONTEXT, pPayload, pPayload + 4,
payload_len - 4);
NdisMoveMemory(&trailfcs, pPayload + payload_len - 8, 4);
crc32 = RTMP_CALC_FCS32(PPPINITFCS32, pPayload, payload_len - 8); //Skip last 4 bytes(FCS).
crc32 = RTMP_CALC_FCS32(PPPINITFCS32, pPayload, payload_len - 8); /*Skip last 4 bytes(FCS). */
crc32 ^= 0xffffffff; /* complement */
if (crc32 != cpu2le32(trailfcs)) {
DBGPRINT(RT_DEBUG_TRACE, ("! WEP Data CRC Error !\n")); //CRC error.
DBGPRINT(RT_DEBUG_TRACE, ("! WEP Data CRC Error !\n")); /*CRC error. */
return (FALSE);
}
return (TRUE);
@ -411,7 +411,7 @@ VOID WPAARCFOUR_ENCRYPT(IN PARCFOURCONTEXT Ctx,
IN PUCHAR pDest, IN PUCHAR pSrc, IN UINT Len)
{
UINT i;
//discard first 256 bytes
/*discard first 256 bytes */
for (i = 0; i < 256; i++)
ARCFOUR_BYTE(Ctx);

File diff suppressed because it is too large Load diff

View file

@ -83,23 +83,23 @@ UCHAR eFuseReadRegisters(IN PRTMP_ADAPTER pAd,
RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrlStruc.word);
//Step0. Write 10-bit of address to EFSROM_AIN (0x580, bit25:bit16). The address must be 16-byte alignment.
//Use the eeprom logical address and covert to address to block number
/*Step0. Write 10-bit of address to EFSROM_AIN (0x580, bit25:bit16). The address must be 16-byte alignment. */
/*Use the eeprom logical address and covert to address to block number */
eFuseCtrlStruc.field.EFSROM_AIN = Offset & 0xfff0;
//Step1. Write EFSROM_MODE (0x580, bit7:bit6) to 0.
/*Step1. Write EFSROM_MODE (0x580, bit7:bit6) to 0. */
eFuseCtrlStruc.field.EFSROM_MODE = 0;
//Step2. Write EFSROM_KICK (0x580, bit30) to 1 to kick-off physical read procedure.
/*Step2. Write EFSROM_KICK (0x580, bit30) to 1 to kick-off physical read procedure. */
eFuseCtrlStruc.field.EFSROM_KICK = 1;
NdisMoveMemory(&data, &eFuseCtrlStruc, 4);
RTMP_IO_WRITE32(pAd, EFUSE_CTRL, data);
//Step3. Polling EFSROM_KICK(0x580, bit30) until it become 0 again.
/*Step3. Polling EFSROM_KICK(0x580, bit30) until it become 0 again. */
i = 0;
while (i < 500) {
//rtmp.HwMemoryReadDword(EFUSE_CTRL, (DWORD *) &eFuseCtrlStruc, 4);
/*rtmp.HwMemoryReadDword(EFUSE_CTRL, (DWORD *) &eFuseCtrlStruc, 4); */
RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrlStruc.word);
if (eFuseCtrlStruc.field.EFSROM_KICK == 0) {
break;
@ -108,25 +108,25 @@ UCHAR eFuseReadRegisters(IN PRTMP_ADAPTER pAd,
i++;
}
//if EFSROM_AOUT is not found in physical address, write 0xffff
/*if EFSROM_AOUT is not found in physical address, write 0xffff */
if (eFuseCtrlStruc.field.EFSROM_AOUT == 0x3f) {
for (i = 0; i < Length / 2; i++)
*(pData + 2 * i) = 0xffff;
} else {
//Step4. Read 16-byte of data from EFUSE_DATA0-3 (0x590-0x59C)
/*Step4. Read 16-byte of data from EFUSE_DATA0-3 (0x590-0x59C) */
efuseDataOffset = EFUSE_DATA3 - (Offset & 0xC);
//data hold 4 bytes data.
//In RTMP_IO_READ32 will automatically execute 32-bytes swapping
/*data hold 4 bytes data. */
/*In RTMP_IO_READ32 will automatically execute 32-bytes swapping */
RTMP_IO_READ32(pAd, efuseDataOffset, &data);
//Decide the upper 2 bytes or the bottom 2 bytes.
// Little-endian S | S Big-endian
// addr 3 2 1 0 | 0 1 2 3
// Ori-V D C B A | A B C D
//After swapping
// D C B A | D C B A
//Return 2-bytes
//The return byte statrs from S. Therefore, the little-endian will return BA, the Big-endian will return DC.
//For returning the bottom 2 bytes, the Big-endian should shift right 2-bytes.
/*Decide the upper 2 bytes or the bottom 2 bytes. */
/* Little-endian S | S Big-endian */
/* addr 3 2 1 0 | 0 1 2 3 */
/* Ori-V D C B A | A B C D */
/*After swapping */
/* D C B A | D C B A */
/*Return 2-bytes */
/*The return byte statrs from S. Therefore, the little-endian will return BA, the Big-endian will return DC. */
/*For returning the bottom 2 bytes, the Big-endian should shift right 2-bytes. */
data = data >> (8 * (Offset & 0x3));
NdisMoveMemory(pData, &data, Length);
@ -160,20 +160,20 @@ VOID eFusePhysicalReadRegisters(IN PRTMP_ADAPTER pAd,
RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrlStruc.word);
//Step0. Write 10-bit of address to EFSROM_AIN (0x580, bit25:bit16). The address must be 16-byte alignment.
/*Step0. Write 10-bit of address to EFSROM_AIN (0x580, bit25:bit16). The address must be 16-byte alignment. */
eFuseCtrlStruc.field.EFSROM_AIN = Offset & 0xfff0;
//Step1. Write EFSROM_MODE (0x580, bit7:bit6) to 1.
//Read in physical view
/*Step1. Write EFSROM_MODE (0x580, bit7:bit6) to 1. */
/*Read in physical view */
eFuseCtrlStruc.field.EFSROM_MODE = 1;
//Step2. Write EFSROM_KICK (0x580, bit30) to 1 to kick-off physical read procedure.
/*Step2. Write EFSROM_KICK (0x580, bit30) to 1 to kick-off physical read procedure. */
eFuseCtrlStruc.field.EFSROM_KICK = 1;
NdisMoveMemory(&data, &eFuseCtrlStruc, 4);
RTMP_IO_WRITE32(pAd, EFUSE_CTRL, data);
//Step3. Polling EFSROM_KICK(0x580, bit30) until it become 0 again.
/*Step3. Polling EFSROM_KICK(0x580, bit30) until it become 0 again. */
i = 0;
while (i < 500) {
RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrlStruc.word);
@ -183,14 +183,14 @@ VOID eFusePhysicalReadRegisters(IN PRTMP_ADAPTER pAd,
i++;
}
//Step4. Read 16-byte of data from EFUSE_DATA0-3 (0x59C-0x590)
//Because the size of each EFUSE_DATA is 4 Bytes, the size of address of each is 2 bits.
//The previous 2 bits is the EFUSE_DATA number, the last 2 bits is used to decide which bytes
//Decide which EFUSE_DATA to read
//590:F E D C
//594:B A 9 8
//598:7 6 5 4
//59C:3 2 1 0
/*Step4. Read 16-byte of data from EFUSE_DATA0-3 (0x59C-0x590) */
/*Because the size of each EFUSE_DATA is 4 Bytes, the size of address of each is 2 bits. */
/*The previous 2 bits is the EFUSE_DATA number, the last 2 bits is used to decide which bytes */
/*Decide which EFUSE_DATA to read */
/*590:F E D C */
/*594:B A 9 8 */
/*598:7 6 5 4 */
/*59C:3 2 1 0 */
efuseDataOffset = EFUSE_DATA3 - (Offset & 0xC);
RTMP_IO_READ32(pAd, efuseDataOffset, &data);
@ -222,8 +222,8 @@ static VOID eFuseReadPhysical(IN PRTMP_ADAPTER pAd,
USHORT *pInBuf = (USHORT *) lpInBuffer;
USHORT *pOutBuf = (USHORT *) lpOutBuffer;
USHORT Offset = pInBuf[0]; //addr
USHORT Length = pInBuf[1]; //length
USHORT Offset = pInBuf[0]; /*addr */
USHORT Length = pInBuf[1]; /*length */
int i;
for (i = 0; i < Length; i += 2) {

View file

@ -37,15 +37,15 @@
#include "../rt_config.h"
// IRQL = PASSIVE_LEVEL
/* IRQL = PASSIVE_LEVEL */
static inline VOID RaiseClock(IN PRTMP_ADAPTER pAd, IN UINT32 * x)
{
*x = *x | EESK;
RTMP_IO_WRITE32(pAd, E2PROM_CSR, *x);
RTMPusecDelay(1); // Max frequency = 1MHz in Spec. definition
RTMPusecDelay(1); /* Max frequency = 1MHz in Spec. definition */
}
// IRQL = PASSIVE_LEVEL
/* IRQL = PASSIVE_LEVEL */
static inline VOID LowerClock(IN PRTMP_ADAPTER pAd, IN UINT32 * x)
{
*x = *x & ~EESK;
@ -53,7 +53,7 @@ static inline VOID LowerClock(IN PRTMP_ADAPTER pAd, IN UINT32 * x)
RTMPusecDelay(1);
}
// IRQL = PASSIVE_LEVEL
/* IRQL = PASSIVE_LEVEL */
static inline USHORT ShiftInBits(IN PRTMP_ADAPTER pAd)
{
UINT32 x, i;
@ -68,7 +68,7 @@ static inline USHORT ShiftInBits(IN PRTMP_ADAPTER pAd)
RaiseClock(pAd, &x);
RTMP_IO_READ32(pAd, E2PROM_CSR, &x);
LowerClock(pAd, &x); //prevent read failed
LowerClock(pAd, &x); /*prevent read failed */
x &= ~(EEDI);
if (x & EEDO)
@ -78,7 +78,7 @@ static inline USHORT ShiftInBits(IN PRTMP_ADAPTER pAd)
return data;
}
// IRQL = PASSIVE_LEVEL
/* IRQL = PASSIVE_LEVEL */
static inline VOID ShiftOutBits(IN PRTMP_ADAPTER pAd,
IN USHORT data, IN USHORT count)
{
@ -106,7 +106,7 @@ static inline VOID ShiftOutBits(IN PRTMP_ADAPTER pAd,
RTMP_IO_WRITE32(pAd, E2PROM_CSR, x);
}
// IRQL = PASSIVE_LEVEL
/* IRQL = PASSIVE_LEVEL */
static inline VOID EEpromCleanup(IN PRTMP_ADAPTER pAd)
{
UINT32 x;
@ -124,17 +124,17 @@ static inline VOID EWEN(IN PRTMP_ADAPTER pAd)
{
UINT32 x;
// reset bits and set EECS
/* reset bits and set EECS */
RTMP_IO_READ32(pAd, E2PROM_CSR, &x);
x &= ~(EEDI | EEDO | EESK);
x |= EECS;
RTMP_IO_WRITE32(pAd, E2PROM_CSR, x);
// kick a pulse
/* kick a pulse */
RaiseClock(pAd, &x);
LowerClock(pAd, &x);
// output the read_opcode and six pulse in that order
/* output the read_opcode and six pulse in that order */
ShiftOutBits(pAd, EEPROM_EWEN_OPCODE, 5);
ShiftOutBits(pAd, 0, 6);
@ -145,24 +145,24 @@ static inline VOID EWDS(IN PRTMP_ADAPTER pAd)
{
UINT32 x;
// reset bits and set EECS
/* reset bits and set EECS */
RTMP_IO_READ32(pAd, E2PROM_CSR, &x);
x &= ~(EEDI | EEDO | EESK);
x |= EECS;
RTMP_IO_WRITE32(pAd, E2PROM_CSR, x);
// kick a pulse
/* kick a pulse */
RaiseClock(pAd, &x);
LowerClock(pAd, &x);
// output the read_opcode and six pulse in that order
/* output the read_opcode and six pulse in that order */
ShiftOutBits(pAd, EEPROM_EWDS_OPCODE, 5);
ShiftOutBits(pAd, 0, 6);
EEpromCleanup(pAd);
}
// IRQL = PASSIVE_LEVEL
/* IRQL = PASSIVE_LEVEL */
int rtmp_ee_prom_read16(IN PRTMP_ADAPTER pAd,
IN USHORT Offset, OUT USHORT * pValue)
{
@ -170,23 +170,23 @@ int rtmp_ee_prom_read16(IN PRTMP_ADAPTER pAd,
USHORT data;
Offset /= 2;
// reset bits and set EECS
/* reset bits and set EECS */
RTMP_IO_READ32(pAd, E2PROM_CSR, &x);
x &= ~(EEDI | EEDO | EESK);
x |= EECS;
RTMP_IO_WRITE32(pAd, E2PROM_CSR, x);
// patch can not access e-Fuse issue
/* patch can not access e-Fuse issue */
if (!(IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd))) {
// kick a pulse
/* kick a pulse */
RaiseClock(pAd, &x);
LowerClock(pAd, &x);
}
// output the read_opcode and register number in that order
/* output the read_opcode and register number in that order */
ShiftOutBits(pAd, EEPROM_READ_OPCODE, 3);
ShiftOutBits(pAd, Offset, pAd->EEPROMAddressNum);
// Now read the data (16 bits) in from the selected EEPROM word
/* Now read the data (16 bits) in from the selected EEPROM word */
data = ShiftInBits(pAd);
EEpromCleanup(pAd);

View file

@ -65,8 +65,8 @@ INT RtmpChipOpsEepromHook(IN RTMP_ADAPTER * pAd, IN INT infType)
return 0;
} else
DBGPRINT(RT_DEBUG_TRACE, ("NVM is EEPROM\n"));
#endif // RTMP_EFUSE_SUPPORT //
#endif // RT30xx //
#endif /* RTMP_EFUSE_SUPPORT // */
#endif /* RT30xx // */
switch (infType) {
#ifdef RTMP_PCI_SUPPORT
@ -74,13 +74,13 @@ INT RtmpChipOpsEepromHook(IN RTMP_ADAPTER * pAd, IN INT infType)
pChipOps->eeinit = NULL;
pChipOps->eeread = rtmp_ee_prom_read16;
break;
#endif // RTMP_PCI_SUPPORT //
#endif /* RTMP_PCI_SUPPORT // */
#ifdef RTMP_USB_SUPPORT
case RTMP_DEV_INF_USB:
pChipOps->eeinit = NULL;
pChipOps->eeread = RTUSBReadEEPROM16;
break;
#endif // RTMP_USB_SUPPORT //
#endif /* RTMP_USB_SUPPORT // */
default:
DBGPRINT(RT_DEBUG_ERROR, ("RtmpChipOpsEepromHook() failed!\n"));

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -172,7 +172,7 @@ VOID RtmpChipOpsRFHook(IN RTMP_ADAPTER * pAd)
RT30xxReverseRFSleepModeSetup;
}
}
#endif // RT3070 //
#endif /* RT3070 // */
#ifdef RT3090
if (IS_RT3090(pAd) && (pAd->infType == RTMP_DEV_INF_PCI)) {
pChipOps->AsicRfTurnOff = RT30xxLoadRFSleepModeSetup;
@ -180,9 +180,9 @@ VOID RtmpChipOpsRFHook(IN RTMP_ADAPTER * pAd)
pChipOps->AsicReverseRfFromSleepMode =
RT30xxReverseRFSleepModeSetup;
}
#endif // RT3090 //
#endif /* RT3090 // */
}
#endif // RT30xx //
#endif /* RT30xx // */
}
#endif // RTMP_RF_RW_SUPPORT //
#endif /* RTMP_RF_RW_SUPPORT // */

File diff suppressed because it is too large Load diff

View file

@ -48,16 +48,14 @@
#include <linux/bitrev.h>
//#define BIN_IN_FILE /* use *.bin firmware */
#ifdef RTMP_MAC_USB
//
// RT2870 Firmware Spec only used 1 oct for version expression
//
/* */
/* RT2870 Firmware Spec only used 1 oct for version expression */
/* */
#define FIRMWARE_MINOR_VERSION 7
#endif // RTMP_MAC_USB //
#endif /* RTMP_MAC_USB // */
// New 8k byte firmware size for RT3071/RT3072
/* New 8k byte firmware size for RT3071/RT3072 */
#define FIRMWAREIMAGE_MAX_LENGTH 0x2000
#define FIRMWAREIMAGE_LENGTH (sizeof (FirmwareImage) / sizeof(UCHAR))
#define FIRMWARE_MAJOR_VERSION 0
@ -67,7 +65,7 @@
#ifdef RTMP_MAC_PCI
#define FIRMWARE_MINOR_VERSION 2
#endif // RTMP_MAC_PCI //
#endif /* RTMP_MAC_PCI // */
/*
========================================================================
@ -120,7 +118,7 @@ NDIS_STATUS RtmpAsicLoadFirmware(IN PRTMP_ADAPTER pAd)
UINT32 Version = (pAd->MACVersion >> 16);
#endif
// New 8k byte firmware size for RT3071/RT3072
/* New 8k byte firmware size for RT3071/RT3072 */
{
#ifdef RTMP_MAC_PCI
if (IS_RT3090(pAd) || IS_RT3390(pAd)) {
@ -130,24 +128,24 @@ NDIS_STATUS RtmpAsicLoadFirmware(IN PRTMP_ADAPTER pAd)
pFirmwareImage = FirmwareImage_2860;
FileLength = FIRMWAREIMAGE_MAX_LENGTH;
}
#endif // RTMP_MAC_PCI //
#endif /* RTMP_MAC_PCI // */
#ifdef RTMP_MAC_USB
/* the firmware image consists of two parts */
if ((Version != 0x2860) && (Version != 0x2872) && (Version != 0x3070)) { /* use the second part */
//printk("KH:Use New Version,part2\n");
/*printk("KH:Use New Version,part2\n"); */
pFirmwareImage =
(PUCHAR) &
FirmwareImage_3070[FIRMWAREIMAGEV1_LENGTH];
FileLength = FIRMWAREIMAGEV2_LENGTH;
} else {
//printk("KH:Use New Version,part1\n");
/*printk("KH:Use New Version,part1\n"); */
if (Version == 0x3070)
pFirmwareImage = FirmwareImage_3070;
else
pFirmwareImage = FirmwareImage_2870;
FileLength = FIRMWAREIMAGEV1_LENGTH;
}
#endif // RTMP_MAC_USB //
#endif /* RTMP_MAC_USB // */
}
RTMP_WRITE_FIRMWARE(pAd, pFirmwareImage, FileLength);
@ -183,8 +181,8 @@ INT RtmpAsicSendCommandToMcu(IN PRTMP_ADAPTER pAd,
ULONG i = 0;
#ifdef PCIE_PS_SUPPORT
// 3090F power solution 3 has hw limitation that needs to ban all mcu command
// when firmware is in radio state. For other chip doesn't have this limitation.
/* 3090F power solution 3 has hw limitation that needs to ban all mcu command */
/* when firmware is in radio state. For other chip doesn't have this limitation. */
if (((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd))
&& IS_VERSION_AFTER_F(pAd)) && IS_VERSION_AFTER_F(pAd)
&& (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3)
@ -228,7 +226,7 @@ INT RtmpAsicSendCommandToMcu(IN PRTMP_ADAPTER pAd,
return FALSE;
}
H2MMailbox.field.Owner = 1; // pass ownership to MCU
H2MMailbox.field.Owner = 1; /* pass ownership to MCU */
H2MMailbox.field.CmdToken = Token;
H2MMailbox.field.HighByte = Arg1;
H2MMailbox.field.LowByte = Arg0;
@ -239,7 +237,7 @@ INT RtmpAsicSendCommandToMcu(IN PRTMP_ADAPTER pAd,
RTMP_IO_FORCE_WRITE32(pAd, HOST_CMD_CSR, H2MCmd.word);
} else
#endif // PCIE_PS_SUPPORT //
#endif /* PCIE_PS_SUPPORT // */
{
do {
RTMP_IO_READ32(pAd, H2M_MAILBOX_CSR, &H2MMailbox.word);
@ -251,16 +249,16 @@ INT RtmpAsicSendCommandToMcu(IN PRTMP_ADAPTER pAd,
if (i > 100) {
#ifdef RTMP_MAC_PCI
#endif // RTMP_MAC_PCI //
#endif /* RTMP_MAC_PCI // */
{
DBGPRINT_ERR(("H2M_MAILBOX still hold by MCU. command fail\n"));
}
return FALSE;
}
#ifdef RTMP_MAC_PCI
#endif // RTMP_MAC_PCI //
#endif /* RTMP_MAC_PCI // */
H2MMailbox.field.Owner = 1; // pass ownership to MCU
H2MMailbox.field.Owner = 1; /* pass ownership to MCU */
H2MMailbox.field.CmdToken = Token;
H2MMailbox.field.HighByte = Arg1;
H2MMailbox.field.LowByte = Arg0;
@ -274,20 +272,20 @@ INT RtmpAsicSendCommandToMcu(IN PRTMP_ADAPTER pAd,
}
}
#ifdef PCIE_PS_SUPPORT
// 3090 MCU Wakeup command needs more time to be stable.
// Before stable, don't issue other MCU command to prevent from firmware error.
/* 3090 MCU Wakeup command needs more time to be stable. */
/* Before stable, don't issue other MCU command to prevent from firmware error. */
if (((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd))
&& IS_VERSION_AFTER_F(pAd)) && IS_VERSION_AFTER_F(pAd)
&& (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3)
&& (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)
&& (Command == WAKE_MCU_CMD)) {
RTMPusecDelay(2000);
//Put this is after RF programming.
//NdisAcquireSpinLock(&pAd->McuCmdLock);
//pAd->brt30xxBanMcuCmd = FALSE;
//NdisReleaseSpinLock(&pAd->McuCmdLock);
/*Put this is after RF programming. */
/*NdisAcquireSpinLock(&pAd->McuCmdLock); */
/*pAd->brt30xxBanMcuCmd = FALSE; */
/*NdisReleaseSpinLock(&pAd->McuCmdLock); */
}
#endif // PCIE_PS_SUPPORT //
#endif /* PCIE_PS_SUPPORT // */
return TRUE;
}

View file

@ -41,13 +41,13 @@
#include "../rt_config.h"
BUILD_TIMER_FUNCTION(MlmePeriodicExec);
//BUILD_TIMER_FUNCTION(MlmeRssiReportExec);
/*BUILD_TIMER_FUNCTION(MlmeRssiReportExec); */
BUILD_TIMER_FUNCTION(AsicRxAntEvalTimeout);
BUILD_TIMER_FUNCTION(APSDPeriodicExec);
BUILD_TIMER_FUNCTION(AsicRfTuningExec);
#ifdef RTMP_MAC_USB
BUILD_TIMER_FUNCTION(BeaconUpdateExec);
#endif // RTMP_MAC_USB //
#endif /* RTMP_MAC_USB // */
BUILD_TIMER_FUNCTION(BeaconTimeout);
BUILD_TIMER_FUNCTION(ScanTimeout);
@ -61,10 +61,10 @@ BUILD_TIMER_FUNCTION(WpaDisassocApAndBlockAssoc);
#ifdef RTMP_MAC_PCI
BUILD_TIMER_FUNCTION(PsPollWakeExec);
BUILD_TIMER_FUNCTION(RadioOnExec);
#endif // RTMP_MAC_PCI //
#endif /* RTMP_MAC_PCI // */
#ifdef RTMP_MAC_USB
BUILD_TIMER_FUNCTION(RtmpUsbStaAsicForceWakeupTimeout);
#endif // RTMP_MAC_USB //
#endif /* RTMP_MAC_USB // */
#if defined(AP_LED) || defined(STA_LED)
extern void LedCtrlMain(IN PVOID SystemSpecific1,
@ -97,19 +97,19 @@ static void RtmpTimerQHandle(RTMP_ADAPTER * pAd)
if (pAd->TimerQ.status == RTMP_TASK_STAT_STOPED)
break;
// event happened.
/* event happened. */
while (pAd->TimerQ.pQHead) {
RTMP_INT_LOCK(&pAd->TimerQLock, irqFlag);
pEntry = pAd->TimerQ.pQHead;
if (pEntry) {
pTimer = pEntry->pRaTimer;
// update pQHead
/* update pQHead */
pAd->TimerQ.pQHead = pEntry->pNext;
if (pEntry == pAd->TimerQ.pQTail)
pAd->TimerQ.pQTail = NULL;
// return this queue entry to timerQFreeList.
/* return this queue entry to timerQFreeList. */
pEntry->pNext = pAd->TimerQ.pQPollFreeList;
pAd->TimerQ.pQPollFreeList = pEntry;
}
@ -226,7 +226,7 @@ BOOLEAN RtmpTimerQRemove(IN RTMP_ADAPTER * pAd, IN RALINK_TIMER_STRUCT * pTimer)
pNode = pNode->pNext;
}
// Now move it to freeList queue.
/* Now move it to freeList queue. */
if (pNode) {
if (pNode == pAd->TimerQ.pQHead)
pAd->TimerQ.pQHead = pNode->pNext;
@ -235,7 +235,7 @@ BOOLEAN RtmpTimerQRemove(IN RTMP_ADAPTER * pAd, IN RALINK_TIMER_STRUCT * pTimer)
if (pPrev != NULL)
pPrev->pNext = pNode->pNext;
// return this queue entry to timerQFreeList.
/* return this queue entry to timerQFreeList. */
pNode->pNext = pAd->TimerQ.pQPollFreeList;
pAd->TimerQ.pQPollFreeList = pNode;
}
@ -254,7 +254,7 @@ void RtmpTimerQExit(RTMP_ADAPTER * pAd)
while (pAd->TimerQ.pQHead) {
pTimerQ = pAd->TimerQ.pQHead;
pAd->TimerQ.pQHead = pTimerQ->pNext;
// remove the timeQ
/* remove the timeQ */
}
pAd->TimerQ.pQPollFreeList = NULL;
os_free_mem(pAd, pAd->TimerQ.pTimerQPoll);
@ -299,4 +299,4 @@ void RtmpTimerQInit(RTMP_ADAPTER * pAd)
RTMP_INT_UNLOCK(&pAd->TimerQLock, irqFlags);
}
}
#endif // RTMP_TIMER_TASK_SUPPORT //
#endif /* RTMP_TIMER_TASK_SUPPORT // */

View file

@ -45,7 +45,7 @@ DOT11_REGULATORY_INFORMATION USARegulatoryInfo[] = {
{0, {0, 0, {0}
}
}
, // Invlid entry
, /* Invlid entry */
{1, {4, 16, {36, 40, 44, 48}
}
}
@ -103,7 +103,7 @@ DOT11_REGULATORY_INFORMATION EuropeRegulatoryInfo[] = {
{0, {0, 0, {0}
}
}
, // Invalid entry
, /* Invalid entry */
{1, {4, 20, {36, 40, 44, 48}
}
}
@ -129,7 +129,7 @@ DOT11_REGULATORY_INFORMATION JapanRegulatoryInfo[] = {
{0, {0, 0, {0}
}
}
, // Invalid entry
, /* Invalid entry */
{1, {4, 22, {34, 38, 42, 46}
}
}
@ -489,7 +489,7 @@ PMEASURE_REQ_ENTRY MeasureReqInsert(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken)
PMEASURE_REQ_ENTRY pProbeEntry =
pTab->Hash[HashIdx];
// update Hash list
/* update Hash list */
do {
if (pProbeEntry == pEntry) {
if (pPrevEntry == NULL) {
@ -529,7 +529,7 @@ PMEASURE_REQ_ENTRY MeasureReqInsert(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken)
("%s: pMeasureReqTab tab full.\n", __func__));
}
// add this Neighbor entry into HASH table
/* add this Neighbor entry into HASH table */
if (pEntry) {
HashIdx = MQ_DIALOGTOKEN_HASH_INDEX(DialogToken);
if (pTab->Hash[HashIdx] == NULL) {
@ -558,7 +558,7 @@ VOID MeasureReqDelete(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken)
("%s: pMeasureReqTab doesn't exist.\n", __func__));
return;
}
// if empty, return
/* if empty, return */
if (pTab->Size == 0) {
DBGPRINT(RT_DEBUG_ERROR, ("pMeasureReqTab empty.\n"));
return;
@ -571,7 +571,7 @@ VOID MeasureReqDelete(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken)
PMEASURE_REQ_ENTRY pProbeEntry = pTab->Hash[HashIdx];
RTMP_SEM_LOCK(&pAd->CommonCfg.MeasureReqTabLock);
// update Hash list
/* update Hash list */
do {
if (pProbeEntry == pEntry) {
if (pPrevEntry == NULL) {
@ -687,7 +687,7 @@ static PTPC_REQ_ENTRY TpcReqInsert(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken)
PTPC_REQ_ENTRY pProbeEntry =
pTab->Hash[HashIdx];
// update Hash list
/* update Hash list */
do {
if (pProbeEntry == pEntry) {
if (pPrevEntry == NULL) {
@ -726,7 +726,7 @@ static PTPC_REQ_ENTRY TpcReqInsert(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken)
("%s: pTpcReqTab tab full.\n", __func__));
}
// add this Neighbor entry into HASH table
/* add this Neighbor entry into HASH table */
if (pEntry) {
HashIdx = TPC_DIALOGTOKEN_HASH_INDEX(DialogToken);
if (pTab->Hash[HashIdx] == NULL) {
@ -755,7 +755,7 @@ static VOID TpcReqDelete(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken)
("%s: pTpcReqTab doesn't exist.\n", __func__));
return;
}
// if empty, return
/* if empty, return */
if (pTab->Size == 0) {
DBGPRINT(RT_DEBUG_ERROR, ("pTpcReqTab empty.\n"));
return;
@ -768,7 +768,7 @@ static VOID TpcReqDelete(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken)
PTPC_REQ_ENTRY pProbeEntry = pTab->Hash[HashIdx];
RTMP_SEM_LOCK(&pAd->CommonCfg.TpcReqTabLock);
// update Hash list
/* update Hash list */
do {
if (pProbeEntry == pEntry) {
if (pPrevEntry == NULL) {
@ -804,7 +804,7 @@ static VOID TpcReqDelete(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken)
*/
static UINT64 GetCurrentTimeStamp(IN PRTMP_ADAPTER pAd)
{
// get current time stamp.
/* get current time stamp. */
return 0;
}
@ -1121,7 +1121,7 @@ VOID MakeMeasurementReqFrame(IN PRTMP_ADAPTER pAd,
InsertActField(pAd, (pOutBuffer + *pFrameLen), pFrameLen, Category,
Action);
// fill Dialog Token
/* fill Dialog Token */
InsertDialogToken(pAd, (pOutBuffer + *pFrameLen), pFrameLen,
MeasureToken);
@ -1132,7 +1132,7 @@ VOID MakeMeasurementReqFrame(IN PRTMP_ADAPTER pAd,
*pFrameLen += TempLen;
}
// prepare Measurement IE.
/* prepare Measurement IE. */
NdisZeroMemory(&MeasureReqIE, sizeof(MEASURE_REQ_INFO));
MeasureReqIE.Token = MeasureToken;
MeasureReqIE.ReqMode.word = MeasureReqMode;
@ -1169,11 +1169,11 @@ VOID EnqueueMeasurementRep(IN PRTMP_ADAPTER pAd,
HEADER_802_11 ActHdr;
MEASURE_REPORT_INFO MeasureRepIE;
// build action frame header.
/* build action frame header. */
MgtMacHeaderInit(pAd, &ActHdr, SUBTYPE_ACTION, 0, pDA,
pAd->CurrentAddress);
NStatus = MlmeAllocateMemory(pAd, (PVOID) & pOutBuffer); //Get an unused nonpaged memory
NStatus = MlmeAllocateMemory(pAd, (PVOID) & pOutBuffer); /*Get an unused nonpaged memory */
if (NStatus != NDIS_STATUS_SUCCESS) {
DBGPRINT(RT_DEBUG_TRACE,
("%s() allocate memory failed \n", __func__));
@ -1185,10 +1185,10 @@ VOID EnqueueMeasurementRep(IN PRTMP_ADAPTER pAd,
InsertActField(pAd, (pOutBuffer + FrameLen), &FrameLen,
CATEGORY_SPECTRUM, SPEC_MRP);
// fill Dialog Token
/* fill Dialog Token */
InsertDialogToken(pAd, (pOutBuffer + FrameLen), &FrameLen, DialogToken);
// prepare Measurement IE.
/* prepare Measurement IE. */
NdisZeroMemory(&MeasureRepIE, sizeof(MEASURE_REPORT_INFO));
MeasureRepIE.Token = MeasureToken;
MeasureRepIE.ReportMode = MeasureReqMode;
@ -1222,11 +1222,11 @@ VOID EnqueueTPCReq(IN PRTMP_ADAPTER pAd, IN PUCHAR pDA, IN UCHAR DialogToken)
HEADER_802_11 ActHdr;
// build action frame header.
/* build action frame header. */
MgtMacHeaderInit(pAd, &ActHdr, SUBTYPE_ACTION, 0, pDA,
pAd->CurrentAddress);
NStatus = MlmeAllocateMemory(pAd, (PVOID) & pOutBuffer); //Get an unused nonpaged memory
NStatus = MlmeAllocateMemory(pAd, (PVOID) & pOutBuffer); /*Get an unused nonpaged memory */
if (NStatus != NDIS_STATUS_SUCCESS) {
DBGPRINT(RT_DEBUG_TRACE,
("%s() allocate memory failed \n", __func__));
@ -1238,10 +1238,10 @@ VOID EnqueueTPCReq(IN PRTMP_ADAPTER pAd, IN PUCHAR pDA, IN UCHAR DialogToken)
InsertActField(pAd, (pOutBuffer + FrameLen), &FrameLen,
CATEGORY_SPECTRUM, SPEC_TPCRQ);
// fill Dialog Token
/* fill Dialog Token */
InsertDialogToken(pAd, (pOutBuffer + FrameLen), &FrameLen, DialogToken);
// Insert TPC Request IE.
/* Insert TPC Request IE. */
InsertTpcReqIE(pAd, (pOutBuffer + FrameLen), &FrameLen);
MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen);
@ -1272,11 +1272,11 @@ VOID EnqueueTPCRep(IN PRTMP_ADAPTER pAd,
HEADER_802_11 ActHdr;
// build action frame header.
/* build action frame header. */
MgtMacHeaderInit(pAd, &ActHdr, SUBTYPE_ACTION, 0, pDA,
pAd->CurrentAddress);
NStatus = MlmeAllocateMemory(pAd, (PVOID) & pOutBuffer); //Get an unused nonpaged memory
NStatus = MlmeAllocateMemory(pAd, (PVOID) & pOutBuffer); /*Get an unused nonpaged memory */
if (NStatus != NDIS_STATUS_SUCCESS) {
DBGPRINT(RT_DEBUG_TRACE,
("%s() allocate memory failed \n", __func__));
@ -1288,10 +1288,10 @@ VOID EnqueueTPCRep(IN PRTMP_ADAPTER pAd,
InsertActField(pAd, (pOutBuffer + FrameLen), &FrameLen,
CATEGORY_SPECTRUM, SPEC_TPCRP);
// fill Dialog Token
/* fill Dialog Token */
InsertDialogToken(pAd, (pOutBuffer + FrameLen), &FrameLen, DialogToken);
// Insert TPC Request IE.
/* Insert TPC Request IE. */
InsertTpcReportIE(pAd, (pOutBuffer + FrameLen), &FrameLen, TxPwr,
LinkMargin);
@ -1324,11 +1324,11 @@ VOID EnqueueChSwAnn(IN PRTMP_ADAPTER pAd,
HEADER_802_11 ActHdr;
// build action frame header.
/* build action frame header. */
MgtMacHeaderInit(pAd, &ActHdr, SUBTYPE_ACTION, 0, pDA,
pAd->CurrentAddress);
NStatus = MlmeAllocateMemory(pAd, (PVOID) & pOutBuffer); //Get an unused nonpaged memory
NStatus = MlmeAllocateMemory(pAd, (PVOID) & pOutBuffer); /*Get an unused nonpaged memory */
if (NStatus != NDIS_STATUS_SUCCESS) {
DBGPRINT(RT_DEBUG_TRACE,
("%s() allocate memory failed \n", __func__));
@ -1355,18 +1355,18 @@ static BOOLEAN DfsRequirementCheck(IN PRTMP_ADAPTER pAd, IN UINT8 Channel)
INT i;
do {
// check DFS procedure is running.
// make sure DFS procedure won't start twice.
/* check DFS procedure is running. */
/* make sure DFS procedure won't start twice. */
if (pAd->CommonCfg.RadarDetect.RDMode != RD_NORMAL_MODE) {
Result = FALSE;
break;
}
// check the new channel carried from Channel Switch Announcemnet is valid.
/* check the new channel carried from Channel Switch Announcemnet is valid. */
for (i = 0; i < pAd->ChannelListNum; i++) {
if ((Channel == pAd->ChannelList[i].Channel)
&& (pAd->ChannelList[i].RemainingTimeForUse == 0)) {
// found radar signal in the channel. the channel can't use at least for 30 minutes.
pAd->ChannelList[i].RemainingTimeForUse = 1800; //30 min = 1800 sec
/* found radar signal in the channel. the channel can't use at least for 30 minutes. */
pAd->ChannelList[i].RemainingTimeForUse = 1800; /*30 min = 1800 sec */
Result = TRUE;
break;
}
@ -1385,7 +1385,7 @@ VOID NotifyChSwAnnToPeerAPs(IN PRTMP_ADAPTER pAd,
static VOID StartDFSProcedure(IN PRTMP_ADAPTER pAd,
IN UCHAR Channel, IN UINT8 ChSwMode)
{
// start DFS procedure
/* start DFS procedure */
pAd->CommonCfg.Channel = Channel;
N_ChannelCheck(pAd);
@ -1425,10 +1425,10 @@ static BOOLEAN PeerChSwAnnSanity(IN PRTMP_ADAPTER pAd,
BOOLEAN result = FALSE;
PEID_STRUCT eid_ptr;
// skip 802.11 header.
/* skip 802.11 header. */
MsgLen -= sizeof(HEADER_802_11);
// skip category and action code.
/* skip category and action code. */
pFramePtr += 2;
MsgLen -= 2;
@ -1487,10 +1487,10 @@ static BOOLEAN PeerMeasureReqSanity(IN PRTMP_ADAPTER pAd,
UINT64 MeasureStartTime;
UINT16 MeasureDuration;
// skip 802.11 header.
/* skip 802.11 header. */
MsgLen -= sizeof(HEADER_802_11);
// skip category and action code.
/* skip category and action code. */
pFramePtr += 2;
MsgLen -= 2;
@ -1580,10 +1580,10 @@ static BOOLEAN PeerMeasureReportSanity(IN PRTMP_ADAPTER pAd,
PEID_STRUCT eid_ptr;
PUCHAR ptr;
// skip 802.11 header.
/* skip 802.11 header. */
MsgLen -= sizeof(HEADER_802_11);
// skip category and action code.
/* skip category and action code. */
pFramePtr += 2;
MsgLen -= 2;
@ -1677,7 +1677,7 @@ static BOOLEAN PeerTpcReqSanity(IN PRTMP_ADAPTER pAd,
MsgLen -= sizeof(HEADER_802_11);
// skip category and action code.
/* skip category and action code. */
pFramePtr += 2;
MsgLen -= 2;
@ -1732,7 +1732,7 @@ static BOOLEAN PeerTpcRepSanity(IN PRTMP_ADAPTER pAd,
MsgLen -= sizeof(HEADER_802_11);
// skip category and action code.
/* skip category and action code. */
pFramePtr += 2;
MsgLen -= 2;
@ -1808,16 +1808,16 @@ static VOID PeerChSwAnnAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
if ((pAd->CommonCfg.bIEEE80211H == 1) && (NewChannel != 0)
&& (Channel != NewChannel)) {
// Switching to channel 1 can prevent from rescanning the current channel immediately (by auto reconnection).
// In addition, clear the MLME queue and the scan table to discard the RX packets and previous scanning results.
/* Switching to channel 1 can prevent from rescanning the current channel immediately (by auto reconnection). */
/* In addition, clear the MLME queue and the scan table to discard the RX packets and previous scanning results. */
AsicSwitchChannel(pAd, 1, FALSE);
AsicLockChannel(pAd, 1);
LinkDown(pAd, FALSE);
MlmeQueueInit(&pAd->Mlme.Queue);
BssTableInit(&pAd->ScanTab);
RTMPusecDelay(1000000); // use delay to prevent STA do reassoc
RTMPusecDelay(1000000); /* use delay to prevent STA do reassoc */
// channel sanity check
/* channel sanity check */
for (index = 0; index < pAd->ChannelListNum; index++) {
if (pAd->ChannelList[index].Channel ==
NewChannel) {
@ -1897,8 +1897,8 @@ static VOID PeerMeasureReportAction(IN PRTMP_ADAPTER pAd,
UINT8 DialogToken;
PUINT8 pMeasureReportInfo;
// if (pAd->CommonCfg.bIEEE80211H != TRUE)
// return;
/* if (pAd->CommonCfg.bIEEE80211H != TRUE) */
/* return; */
if ((pMeasureReportInfo =
kmalloc(sizeof(MEASURE_RPI_REPORT), GFP_ATOMIC)) == NULL) {
@ -1916,8 +1916,8 @@ static VOID PeerMeasureReportAction(IN PRTMP_ADAPTER pAd,
do {
PMEASURE_REQ_ENTRY pEntry = NULL;
// Not a autonomous measure report.
// check the dialog token field. drop it if the dialog token doesn't match.
/* Not a autonomous measure report. */
/* check the dialog token field. drop it if the dialog token doesn't match. */
if ((DialogToken != 0)
&& ((pEntry = MeasureReqLookUp(pAd, DialogToken)) ==
NULL))
@ -1974,18 +1974,18 @@ static VOID PeerTpcReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
UINT8 LinkMargin = 0;
CHAR RealRssi;
// link margin: Ratio of the received signal power to the minimum desired by the station (STA). The
// STA may incorporate rate information and channel conditions, including interference, into its computation
// of link margin.
/* link margin: Ratio of the received signal power to the minimum desired by the station (STA). The */
/* STA may incorporate rate information and channel conditions, including interference, into its computation */
/* of link margin. */
RealRssi = RTMPMaxRssi(pAd, ConvertToRssi(pAd, Elem->Rssi0, RSSI_0),
ConvertToRssi(pAd, Elem->Rssi1, RSSI_1),
ConvertToRssi(pAd, Elem->Rssi2, RSSI_2));
// skip Category and action code.
/* skip Category and action code. */
pFramePtr += 2;
// Dialog token.
/* Dialog token. */
NdisMoveMemory(&DialogToken, pFramePtr, 1);
LinkMargin = (RealRssi / MIN_RCV_PWR);
@ -2050,8 +2050,8 @@ VOID PeerSpectrumAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
switch (Action) {
case SPEC_MRQ:
// current rt2860 unable do such measure specified in Measurement Request.
// reject all measurement request.
/* current rt2860 unable do such measure specified in Measurement Request. */
/* reject all measurement request. */
PeerMeasureReqAction(pAd, Elem);
break;
@ -2104,7 +2104,7 @@ INT Set_MeasureReq_Proc(IN PRTMP_ADAPTER pAd, IN PSTRING arg)
NDIS_STATUS NStatus;
ULONG FrameLen;
NStatus = MlmeAllocateMemory(pAd, (PVOID) & pOutBuffer); //Get an unused nonpaged memory
NStatus = MlmeAllocateMemory(pAd, (PVOID) & pOutBuffer); /*Get an unused nonpaged memory */
if (NStatus != NDIS_STATUS_SUCCESS) {
DBGPRINT(RT_DEBUG_TRACE,
("%s() allocate memory failed \n", __func__));
@ -2114,11 +2114,11 @@ INT Set_MeasureReq_Proc(IN PRTMP_ADAPTER pAd, IN PSTRING arg)
ArgIdx = 1;
while ((thisChar = strsep((char **)&arg, "-")) != NULL) {
switch (ArgIdx) {
case 1: // Aid.
case 1: /* Aid. */
Aid = (UINT8) simple_strtol(thisChar, 0, 16);
break;
case 2: // Measurement Request Type.
case 2: /* Measurement Request Type. */
MeasureReqType = simple_strtol(thisChar, 0, 16);
if (MeasureReqType > 3) {
DBGPRINT(RT_DEBUG_ERROR,
@ -2128,7 +2128,7 @@ INT Set_MeasureReq_Proc(IN PRTMP_ADAPTER pAd, IN PSTRING arg)
}
break;
case 3: // Measurement channel.
case 3: /* Measurement channel. */
MeasureCh = (UINT8) simple_strtol(thisChar, 0, 16);
break;
}
@ -2149,7 +2149,7 @@ INT Set_MeasureReq_Proc(IN PRTMP_ADAPTER pAd, IN PSTRING arg)
MeasureReqInsert(pAd, MeasureReqToken);
// build action frame header.
/* build action frame header. */
MgtMacHeaderInit(pAd, &ActHdr, SUBTYPE_ACTION, 0,
pAd->MacTab.Content[Aid].Addr, pAd->CurrentAddress);