68 {2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108};
77 static BYTE s_byGetRateIdx(
BYTE byRate);
82 PBYTE pbyRxBufferAddr,
83 unsigned int *pcbHeaderSize,
89 s_vProcessRxMACHeader (
91 PBYTE pbyRxBufferAddr,
92 unsigned int cbPacketSize,
95 unsigned int *pcbHeadSize
98 static BOOL s_bAPModeRxCtl(
101 signed int iSANodeIndex
106 static BOOL s_bAPModeRxData (
109 unsigned int FrameSize,
110 unsigned int cbHeaderOffset,
111 signed int iSANodeIndex,
112 signed int iDANodeIndex
116 static BOOL s_bHandleRxEncryption(
119 unsigned int FrameSize,
128 static BOOL s_bHostWepRxEncryption(
132 unsigned int FrameSize,
164 s_vProcessRxMACHeader (
166 PBYTE pbyRxBufferAddr,
167 unsigned int cbPacketSize,
170 unsigned int *pcbHeadSize
174 unsigned int cbHeaderSize = 0;
197 pbyRxBuffer = (
PBYTE) (pbyRxBufferAddr + cbHeaderSize);
200 }
else if (!compare_ether_addr(pbyRxBuffer, &pDevice->
abySNAP_RFC1042[0])) {
202 pwType = (
PWORD) (pbyRxBufferAddr + cbHeaderSize);
206 pwType = (
PWORD) (pbyRxBufferAddr + cbHeaderSize);
221 pwType = (
PWORD) (pbyRxBufferAddr + cbHeaderSize);
235 pbyRxBuffer = (
PBYTE) (pbyRxBufferAddr + cbHeaderSize);
241 *pcbHeadSize = cbHeaderSize;
247 static BYTE s_byGetRateIdx(
BYTE byRate)
251 for (byRateIdx = 0; byRateIdx <
MAX_RATE ; byRateIdx++) {
262 PBYTE pbyRxBufferAddr,
263 unsigned int *pcbHeaderSize,
267 unsigned int cbHeaderSize = 0;
273 if ((pMACHeader->wFrameCtl &
FC_TODS) == 0) {
276 psEthHeader->abyDstAddr[ii] =
277 pMACHeader->abyAddr1[ii];
278 psEthHeader->abySrcAddr[ii] =
279 pMACHeader->abyAddr3[ii];
284 psEthHeader->abyDstAddr[ii] =
285 pMACHeader->abyAddr1[ii];
286 psEthHeader->abySrcAddr[ii] =
287 pMACHeader->abyAddr2[ii];
294 psEthHeader->abyDstAddr[ii] =
295 pMACHeader->abyAddr3[ii];
296 psEthHeader->abySrcAddr[ii] =
297 pMACHeader->abyAddr4[ii];
302 psEthHeader->abyDstAddr[ii] =
303 pMACHeader->abyAddr3[ii];
304 psEthHeader->abySrcAddr[ii] =
305 pMACHeader->abyAddr2[ii];
309 *pcbHeaderSize = cbHeaderSize;
319 unsigned long BytesToIndicate
334 unsigned int cbHeaderOffset;
335 unsigned int FrameSize;
337 signed int iSANodeIndex = -1;
338 signed int iDANodeIndex = -1;
340 unsigned int cbIVOffset;
345 unsigned int cbHeaderSize;
348 DWORD dwRxTSC47_16 = 0;
355 PRCB pRCBIndicate = pRCB;
358 BYTE abyVaildRate[
MAX_RATE] = {2,4,11,22,12,18,24,36,48,72,96,108};
359 WORD wPLCPwithPadding;
371 FrameSize = (
unsigned int)(dwWbkStatus >> 16);
374 if (BytesToIndicate != FrameSize) {
379 if ((BytesToIndicate > 2372) || (BytesToIndicate <= 40)) {
386 pbyRxSts = pbyDAddress+4;
387 pbyRxRate = pbyDAddress+5;
392 pwPLCP_Length = (
PWORD) (pbyDAddress + 6);
394 if ( ((BytesToIndicate - (*pwPLCP_Length)) > 27) ||
395 ((BytesToIndicate - (*pwPLCP_Length)) < 24) ||
396 (BytesToIndicate < (*pwPLCP_Length)) ) {
403 if ( *pbyRxRate == abyVaildRate[ii] ) {
407 if ( ii==MAX_RATE ) {
412 wPLCPwithPadding = ( (*pwPLCP_Length / 4) + ( (*pwPLCP_Length % 4) ? 1:0 ) ) *4;
414 pqwTSFTime = (
PQWORD) (pbyDAddress + 8 + wPLCPwithPadding);
416 pby3SQ = pbyDAddress + 8 + wPLCPwithPadding + 12;
420 pbySQ = pbyDAddress + 8 + wPLCPwithPadding + 8;
423 pbyNewRsr = pbyDAddress + 8 + wPLCPwithPadding + 9;
424 pbyRSSI = pbyDAddress + 8 + wPLCPwithPadding + 10;
425 pbyRsr = pbyDAddress + 8 + wPLCPwithPadding + 11;
427 FrameSize = *pwPLCP_Length;
429 pbyFrame = pbyDAddress + 8;
448 if (!compare_ether_addr(pMgmt->
abyCurrBSSID, pMACHeader->abyAddr2)) {
455 if (!is_multicast_ether_addr(pMACHeader->abyAddr1)) {
462 pMACHeader->abyAddr1)) {
469 s_vGetDASA(pbyFrame, &cbHeaderSize, &pDevice->
sRxEthHeader);
487 if (s_bAPModeRxCtl(pDevice, pbyFrame, iSANodeIndex) ==
TRUE) {
498 if ((pDevice->bEnableHostWEP) && (iSANodeIndex >= 0)) {
510 bRxDecryOK = s_bHostWepRxEncryption(pDevice,
521 bRxDecryOK = s_bHandleRxEncryption(pDevice,
579 pbyFrame = skb->
data + 8;
599 pRxPacket->
uRSSI = *pbyRSSI;
600 pRxPacket->
bySQ = *pbySQ;
607 for (ii = 0; ii < (FrameSize - 4); ii++) {
608 *pbyData1 = *pbyData2;
614 pRxPacket->
byRxRate = s_byGetRateIdx(*pbyRxRate);
616 if ( *pbyRxSts == 0 ) {
626 if (pDevice->bEnableHostapd) {
627 skb->
dev = pDevice->apdev;
633 skb_reset_mac_header(skb);
636 memset(skb->cb, 0,
sizeof(skb->cb));
646 if ( bDeFragRx ==
FALSE) {
687 BYTE Protocol_Version;
689 BYTE Descriptor_type;
695 wEtherType = (skb->
data[cbIVOffset + 8 + 24 + 6] << 8) |
696 skb->
data[cbIVOffset + 8 + 24 + 6 + 1];
697 Protocol_Version = skb->
data[cbIVOffset + 8 + 24 + 6 + 1 +1];
698 Packet_Type = skb->
data[cbIVOffset + 8 + 24 + 6 + 1 +1+1];
700 if(((Protocol_Version==1) ||(Protocol_Version==2)) &&
703 Descriptor_type = skb->
data[cbIVOffset + 8 + 24 + 6 + 1 +1+1+1+2];
704 Key_info = (skb->
data[cbIVOffset + 8 + 24 + 6 + 1 +1+1+1+2+1]<<8) |skb->
data[cbIVOffset + 8 + 24 + 6 + 1 +1+1+1+2+2] ;
705 if(Descriptor_type==2) {
708 else if(Descriptor_type==254) {
775 wEtherType = (skb->
data[cbIVOffset + 8 + 24 + 6] << 8) |
776 skb->
data[cbIVOffset + 8 + 24 + 6 + 1];
780 skb->
dev = pDevice->apdev;
782 if (bIsWEP ==
TRUE) {
785 memcpy((skb->
data + 8 + cbIVOffset), &abyMacHdr[0], 24);
788 skb->
data += (cbIVOffset + 8);
789 skb->
tail += (cbIVOffset + 8);
791 skb_reset_mac_header(skb);
794 memset(skb->cb, 0,
sizeof(skb->cb));
817 DWORD dwMIC_Priority;
818 DWORD dwMICKey0 = 0, dwMICKey1 = 0;
819 DWORD dwLocalMIC_L = 0;
820 DWORD dwLocalMIC_R = 0;
851 pdwMIC_L = (
PDWORD)(skb->
data + 8 + FrameSize);
852 pdwMIC_R = (
PDWORD)(skb->
data + 8 + FrameSize + 4);
867 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
873 int keyidx = pbyFrame[cbHeaderSize+3] >> 6;
874 memset(&ev, 0,
sizeof(ev));
886 memset(&wrqu, 0,
sizeof(wrqu));
887 wrqu.
data.length =
sizeof(ev);
888 PRINT_K(
"wireless_send_event--->IWEVMICHAELMICFAILURE\n");
910 skb_reset_mac_header(pDevice->
skb);
929 WORD wLocalTSC15_0 = 0;
930 DWORD dwLocalTSC47_16 = 0;
931 unsigned long long RSC = 0;
933 RSC = *((
unsigned long long *) &(pKey->
KeyRSC));
934 wLocalTSC15_0 = (
WORD) RSC;
935 dwLocalTSC47_16 = (
DWORD) (RSC>>16);
945 if ( (wRxTSC15_0 < wLocalTSC15_0) &&
946 (dwRxTSC47_16 <= dwLocalTSC47_16) &&
947 !((dwRxTSC47_16 == 0) && (dwLocalTSC47_16 == 0xFFFFFFFF))) {
969 s_vProcessRxMACHeader(pDevice, (
PBYTE)(skb->
data+8), FrameSize, bIsWEP, bExtIV, &cbHeaderOffset);
970 FrameSize -= cbHeaderOffset;
978 if (s_bAPModeRxData(pDevice,
997 skb->
data += cbHeaderOffset;
998 skb->
tail += cbHeaderOffset;
1008 pDevice->
dev->name);
1017 static BOOL s_bAPModeRxCtl (
1020 signed int iSANodeIndex
1035 if (iSANodeIndex > 0) {
1042 (
PBYTE)(p802_11Header->abyAddr2),
1054 (
PBYTE)(p802_11Header->abyAddr2),
1107 (
PBYTE)(p802_11Header->abyAddr2),
1113 p802_11Header->abyAddr3);
1115 p802_11Header->abyAddr2);
1117 p802_11Header->abyAddr1);
1127 static BOOL s_bHandleRxEncryption (
1130 unsigned int FrameSize,
1139 unsigned int PayloadLen = FrameSize;
1156 byKeyIdx = (*(pbyIV+3) & 0xc0);
1225 PayloadLen -= (WLAN_HDR_ADDR3_LEN + 4 + 4);
1239 PayloadLen -= (WLAN_HDR_ADDR3_LEN + 8 + 4);
1267 if ((*(pbyIV+3) & 0x20) != 0)
1273 static BOOL s_bHostWepRxEncryption (
1276 unsigned int FrameSize,
1287 unsigned int PayloadLen = FrameSize;
1304 byKeyIdx = (*(pbyIV+3) & 0xc0);
1330 (bOnFly ==
FALSE)) {
1336 PayloadLen -= (WLAN_HDR_ADDR3_LEN + 4 + 4);
1350 PayloadLen -= (WLAN_HDR_ADDR3_LEN + 8 + 4);
1383 if (bOnFly ==
FALSE) {
1398 if ((*(pbyIV+3) & 0x20) != 0)
1405 static BOOL s_bAPModeRxData (
1408 unsigned int FrameSize,
1409 unsigned int cbHeaderOffset,
1410 signed int iSANodeIndex,
1411 signed int iDANodeIndex
1418 BYTE byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80};
1427 if (is_multicast_ether_addr((
PBYTE)(skb->
data+cbHeaderOffset))) {
1430 skbcpy = dev_alloc_skb((
int)pDevice->
rx_buf_sz);
1433 if (skbcpy ==
NULL) {
1437 skbcpy->
dev = pDevice->
dev;
1438 skbcpy->
len = FrameSize;
1447 bRelayAndForward =
TRUE;
1457 skb->
data += cbHeaderOffset;
1458 skb->
tail += cbHeaderOffset;
1464 pMgmt->
abyPSTxMap[wAID >> 3] |= byMask[wAID & 7];
1466 iDANodeIndex, (wAID >> 3), pMgmt->
abyPSTxMap[wAID >> 3]);
1476 if (bRelayOnly || bRelayAndForward) {
1478 if (bRelayAndForward)
1481 if ((pDevice->
uAssocCount > 1) && (iDANodeIndex >= 0)) {
1483 FrameSize, (
unsigned int) iDANodeIndex);
1506 spin_lock_irq(&pDevice->
lock);
1518 spin_unlock_irq(&pDevice->
lock);
1537 if (bReAllocSkb ==
TRUE) {
1543 pRCB->
skb->dev = pDevice->
dev;
1572 spin_lock_irq(&pDevice->
lock);
1585 if(pRCB->
Ref == 0) {
1594 spin_unlock_irq(&pDevice->
lock);