diff options
Diffstat (limited to 'drivers/staging/vt6655/dpc.c')
-rw-r--r-- | drivers/staging/vt6655/dpc.c | 304 |
1 files changed, 83 insertions, 221 deletions
diff --git a/drivers/staging/vt6655/dpc.c b/drivers/staging/vt6655/dpc.c index acc6d82a954..67f238c01b4 100644 --- a/drivers/staging/vt6655/dpc.c +++ b/drivers/staging/vt6655/dpc.c @@ -38,61 +38,22 @@ * */ - -#if !defined(__DEVICE_H__) #include "device.h" -#endif -#if !defined(__RXTX_H__) #include "rxtx.h" -#endif -#if !defined(__TETHER_H__) #include "tether.h" -#endif -#if !defined(__CARD_H__) #include "card.h" -#endif -#if !defined(__BSSDB_H__) #include "bssdb.h" -#endif -#if !defined(__MAC_H__) #include "mac.h" -#endif -#if !defined(__BASEBAND_H__) #include "baseband.h" -#endif -#if !defined(__UMEM_H__) -#include "umem.h" -#endif -#if !defined(__MICHAEL_H__) #include "michael.h" -#endif -#if !defined(__TKIP_H__) #include "tkip.h" -#endif -#if !defined(__TCRC_H__) #include "tcrc.h" -#endif -#if !defined(__WCTL_H__) #include "wctl.h" -#endif -#if !defined(__WROUTE_H__) #include "wroute.h" -#endif -#if !defined(__TBIT_H__) -#include "tbit.h" -#endif -#if !defined(__HOSTAP_H__) #include "hostap.h" -#endif -#if !defined(__RF_H__) #include "rf.h" -#endif -#if !defined(__IOWPA_H__) #include "iowpa.h" -#endif -#if !defined(__AES_H__) #include "aes_ccmp.h" -#endif //#define PLICE_DEBUG @@ -143,17 +104,7 @@ static BOOL s_bAPModeRxCtl( IN INT iSANodeIndex ); -#ifdef PRIVATE_OBJ -static BOOL s_bAPModeRxData ( - IN PSDevice pDevice, - IN ref_sk_buff* skb, - IN UINT FrameSize, - IN UINT cbHeaderOffset, - IN INT iSANodeIndex, - IN INT iDANodeIndex - ); -#else static BOOL s_bAPModeRxData ( IN PSDevice pDevice, @@ -163,7 +114,6 @@ static BOOL s_bAPModeRxData ( IN INT iSANodeIndex, IN INT iDANodeIndex ); -#endif static BOOL s_bHandleRxEncryption( @@ -173,7 +123,7 @@ static BOOL s_bHandleRxEncryption( IN PBYTE pbyRsr, OUT PBYTE pbyNewRsr, OUT PSKeyItem *pKeyOut, - OUT PBOOL pbExtIV, + int * pbExtIV, OUT PWORD pwRxTSC15_0, OUT PDWORD pdwRxTSC47_16 ); @@ -187,7 +137,7 @@ static BOOL s_bHostWepRxEncryption( IN BOOL bOnFly, IN PSKeyItem pKey, OUT PBYTE pbyNewRsr, - OUT PBOOL pbExtIV, + int * pbExtIV, OUT PWORD pwRxTSC15_0, OUT PDWORD pdwRxTSC47_16 @@ -395,11 +345,7 @@ device_receive_frame ( //printk("device_receive_frame:pCurrRD is %x,pRDInfo is %x\n",pCurrRD,pCurrRD->pRDInfo); #endif struct net_device_stats* pStats=&pDevice->stats; -#ifdef PRIVATE_OBJ - ref_sk_buff* skb; -#else struct sk_buff* skb; -#endif PSMgmtObject pMgmt = pDevice->pMgmt; PSRxMgmtPacket pRxPacket = &(pDevice->pMgmt->sRxPacket); PS802_11Header p802_11Header; @@ -434,13 +380,9 @@ device_receive_frame ( PS802_11Header pMACHeader; BOOL bRxeapol_key = FALSE; -// DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---------- device_receive_frame---\n"); -#ifdef PRIVATE_OBJ - skb = &(pRDInfo->ref_skb); -#else +// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---------- device_receive_frame---\n"); skb = pRDInfo->skb; -#endif //PLICE_DEBUG-> @@ -456,7 +398,7 @@ device_receive_frame ( // Min (ACK): 10HD +4CRC + 2Padding + 4Len + 8TSF + 4RSR if ((FrameSize > 2364)||(FrameSize <= 32)) { // Frame Size error drop this packet. - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---------- WRONG Length 1 \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---------- WRONG Length 1 \n"); return FALSE; } @@ -474,7 +416,7 @@ device_receive_frame ( if ((FrameSize > 2346)|(FrameSize < 14)) { // Max: 2312Payload + 30HD +4CRC // Min: 14 bytes ACK - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---------- WRONG Length 2 \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---------- WRONG Length 2 \n"); return FALSE; } //PLICE_DEBUG-> @@ -498,7 +440,7 @@ device_receive_frame ( dwDuration = (FrameSize << 4); dwDuration /= acbyRxRate[*pbyRxRate%MAX_RATE]; if (*pbyRxRate <= RATE_11M) { - if (BITbIsBitOn(*pbyRxSts, 0x01)) { + if (*pbyRxSts & 0x01) { // long preamble dwDuration += 192; } else { @@ -541,11 +483,7 @@ device_receive_frame ( p802_11Header = (PS802_11Header) (pbyFrame); // get SA NodeIndex if (BSSDBbIsSTAInNodeDB(pMgmt, (PBYTE)(p802_11Header->abyAddr2), &iSANodeIndex)) { -#ifdef PRIVATE_OBJ - pMgmt->sNodeDBTable[iSANodeIndex].ulLastRxJiffer = get_jiffies(); -#else pMgmt->sNodeDBTable[iSANodeIndex].ulLastRxJiffer = jiffies; -#endif pMgmt->sNodeDBTable[iSANodeIndex].uInActiveCount = 0; } } @@ -556,10 +494,12 @@ device_receive_frame ( return FALSE; } } + + if (IS_FC_WEP(pbyFrame)) { BOOL bRxDecryOK = FALSE; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"rx WEP pkt\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"rx WEP pkt\n"); bIsWEP = TRUE; if ((pDevice->bEnableHostWEP) && (iSANodeIndex >= 0)) { pKey = &STempKey; @@ -597,7 +537,7 @@ device_receive_frame ( if (bRxDecryOK) { if ((*pbyNewRsr & NEWRSR_DECRYPTOK) == 0) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ICV Fail\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ICV Fail\n"); if ( (pDevice->pMgmt->eAuthenMode == WMAC_AUTH_WPA) || (pDevice->pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK) || (pDevice->pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) || @@ -615,7 +555,7 @@ device_receive_frame ( return FALSE; } } else { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"WEP Func Fail\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"WEP Func Fail\n"); return FALSE; } if ((pKey != NULL) && (pKey->byCipherSuite == KEY_CTL_CCMP)) @@ -631,7 +571,7 @@ device_receive_frame ( //remove the CRC length FrameSize -= U_CRC_LEN; - if ((BITbIsAllBitsOff(*pbyRsr, (RSR_ADDRBROAD | RSR_ADDRMULTI))) && // unicast address + if (( !(*pbyRsr & (RSR_ADDRBROAD | RSR_ADDRMULTI))) && // unicast address (IS_FRAGMENT_PKT((skb->data+4))) ) { // defragment @@ -639,11 +579,7 @@ device_receive_frame ( pDevice->s802_11Counter.ReceivedFragmentCount++; if (bDeFragRx) { // defrag complete -#ifdef PRIVATE_OBJ - skb = &(pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].ref_skb); -#else skb = pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].skb; -#endif FrameSize = pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].cbFrameLength; } @@ -705,25 +641,14 @@ device_receive_frame ( // hostap Deamon handle 802.11 management if (pDevice->bEnableHostapd) { skb->dev = pDevice->apdev; -#ifdef PRIVATE_OBJ - ref_skb_add_offset(skb->skb, 4); - ref_skb_set_dev(pDevice->apdev, skb->skb); - skb_put(skb->skb, FrameSize); - skb->mac_header = skb->data; - *(skb->pkt_type) = PACKET_OTHERHOST; - *(skb->protocol) = htons(ETH_P_802_2); - memset(skb->cb, 0, sizeof(skb->cb)); - netif_rx(skb->skb); -#else skb->data += 4; skb->tail += 4; skb_put(skb, FrameSize); - skb->mac_header = skb->data; + skb_reset_mac_header(skb); skb->pkt_type = PACKET_OTHERHOST; skb->protocol = htons(ETH_P_802_2); memset(skb->cb, 0, sizeof(skb->cb)); netif_rx(skb); -#endif return TRUE; } } @@ -735,10 +660,10 @@ device_receive_frame ( else { if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { //In AP mode, hw only check addr1(BSSID or RA) if equal to local MAC. - if (BITbIsBitOff(*pbyRsr, RSR_BSSIDOK)) { + if ( !(*pbyRsr & RSR_BSSIDOK)) { if (bDeFragRx) { if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) { - DEVICE_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc more frag bufs\n", + DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc more frag bufs\n", pDevice->dev->name); } } @@ -748,16 +673,15 @@ device_receive_frame ( else { // discard DATA packet while not associate || BSSID error if ((pDevice->bLinkPass == FALSE) || - BITbIsBitOff(*pbyRsr, RSR_BSSIDOK)) { + !(*pbyRsr & RSR_BSSIDOK)) { if (bDeFragRx) { if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) { - DEVICE_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc more frag bufs\n", + DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc more frag bufs\n", pDevice->dev->name); } } return FALSE; } - //mike add:station mode check eapol-key challenge---> { BYTE Protocol_Version; //802.1x Authentication @@ -781,11 +705,13 @@ device_receive_frame ( } } + // Data frame Handle + if (pDevice->bEnablePSMode) { if (IS_FC_MOREDATA((skb->data+4))) { - if (BITbIsBitOn(*pbyRsr, RSR_ADDROK)) { + if (*pbyRsr & RSR_ADDROK) { //PSbSendPSPOLL((PSDevice)pDevice); } } @@ -837,7 +763,7 @@ device_receive_frame ( wEtherType = (skb->data[cbIVOffset + 4 + 24 + 6] << 8) | skb->data[cbIVOffset + 4 + 24 + 6 + 1]; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wEtherType = %04x \n", wEtherType); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wEtherType = %04x \n", wEtherType); if (wEtherType == ETH_P_PAE) { skb->dev = pDevice->apdev; @@ -846,26 +772,15 @@ device_receive_frame ( memcpy(&abyMacHdr[0], (skb->data + 4), 24); memcpy((skb->data + 4 + cbIVOffset), &abyMacHdr[0], 24); } -#ifdef PRIVATE_OBJ - ref_skb_add_offset(skb->skb, (cbIVOffset + 4)); - ref_skb_set_dev(pDevice->apdev, skb->skb); - skb_put(skb->skb, FrameSize); - skb->mac_header = skb->data; - *(skb->pkt_type) = PACKET_OTHERHOST; - *(skb->protocol) = htons(ETH_P_802_2); - memset(skb->cb, 0, sizeof(skb->cb)); - netif_rx(skb->skb); -#else skb->data += (cbIVOffset + 4); skb->tail += (cbIVOffset + 4); skb_put(skb, FrameSize); - skb->mac_header = skb->data; + skb_reset_mac_header(skb); skb->pkt_type = PACKET_OTHERHOST; skb->protocol = htons(ETH_P_802_2); memset(skb->cb, 0, sizeof(skb->cb)); netif_rx(skb); -#endif return TRUE; } @@ -925,27 +840,26 @@ device_receive_frame ( pdwMIC_R = (PDWORD)(skb->data + 4 + FrameSize + 4); //DBG_PRN_GRP12(("RxL: %lx, RxR: %lx\n", *pdwMIC_L, *pdwMIC_R)); //DBG_PRN_GRP12(("LocalL: %lx, LocalR: %lx\n", dwLocalMIC_L, dwLocalMIC_R)); - //DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"dwMICKey0= %lx,dwMICKey1= %lx \n", dwMICKey0, dwMICKey1); + //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"dwMICKey0= %lx,dwMICKey1= %lx \n", dwMICKey0, dwMICKey1); if ((cpu_to_le32(*pdwMIC_L) != dwLocalMIC_L) || (cpu_to_le32(*pdwMIC_R) != dwLocalMIC_R) || (pDevice->bRxMICFail == TRUE)) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MIC comparison is fail!\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MIC comparison is fail!\n"); pDevice->bRxMICFail = FALSE; //pDevice->s802_11Counter.TKIPLocalMICFailures.QuadPart++; pDevice->s802_11Counter.TKIPLocalMICFailures++; if (bDeFragRx) { if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) { - DEVICE_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc more frag bufs\n", + DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc more frag bufs\n", pDevice->dev->name); } } - -//2008-0409-07, <Add> by Einsn Liu + //2008-0409-07, <Add> by Einsn Liu #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT //send event to wpa_supplicant //if(pDevice->bWPADevEnable == TRUE) - { + { union iwreq_data wrqu; struct iw_michaelmicfailure ev; int keyidx = pbyFrame[cbHeaderSize+3] >> 6; //top two-bits @@ -967,6 +881,8 @@ device_receive_frame ( } #endif + + if ((pDevice->bWPADEVUp) && (pDevice->skb != NULL)) { wpahdr = (viawget_wpa_header *)pDevice->skb->data; if ((pDevice->pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && @@ -982,7 +898,7 @@ device_receive_frame ( wpahdr->req_ie_len = 0; skb_put(pDevice->skb, sizeof(viawget_wpa_header)); pDevice->skb->dev = pDevice->wpadev; - pDevice->skb->mac_header = pDevice->skb->data; + skb_reset_mac_header(pDevice->skb); pDevice->skb->pkt_type = PACKET_HOST; pDevice->skb->protocol = htons(ETH_P_802_2); memset(pDevice->skb->cb, 0, sizeof(pDevice->skb->cb)); @@ -1012,7 +928,7 @@ device_receive_frame ( RSC = dwRxTSC47_16; RSC <<= 16; RSC += wRxTSC15_0; - MEMvCopy(&(pKey->KeyRSC), &RSC, sizeof(QWORD)); + memcpy(&(pKey->KeyRSC), &RSC, sizeof(QWORD)); if ( (pDevice->sMgmtObj.eCurrMode == WMAC_MODE_ESS_STA) && (pDevice->sMgmtObj.eCurrState == WMAC_STATE_ASSOC)) { @@ -1020,7 +936,7 @@ device_receive_frame ( if ( (wRxTSC15_0 < wLocalTSC15_0) && (dwRxTSC47_16 <= dwLocalTSC47_16) && !((dwRxTSC47_16 == 0) && (dwLocalTSC47_16 == 0xFFFFFFFF))) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TSC is illegal~~!\n "); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TSC is illegal~~!\n "); if (pKey->byCipherSuite == KEY_CTL_TKIP) //pDevice->s802_11Counter.TKIPReplays.QuadPart++; pDevice->s802_11Counter.TKIPReplays++; @@ -1030,7 +946,7 @@ device_receive_frame ( if (bDeFragRx) { if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) { - DEVICE_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc more frag bufs\n", + DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc more frag bufs\n", pDevice->dev->name); } } @@ -1066,7 +982,7 @@ device_receive_frame ( if (bDeFragRx) { if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) { - DEVICE_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc more frag bufs\n", + DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc more frag bufs\n", pDevice->dev->name); } } @@ -1081,34 +997,22 @@ device_receive_frame ( } -#ifdef PRIVATE_OBJ - ref_skb_add_offset(skb->skb, cbHeaderOffset); - skb_put(skb->skb, FrameSize); - *(skb->protocol)=eth_type_trans(skb->skb, skb->dev); - -#else skb->data += cbHeaderOffset; skb->tail += cbHeaderOffset; skb_put(skb, FrameSize); skb->protocol=eth_type_trans(skb, skb->dev); -#endif //drop frame not met IEEE 802.3 /* if (pDevice->flags & DEVICE_FLAGS_VAL_PKT_LEN) { -#ifdef PRIVATE_OBJ - if ((*(skb->protocol)==htons(ETH_P_802_3)) && - (*(skb->len)!=htons(skb->mac.ethernet->h_proto))) { -#else if ((skb->protocol==htons(ETH_P_802_3)) && (skb->len!=htons(skb->mac.ethernet->h_proto))) { -#endif pStats->rx_length_errors++; pStats->rx_dropped++; if (bDeFragRx) { if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) { - DEVICE_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc more frag bufs\n", + DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc more frag bufs\n", pDevice->dev->name); } } @@ -1117,25 +1021,19 @@ device_receive_frame ( } */ -#ifdef PRIVATE_OBJ - *(skb->ip_summed)=CHECKSUM_NONE; - pStats->rx_bytes +=*(skb->len); - pStats->rx_packets++; - netif_rx(skb->skb); -#else skb->ip_summed=CHECKSUM_NONE; pStats->rx_bytes +=skb->len; pStats->rx_packets++; netif_rx(skb); -#endif if (bDeFragRx) { if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) { - DEVICE_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc more frag bufs\n", + DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc more frag bufs\n", pDevice->dev->name); } return FALSE; } + return TRUE; } @@ -1169,7 +1067,7 @@ static BOOL s_bAPModeRxCtl ( (WLAN_MGMT_REASON_CLASS2_NONAUTH), &Status ); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: send vMgrDeAuthenBeginSta 1\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: send vMgrDeAuthenBeginSta 1\n"); return TRUE; }; if (pMgmt->sNodeDBTable[iSANodeIndex].eNodeState < NODE_ASSOC) { @@ -1181,7 +1079,7 @@ static BOOL s_bAPModeRxCtl ( (WLAN_MGMT_REASON_CLASS3_NONASSOC), &Status ); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: send vMgrDisassocBeginSta 2\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: send vMgrDisassocBeginSta 2\n"); return TRUE; }; @@ -1190,7 +1088,7 @@ static BOOL s_bAPModeRxCtl ( if (IS_CTL_PSPOLL(pbyFrame)) { pMgmt->sNodeDBTable[iSANodeIndex].bRxPSPoll = TRUE; bScheduleCommand((HANDLE)pDevice, WLAN_CMD_RX_PSPOLL, NULL); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: WLAN_CMD_RX_PSPOLL 1\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: WLAN_CMD_RX_PSPOLL 1\n"); } else { // check Data PS state @@ -1199,7 +1097,7 @@ static BOOL s_bAPModeRxCtl ( pMgmt->sNodeDBTable[iSANodeIndex].bPSEnable = FALSE; pMgmt->sNodeDBTable[iSANodeIndex].bRxPSPoll = TRUE; bScheduleCommand((HANDLE)pDevice, WLAN_CMD_RX_PSPOLL, NULL); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: WLAN_CMD_RX_PSPOLL 2\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: WLAN_CMD_RX_PSPOLL 2\n"); } } } @@ -1215,7 +1113,7 @@ static BOOL s_bAPModeRxCtl ( pMgmt->sNodeDBTable[iSANodeIndex].bPSEnable = FALSE; pMgmt->sNodeDBTable[iSANodeIndex].bRxPSPoll = TRUE; bScheduleCommand((HANDLE)pDevice, WLAN_CMD_RX_PSPOLL, NULL); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: WLAN_CMD_RX_PSPOLL 3\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: WLAN_CMD_RX_PSPOLL 3\n"); } } @@ -1228,8 +1126,8 @@ static BOOL s_bAPModeRxCtl ( (WLAN_MGMT_REASON_CLASS2_NONAUTH), &Status ); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: send vMgrDeAuthenBeginSta 3\n"); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BSSID:%02x-%02x-%02x=%02x-%02x-%02x \n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: send vMgrDeAuthenBeginSta 3\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BSSID:%02x-%02x-%02x=%02x-%02x-%02x \n", p802_11Header->abyAddr3[0], p802_11Header->abyAddr3[1], p802_11Header->abyAddr3[2], @@ -1237,7 +1135,7 @@ static BOOL s_bAPModeRxCtl ( p802_11Header->abyAddr3[4], p802_11Header->abyAddr3[5] ); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ADDR2:%02x-%02x-%02x=%02x-%02x-%02x \n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ADDR2:%02x-%02x-%02x=%02x-%02x-%02x \n", p802_11Header->abyAddr2[0], p802_11Header->abyAddr2[1], p802_11Header->abyAddr2[2], @@ -1245,7 +1143,7 @@ static BOOL s_bAPModeRxCtl ( p802_11Header->abyAddr2[4], p802_11Header->abyAddr2[5] ); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ADDR1:%02x-%02x-%02x=%02x-%02x-%02x \n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ADDR1:%02x-%02x-%02x=%02x-%02x-%02x \n", p802_11Header->abyAddr1[0], p802_11Header->abyAddr1[1], p802_11Header->abyAddr1[2], @@ -1253,9 +1151,9 @@ static BOOL s_bAPModeRxCtl ( p802_11Header->abyAddr1[4], p802_11Header->abyAddr1[5] ); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: wFrameCtl= %x\n", p802_11Header->wFrameCtl ); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: wFrameCtl= %x\n", p802_11Header->wFrameCtl ); VNSvInPortB(pDevice->PortOffset + MAC_REG_RCR, &(pDevice->byRxMode)); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc:pDevice->byRxMode = %x\n", pDevice->byRxMode ); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc:pDevice->byRxMode = %x\n", pDevice->byRxMode ); return TRUE; } } @@ -1271,7 +1169,7 @@ static BOOL s_bHandleRxEncryption ( IN PBYTE pbyRsr, OUT PBYTE pbyNewRsr, OUT PSKeyItem *pKeyOut, - OUT PBOOL pbExtIV, + int * pbExtIV, OUT PWORD pwRxTSC15_0, OUT PDWORD pdwRxTSC47_16 ) @@ -1295,7 +1193,7 @@ static BOOL s_bHandleRxEncryption ( } byKeyIdx = (*(pbyIV+3) & 0xc0); byKeyIdx >>= 6; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\nKeyIdx: %d\n", byKeyIdx); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\nKeyIdx: %d\n", byKeyIdx); if ((pMgmt->eAuthenMode == WMAC_AUTH_WPA) || (pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK) || @@ -1305,14 +1203,14 @@ static BOOL s_bHandleRxEncryption ( if (((*pbyRsr & (RSR_ADDRBROAD | RSR_ADDRMULTI)) == 0) && (pDevice->pMgmt->byCSSPK != KEY_CTL_NONE)) { // unicast pkt use pairwise key - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"unicast pkt\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"unicast pkt\n"); if (KeybGetKey(&(pDevice->sKey), pDevice->abyBSSID, 0xFFFFFFFF, &pKey) == TRUE) { if (pDevice->pMgmt->byCSSPK == KEY_CTL_TKIP) byDecMode = KEY_CTL_TKIP; else if (pDevice->pMgmt->byCSSPK == KEY_CTL_CCMP) byDecMode = KEY_CTL_CCMP; } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"unicast pkt: %d, %p\n", byDecMode, pKey); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"unicast pkt: %d, %p\n", byDecMode, pKey); } else { // use group key KeybGetKey(&(pDevice->sKey), pDevice->abyBSSID, byKeyIdx, &pKey); @@ -1320,7 +1218,7 @@ static BOOL s_bHandleRxEncryption ( byDecMode = KEY_CTL_TKIP; else if (pDevice->pMgmt->byCSSGK == KEY_CTL_CCMP) byDecMode = KEY_CTL_CCMP; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"group pkt: %d, %d, %p\n", byKeyIdx, byDecMode, pKey); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"group pkt: %d, %d, %p\n", byKeyIdx, byDecMode, pKey); } } // our WEP only support Default Key @@ -1334,10 +1232,10 @@ static BOOL s_bHandleRxEncryption ( } *pKeyOut = pKey; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"AES:%d %d %d\n", pDevice->pMgmt->byCSSPK, pDevice->pMgmt->byCSSGK, byDecMode); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"AES:%d %d %d\n", pDevice->pMgmt->byCSSPK, pDevice->pMgmt->byCSSGK, byDecMode); if (pKey == NULL) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey == NULL\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey == NULL\n"); if (byDecMode == KEY_CTL_WEP) { // pDevice->s802_11Counter.WEPUndecryptableCount.QuadPart++; } else if (pDevice->bLinkPass == TRUE) { @@ -1363,8 +1261,8 @@ static BOOL s_bHandleRxEncryption ( // 2. WEP 256 PayloadLen -= (WLAN_HDR_ADDR3_LEN + 4 + 4); // 24 is 802.11 header,4 is IV, 4 is crc - MEMvCopy(pDevice->abyPRNG, pbyIV, 3); - MEMvCopy(pDevice->abyPRNG + 3, pKey->abyKey, pKey->uKeyLength); + memcpy(pDevice->abyPRNG, pbyIV, 3); + memcpy(pDevice->abyPRNG + 3, pKey->abyKey, pKey->uKeyLength); rc4_init(&pDevice->SBox, pDevice->abyPRNG, pKey->uKeyLength + 3); rc4_encrypt(&pDevice->SBox, pbyIV+4, pbyIV+4, PayloadLen); @@ -1378,13 +1276,13 @@ static BOOL s_bHandleRxEncryption ( PayloadLen -= (WLAN_HDR_ADDR3_LEN + 8 + 4); // 24 is 802.11 header, 8 is IV&ExtIV, 4 is crc *pdwRxTSC47_16 = cpu_to_le32(*(PDWORD)(pbyIV + 4)); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ExtIV: %lx\n",*pdwRxTSC47_16); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ExtIV: %lx\n",*pdwRxTSC47_16); if (byDecMode == KEY_CTL_TKIP) { *pwRxTSC15_0 = cpu_to_le16(MAKEWORD(*(pbyIV+2), *pbyIV)); } else { *pwRxTSC15_0 = cpu_to_le16(*(PWORD)pbyIV); } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TSC0_15: %x\n", *pwRxTSC15_0); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TSC0_15: %x\n", *pwRxTSC15_0); if ((byDecMode == KEY_CTL_TKIP) && (pDevice->byLocalID <= REV_ID_VT3253_A1)) { @@ -1396,10 +1294,10 @@ static BOOL s_bHandleRxEncryption ( rc4_encrypt(&pDevice->SBox, pbyIV+8, pbyIV+8, PayloadLen); if (ETHbIsBufferCrc32Ok(pbyIV+8, PayloadLen)) { *pbyNewRsr |= NEWRSR_DECRYPTOK; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ICV OK!\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ICV OK!\n"); } else { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ICV FAIL!!!\n"); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"PayloadLen = %d\n", PayloadLen); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ICV FAIL!!!\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"PayloadLen = %d\n", PayloadLen); } } }// end of TKIP/AES @@ -1418,7 +1316,7 @@ static BOOL s_bHostWepRxEncryption ( IN BOOL bOnFly, IN PSKeyItem pKey, OUT PBYTE pbyNewRsr, - OUT PBOOL pbExtIV, + int * pbExtIV, OUT PWORD pwRxTSC15_0, OUT PDWORD pdwRxTSC47_16 ) @@ -1442,7 +1340,7 @@ static BOOL s_bHostWepRxEncryption ( } byKeyIdx = (*(pbyIV+3) & 0xc0); byKeyIdx >>= 6; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\nKeyIdx: %d\n", byKeyIdx); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\nKeyIdx: %d\n", byKeyIdx); if (pDevice->pMgmt->byCSSGK == KEY_CTL_TKIP) @@ -1450,7 +1348,7 @@ static BOOL s_bHostWepRxEncryption ( else if (pDevice->pMgmt->byCSSGK == KEY_CTL_CCMP) byDecMode = KEY_CTL_CCMP; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"AES:%d %d %d\n", pDevice->pMgmt->byCSSPK, pDevice->pMgmt->byCSSGK, byDecMode); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"AES:%d %d %d\n", pDevice->pMgmt->byCSSPK, pDevice->pMgmt->byCSSGK, byDecMode); if (byDecMode != pKey->byCipherSuite) { if (byDecMode == KEY_CTL_WEP) { @@ -1463,7 +1361,7 @@ static BOOL s_bHostWepRxEncryption ( if (byDecMode == KEY_CTL_WEP) { // handle WEP - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"byDecMode == KEY_CTL_WEP \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"byDecMode == KEY_CTL_WEP \n"); if ((pDevice->byLocalID <= REV_ID_VT3253_A1) || (((PSKeyTable)(pKey->pvKeyTable))->bSoftWEP == TRUE) || (bOnFly == FALSE)) { @@ -1473,8 +1371,8 @@ static BOOL s_bHostWepRxEncryption ( // 3. NotOnFly PayloadLen -= (WLAN_HDR_ADDR3_LEN + 4 + 4); // 24 is 802.11 header,4 is IV, 4 is crc - MEMvCopy(pDevice->abyPRNG, pbyIV, 3); - MEMvCopy(pDevice->abyPRNG + 3, pKey->abyKey, pKey->uKeyLength); + memcpy(pDevice->abyPRNG, pbyIV, 3); + memcpy(pDevice->abyPRNG + 3, pKey->abyKey, pKey->uKeyLength); rc4_init(&pDevice->SBox, pDevice->abyPRNG, pKey->uKeyLength + 3); rc4_encrypt(&pDevice->SBox, pbyIV+4, pbyIV+4, PayloadLen); @@ -1488,31 +1386,32 @@ static BOOL s_bHostWepRxEncryption ( PayloadLen -= (WLAN_HDR_ADDR3_LEN + 8 + 4); // 24 is 802.11 header, 8 is IV&ExtIV, 4 is crc *pdwRxTSC47_16 = cpu_to_le32(*(PDWORD)(pbyIV + 4)); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ExtIV: %lx\n",*pdwRxTSC47_16); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ExtIV: %lx\n",*pdwRxTSC47_16); if (byDecMode == KEY_CTL_TKIP) { *pwRxTSC15_0 = cpu_to_le16(MAKEWORD(*(pbyIV+2), *pbyIV)); } else { *pwRxTSC15_0 = cpu_to_le16(*(PWORD)pbyIV); } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TSC0_15: %x\n", *pwRxTSC15_0); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TSC0_15: %x\n", *pwRxTSC15_0); if (byDecMode == KEY_CTL_TKIP) { + if ((pDevice->byLocalID <= REV_ID_VT3253_A1) || (bOnFly == FALSE)) { // Software TKIP // 1. 3253 A // 2. NotOnFly - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"soft KEY_CTL_TKIP \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"soft KEY_CTL_TKIP \n"); pMACHeader = (PS802_11Header) (pbyFrame); TKIPvMixKey(pKey->abyKey, pMACHeader->abyAddr2, *pwRxTSC15_0, *pdwRxTSC47_16, pDevice->abyPRNG); rc4_init(&pDevice->SBox, pDevice->abyPRNG, TKIP_KEY_LEN); rc4_encrypt(&pDevice->SBox, pbyIV+8, pbyIV+8, PayloadLen); if (ETHbIsBufferCrc32Ok(pbyIV+8, PayloadLen)) { *pbyNewRsr |= NEWRSR_DECRYPTOK; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ICV OK!\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ICV OK!\n"); } else { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ICV FAIL!!!\n"); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"PayloadLen = %d\n", PayloadLen); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ICV FAIL!!!\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"PayloadLen = %d\n", PayloadLen); } } } @@ -1521,12 +1420,12 @@ static BOOL s_bHostWepRxEncryption ( if (bOnFly == FALSE) { // Software CCMP // NotOnFly - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"soft KEY_CTL_CCMP\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"soft KEY_CTL_CCMP\n"); if (AESbGenCCMP(pKey->abyKey, pbyFrame, FrameSize)) { *pbyNewRsr |= NEWRSR_DECRYPTOK; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"CCMP MIC compare OK!\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"CCMP MIC compare OK!\n"); } else { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"CCMP MIC fail!\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"CCMP MIC fail!\n"); } } } @@ -1540,20 +1439,6 @@ static BOOL s_bHostWepRxEncryption ( - -#ifdef PRIVATE_OBJ - -static BOOL s_bAPModeRxData ( - IN PSDevice pDevice, - IN ref_sk_buff* skb, - IN UINT FrameSize, - IN UINT cbHeaderOffset, - IN INT iSANodeIndex, - IN INT iDANodeIndex - ) - -#else - static BOOL s_bAPModeRxData ( IN PSDevice pDevice, IN struct sk_buff* skb, @@ -1562,22 +1447,15 @@ static BOOL s_bAPModeRxData ( IN INT iSANodeIndex, IN INT iDANodeIndex ) -#endif { PSMgmtObject pMgmt = pDevice->pMgmt; BOOL bRelayAndForward = FALSE; BOOL bRelayOnly = FALSE; BYTE byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80}; WORD wAID; -#ifdef PRIVATE_OBJ - struct sk_buff* tmp_skb; - ref_sk_buff s_ref_skb; - ref_sk_buff* skbcpy = &s_ref_skb; -#else - struct sk_buff* skbcpy = NULL; -#endif + struct sk_buff* skbcpy = NULL; if (FrameSize > CB_MAX_BUF_SIZE) return FALSE; @@ -1585,28 +1463,18 @@ static BOOL s_bAPModeRxData ( if(IS_MULTICAST_ADDRESS((PBYTE)(skb->data+cbHeaderOffset))) { if (pMgmt->sNodeDBTable[0].bPSEnable) { -#ifdef PRIVATE_OBJ - tmp_skb = dev_alloc_skb((int)pDevice->rx_buf_sz); - skbcpy = &s_ref_skb; - ref_skb_remap(pDevice->dev, skbcpy, tmp_skb); -#else skbcpy = dev_alloc_skb((int)pDevice->rx_buf_sz); -#endif + // if any node in PS mode, buffer packet until DTIM. if (skbcpy == NULL) { - DEVICE_PRT(MSG_LEVEL_NOTICE, KERN_INFO "relay multicast no skb available \n"); + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "relay multicast no skb available \n"); } else { skbcpy->dev = pDevice->dev; -#ifdef PRIVATE_OBJ - *(skbcpy->len) = FrameSize; - memcpy(skbcpy->data, skb->data+cbHeaderOffset, FrameSize); - skb_queue_tail(&(pMgmt->sNodeDBTable[0].sTxPSQueue), skbcpy->skb); -#else skbcpy->len = FrameSize; memcpy(skbcpy->data, skb->data+cbHeaderOffset, FrameSize); skb_queue_tail(&(pMgmt->sNodeDBTable[0].sTxPSQueue), skbcpy); -#endif + pMgmt->sNodeDBTable[0].wEnQueueCnt++; // set tx map pMgmt->abyPSTxMap[0] |= byMask[0]; @@ -1623,20 +1491,14 @@ static BOOL s_bAPModeRxData ( if (pMgmt->sNodeDBTable[iDANodeIndex].bPSEnable) { // queue this skb until next PS tx, and then release. -#ifdef PRIVATE_OBJ - ref_skb_add_offset(skb->skb, cbHeaderOffset); - skb_put(skb->skb, FrameSize); - skb_queue_tail(&pMgmt->sNodeDBTable[iDANodeIndex].sTxPSQueue, skb->skb); -#else skb->data += cbHeaderOffset; skb->tail += cbHeaderOffset; skb_put(skb, FrameSize); skb_queue_tail(&pMgmt->sNodeDBTable[iDANodeIndex].sTxPSQueue, skb); -#endif pMgmt->sNodeDBTable[iDANodeIndex].wEnQueueCnt++; wAID = pMgmt->sNodeDBTable[iDANodeIndex].wAID; pMgmt->abyPSTxMap[wAID >> 3] |= byMask[wAID & 7]; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "relay: index= %d, pMgmt->abyPSTxMap[%d]= %d\n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "relay: index= %d, pMgmt->abyPSTxMap[%d]= %d\n", iDANodeIndex, (wAID >> 3), pMgmt->abyPSTxMap[wAID >> 3]); return TRUE; } |