diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-10-26 15:39:02 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-10-26 15:39:02 +0200 |
commit | aa77677e0a288e08073620db5d2a31df83ca4788 (patch) | |
tree | 0d14b995a21c43f365d66b9ad101a334109fc4e4 /drivers/staging/vt6655 | |
parent | efb8d21b2c6db3497655cc6a033ae8a9883e4063 (diff) | |
parent | 43a3beb6da994549ec28a9f31727b997a025f958 (diff) | |
download | op-kernel-dev-aa77677e0a288e08073620db5d2a31df83ca4788.zip op-kernel-dev-aa77677e0a288e08073620db5d2a31df83ca4788.tar.gz |
Merge branch 'staging-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
* 'staging-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (1519 commits)
staging: et131x: Remove redundant check and return statement
staging: et131x: Mainly whitespace changes to appease checkpatch
staging: et131x: Remove last of the forward declarations
staging: et131x: Remove even more forward declarations
staging: et131x: Remove yet more forward declarations
staging: et131x: Remove more forward declarations
staging: et131x: Remove forward declaration of et131x_adapter_setup
staging: et131x: Remove some forward declarations
staging: et131x: Remove unused rx_ring.recv_packet_pool
staging: et131x: Remove call to find pci pm capability
staging: et131x: Remove redundant et131x_reset_recv() call
staging: et131x: Remove unused rx_ring.recv_buffer_pool
Staging: bcm: Fix three initialization errors in InterfaceDld.c
Staging: bcm: Fix coding style issues in InterfaceDld.c
staging:iio:dac: Add AD5360 driver
staging:iio:trigger:bfin-timer: Fix compile error
Staging: vt6655: add some range checks before memcpy()
Staging: vt6655: whitespace fixes to iotcl.c
Staging: vt6656: add some range checks before memcpy()
Staging: vt6656: whitespace cleanups in ioctl.c
...
Fix up conflicts in:
- drivers/{Kconfig,Makefile}, drivers/staging/{Kconfig,Makefile}:
vg driver movement
- drivers/staging/brcm80211/brcmfmac/{dhd_linux.c,mac80211_if.c}:
driver removal vs now stale changes
- drivers/staging/rtl8192e/r8192E_core.c:
driver removal vs now stale changes
- drivers/staging/et131x/et131*:
driver consolidation into one file, tried to do fixups
Diffstat (limited to 'drivers/staging/vt6655')
-rw-r--r-- | drivers/staging/vt6655/IEEE11h.c | 406 | ||||
-rw-r--r-- | drivers/staging/vt6655/device_main.c | 10 | ||||
-rw-r--r-- | drivers/staging/vt6655/dpc.c | 30 | ||||
-rw-r--r-- | drivers/staging/vt6655/ioctl.c | 1092 | ||||
-rw-r--r-- | drivers/staging/vt6655/wmgr.c | 49 | ||||
-rw-r--r-- | drivers/staging/vt6655/wpactl.c | 4 |
6 files changed, 733 insertions, 858 deletions
diff --git a/drivers/staging/vt6655/IEEE11h.c b/drivers/staging/vt6655/IEEE11h.c index e07ebd5..cf7364d 100644 --- a/drivers/staging/vt6655/IEEE11h.c +++ b/drivers/staging/vt6655/IEEE11h.c @@ -41,52 +41,52 @@ #include "channel.h" /*--------------------- Static Definitions -------------------------*/ -static int msglevel =MSG_LEVEL_INFO; +static int msglevel = MSG_LEVEL_INFO; #pragma pack(1) typedef struct _WLAN_FRAME_ACTION { - WLAN_80211HDR_A3 Header; - unsigned char byCategory; - unsigned char byAction; - unsigned char abyVars[1]; + WLAN_80211HDR_A3 Header; + unsigned char byCategory; + unsigned char byAction; + unsigned char abyVars[1]; } WLAN_FRAME_ACTION, *PWLAN_FRAME_ACTION; typedef struct _WLAN_FRAME_MSRREQ { - WLAN_80211HDR_A3 Header; - unsigned char byCategory; - unsigned char byAction; - unsigned char byDialogToken; - WLAN_IE_MEASURE_REQ sMSRReqEIDs[1]; + WLAN_80211HDR_A3 Header; + unsigned char byCategory; + unsigned char byAction; + unsigned char byDialogToken; + WLAN_IE_MEASURE_REQ sMSRReqEIDs[1]; } WLAN_FRAME_MSRREQ, *PWLAN_FRAME_MSRREQ; typedef struct _WLAN_FRAME_MSRREP { - WLAN_80211HDR_A3 Header; - unsigned char byCategory; - unsigned char byAction; - unsigned char byDialogToken; - WLAN_IE_MEASURE_REP sMSRRepEIDs[1]; + WLAN_80211HDR_A3 Header; + unsigned char byCategory; + unsigned char byAction; + unsigned char byDialogToken; + WLAN_IE_MEASURE_REP sMSRRepEIDs[1]; } WLAN_FRAME_MSRREP, *PWLAN_FRAME_MSRREP; typedef struct _WLAN_FRAME_TPCREQ { - WLAN_80211HDR_A3 Header; - unsigned char byCategory; - unsigned char byAction; - unsigned char byDialogToken; - WLAN_IE_TPC_REQ sTPCReqEIDs; + WLAN_80211HDR_A3 Header; + unsigned char byCategory; + unsigned char byAction; + unsigned char byDialogToken; + WLAN_IE_TPC_REQ sTPCReqEIDs; } WLAN_FRAME_TPCREQ, *PWLAN_FRAME_TPCREQ; typedef struct _WLAN_FRAME_TPCREP { - WLAN_80211HDR_A3 Header; - unsigned char byCategory; - unsigned char byAction; - unsigned char byDialogToken; - WLAN_IE_TPC_REP sTPCRepEIDs; + WLAN_80211HDR_A3 Header; + unsigned char byCategory; + unsigned char byAction; + unsigned char byDialogToken; + WLAN_IE_TPC_REP sTPCRepEIDs; } WLAN_FRAME_TPCREP, *PWLAN_FRAME_TPCREP; #pragma pack() -// action field reference ieee 802.11h Table 20e +/* action field reference ieee 802.11h Table 20e */ #define ACTION_MSRREQ 0 #define ACTION_MSRREP 1 #define ACTION_TPCREQ 2 @@ -101,84 +101,100 @@ typedef struct _WLAN_FRAME_TPCREP { static bool s_bRxMSRReq(PSMgmtObject pMgmt, PWLAN_FRAME_MSRREQ pMSRReq, unsigned int uLength) { - size_t uNumOfEIDs = 0; - bool bResult = true; - - if (uLength <= WLAN_A3FR_MAXLEN) { - memcpy(pMgmt->abyCurrentMSRReq, pMSRReq, uLength); - } - uNumOfEIDs = ((uLength - offsetof(WLAN_FRAME_MSRREQ, sMSRReqEIDs))/ (sizeof(WLAN_IE_MEASURE_REQ))); - pMgmt->pCurrMeasureEIDRep = &(((PWLAN_FRAME_MSRREP) (pMgmt->abyCurrentMSRRep))->sMSRRepEIDs[0]); - pMgmt->uLengthOfRepEIDs = 0; - bResult = CARDbStartMeasure(pMgmt->pAdapter, - ((PWLAN_FRAME_MSRREQ) (pMgmt->abyCurrentMSRReq))->sMSRReqEIDs, - uNumOfEIDs - ); - return (bResult); + size_t uNumOfEIDs = 0; + bool bResult = true; + + if (uLength <= WLAN_A3FR_MAXLEN) + memcpy(pMgmt->abyCurrentMSRReq, pMSRReq, uLength); + uNumOfEIDs = ((uLength - offsetof(WLAN_FRAME_MSRREQ, + sMSRReqEIDs))/ + (sizeof(WLAN_IE_MEASURE_REQ))); + pMgmt->pCurrMeasureEIDRep = &(((PWLAN_FRAME_MSRREP) + (pMgmt->abyCurrentMSRRep))->sMSRRepEIDs[0]); + pMgmt->uLengthOfRepEIDs = 0; + bResult = CARDbStartMeasure(pMgmt->pAdapter, + ((PWLAN_FRAME_MSRREQ) + (pMgmt->abyCurrentMSRReq))->sMSRReqEIDs, + uNumOfEIDs + ); + return bResult; } -static bool s_bRxTPCReq(PSMgmtObject pMgmt, PWLAN_FRAME_TPCREQ pTPCReq, unsigned char byRate, unsigned char byRSSI) +static bool s_bRxTPCReq(PSMgmtObject pMgmt, + PWLAN_FRAME_TPCREQ pTPCReq, + unsigned char byRate, + unsigned char byRSSI) { - PWLAN_FRAME_TPCREP pFrame; - PSTxMgmtPacket pTxPacket = NULL; - - - pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool; - memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN); - pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket)); - - pFrame = (PWLAN_FRAME_TPCREP)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket)); - - pFrame->Header.wFrameCtl = ( WLAN_SET_FC_FTYPE(WLAN_FTYPE_MGMT) | - WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_ACTION) - ); - - memcpy( pFrame->Header.abyAddr1, pTPCReq->Header.abyAddr2, WLAN_ADDR_LEN); - memcpy( pFrame->Header.abyAddr2, CARDpGetCurrentAddress(pMgmt->pAdapter), WLAN_ADDR_LEN); - memcpy( pFrame->Header.abyAddr3, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN); - - pFrame->byCategory = 0; - pFrame->byAction = 3; - pFrame->byDialogToken = ((PWLAN_FRAME_MSRREQ) (pMgmt->abyCurrentMSRReq))->byDialogToken; - - pFrame->sTPCRepEIDs.byElementID = WLAN_EID_TPC_REP; - pFrame->sTPCRepEIDs.len = 2; - pFrame->sTPCRepEIDs.byTxPower = CARDbyGetTransmitPower(pMgmt->pAdapter); - switch (byRate) { - case RATE_54M: - pFrame->sTPCRepEIDs.byLinkMargin = 65 - byRSSI; - break; - case RATE_48M: - pFrame->sTPCRepEIDs.byLinkMargin = 66 - byRSSI; - break; - case RATE_36M: - pFrame->sTPCRepEIDs.byLinkMargin = 70 - byRSSI; - break; - case RATE_24M: - pFrame->sTPCRepEIDs.byLinkMargin = 74 - byRSSI; - break; - case RATE_18M: - pFrame->sTPCRepEIDs.byLinkMargin = 77 - byRSSI; - break; - case RATE_12M: - pFrame->sTPCRepEIDs.byLinkMargin = 79 - byRSSI; - break; - case RATE_9M: - pFrame->sTPCRepEIDs.byLinkMargin = 81 - byRSSI; - break; - case RATE_6M: - default: - pFrame->sTPCRepEIDs.byLinkMargin = 82 - byRSSI; - break; - } - - pTxPacket->cbMPDULen = sizeof(WLAN_FRAME_TPCREP); - pTxPacket->cbPayloadLen = sizeof(WLAN_FRAME_TPCREP) - WLAN_HDR_ADDR3_LEN; - if (csMgmt_xmit(pMgmt->pAdapter, pTxPacket) != CMD_STATUS_PENDING) - return (false); - return (true); -// return (CARDbSendPacket(pMgmt->pAdapter, pFrame, PKT_TYPE_802_11_MNG, sizeof(WLAN_FRAME_TPCREP))); + PWLAN_FRAME_TPCREP pFrame; + PSTxMgmtPacket pTxPacket = NULL; + + pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool; + memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN); + pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + +sizeof(STxMgmtPacket)); + + pFrame = (PWLAN_FRAME_TPCREP)((unsigned char *)pTxPacket + +sizeof(STxMgmtPacket)); + + pFrame->Header.wFrameCtl = (WLAN_SET_FC_FTYPE(WLAN_FTYPE_MGMT) | + WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_ACTION) + ); + + memcpy(pFrame->Header.abyAddr1, + pTPCReq->Header.abyAddr2, + WLAN_ADDR_LEN); + memcpy(pFrame->Header.abyAddr2, + CARDpGetCurrentAddress(pMgmt->pAdapter), + WLAN_ADDR_LEN); + memcpy(pFrame->Header.abyAddr3, + pMgmt->abyCurrBSSID, + WLAN_BSSID_LEN); + + pFrame->byCategory = 0; + pFrame->byAction = 3; + pFrame->byDialogToken = ((PWLAN_FRAME_MSRREQ) +(pMgmt->abyCurrentMSRReq))->byDialogToken; + + pFrame->sTPCRepEIDs.byElementID = WLAN_EID_TPC_REP; + pFrame->sTPCRepEIDs.len = 2; + pFrame->sTPCRepEIDs.byTxPower = CARDbyGetTransmitPower(pMgmt->pAdapter); + switch (byRate) { + case RATE_54M: + pFrame->sTPCRepEIDs.byLinkMargin = 65 - byRSSI; + break; + case RATE_48M: + pFrame->sTPCRepEIDs.byLinkMargin = 66 - byRSSI; + break; + case RATE_36M: + pFrame->sTPCRepEIDs.byLinkMargin = 70 - byRSSI; + break; + case RATE_24M: + pFrame->sTPCRepEIDs.byLinkMargin = 74 - byRSSI; + break; + case RATE_18M: + pFrame->sTPCRepEIDs.byLinkMargin = 77 - byRSSI; + break; + case RATE_12M: + pFrame->sTPCRepEIDs.byLinkMargin = 79 - byRSSI; + break; + case RATE_9M: + pFrame->sTPCRepEIDs.byLinkMargin = 81 - byRSSI; + break; + case RATE_6M: + default: + pFrame->sTPCRepEIDs.byLinkMargin = 82 - byRSSI; + break; +} + + pTxPacket->cbMPDULen = sizeof(WLAN_FRAME_TPCREP); + pTxPacket->cbPayloadLen = sizeof(WLAN_FRAME_TPCREP) - +WLAN_HDR_ADDR3_LEN; + if (csMgmt_xmit(pMgmt->pAdapter, pTxPacket) != CMD_STATUS_PENDING) + return false; + return true; +/* return (CARDbSendPacket(pMgmt->pAdapter, pFrame, PKT_TYPE_802_11_MNG, +sizeof(WLAN_FRAME_TPCREP))); */ } @@ -204,102 +220,110 @@ static bool s_bRxTPCReq(PSMgmtObject pMgmt, PWLAN_FRAME_TPCREQ pTPCReq, unsigned * -*/ bool -IEEE11hbMgrRxAction ( - void *pMgmtHandle, - void *pRxPacket - ) +IEEE11hbMgrRxAction(void *pMgmtHandle, void *pRxPacket) { - PSMgmtObject pMgmt = (PSMgmtObject) pMgmtHandle; - PWLAN_FRAME_ACTION pAction = NULL; - unsigned int uLength = 0; - PWLAN_IE_CH_SW pChannelSwitch = NULL; - - - // decode the frame - uLength = ((PSRxMgmtPacket)pRxPacket)->cbMPDULen; - if (uLength > WLAN_A3FR_MAXLEN) { - return (false); - } - - - pAction = (PWLAN_FRAME_ACTION) (((PSRxMgmtPacket)pRxPacket)->p80211Header); - - if (pAction->byCategory == 0) { - switch (pAction->byAction) { - case ACTION_MSRREQ: - return (s_bRxMSRReq(pMgmt, (PWLAN_FRAME_MSRREQ) pAction, uLength)); - break; - case ACTION_MSRREP: - break; - case ACTION_TPCREQ: - return (s_bRxTPCReq(pMgmt, - (PWLAN_FRAME_TPCREQ) pAction, - ((PSRxMgmtPacket)pRxPacket)->byRxRate, - (unsigned char) ((PSRxMgmtPacket)pRxPacket)->uRSSI)); - break; - case ACTION_TPCREP: - break; - case ACTION_CHSW: - pChannelSwitch = (PWLAN_IE_CH_SW) (pAction->abyVars); - if ((pChannelSwitch->byElementID == WLAN_EID_CH_SWITCH) && - (pChannelSwitch->len == 3)) { - // valid element id - CARDbChannelSwitch( pMgmt->pAdapter, - pChannelSwitch->byMode, - get_channel_mapping(pMgmt->pAdapter, pChannelSwitch->byChannel, pMgmt->eCurrentPHYMode), - pChannelSwitch->byCount - ); - } - break; - default: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Unknown Action = %d\n", pAction->byAction); - break; - } - } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Unknown Category = %d\n", pAction->byCategory); - pAction->byCategory |= 0x80; - - //return (CARDbSendPacket(pMgmt->pAdapter, pAction, PKT_TYPE_802_11_MNG, uLength)); - return (true); - } - return (true); + PSMgmtObject pMgmt = (PSMgmtObject) pMgmtHandle; + PWLAN_FRAME_ACTION pAction = NULL; + unsigned int uLength = 0; + PWLAN_IE_CH_SW pChannelSwitch = NULL; + + /* decode the frame */ + uLength = ((PSRxMgmtPacket)pRxPacket)->cbMPDULen; + if (uLength > WLAN_A3FR_MAXLEN) + return false; + + pAction = (PWLAN_FRAME_ACTION) +(((PSRxMgmtPacket)pRxPacket)->p80211Header); + + if (pAction->byCategory == 0) { + switch (pAction->byAction) { + case ACTION_MSRREQ: + return s_bRxMSRReq(pMgmt, + (PWLAN_FRAME_MSRREQ) + pAction, + uLength); + break; + case ACTION_MSRREP: + break; + case ACTION_TPCREQ: + return s_bRxTPCReq(pMgmt, + (PWLAN_FRAME_TPCREQ) pAction, + ((PSRxMgmtPacket)pRxPacket)->byRxRate, + (unsigned char) + ((PSRxMgmtPacket)pRxPacket)->uRSSI); + break; + case ACTION_TPCREP: + break; + case ACTION_CHSW: + pChannelSwitch = (PWLAN_IE_CH_SW) (pAction->abyVars); + if ((pChannelSwitch->byElementID == WLAN_EID_CH_SWITCH) + && (pChannelSwitch->len == 3)) { + /* valid element id */ + CARDbChannelSwitch(pMgmt->pAdapter, + pChannelSwitch->byMode, + get_channel_mapping(pMgmt->pAdapter, + pChannelSwitch->byChannel, + pMgmt->eCurrentPHYMode), + pChannelSwitch->byCount); + } + break; + default: + DBG_PRT(MSG_LEVEL_DEBUG, + KERN_INFO"Unknown Action = %d\n", + pAction->byAction); + break; + } + } else { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Unknown Category = %d\n", +pAction->byCategory); + pAction->byCategory |= 0x80; + + /*return (CARDbSendPacket(pMgmt->pAdapter, pAction, PKT_TYPE_802_11_MNG, +uLength));*/ + return true; + } + return true; } -bool IEEE11hbMSRRepTx ( - void *pMgmtHandle - ) +bool IEEE11hbMSRRepTx(void *pMgmtHandle) { - PSMgmtObject pMgmt = (PSMgmtObject) pMgmtHandle; - PWLAN_FRAME_MSRREP pMSRRep = (PWLAN_FRAME_MSRREP) (pMgmt->abyCurrentMSRRep + sizeof(STxMgmtPacket)); - size_t uLength = 0; - PSTxMgmtPacket pTxPacket = NULL; - - pTxPacket = (PSTxMgmtPacket)pMgmt->abyCurrentMSRRep; - memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN); - pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket)); - - - pMSRRep->Header.wFrameCtl = ( WLAN_SET_FC_FTYPE(WLAN_FTYPE_MGMT) | - WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_ACTION) - ); - - memcpy( pMSRRep->Header.abyAddr1, ((PWLAN_FRAME_MSRREQ) (pMgmt->abyCurrentMSRReq))->Header.abyAddr2, WLAN_ADDR_LEN); - memcpy( pMSRRep->Header.abyAddr2, CARDpGetCurrentAddress(pMgmt->pAdapter), WLAN_ADDR_LEN); - memcpy( pMSRRep->Header.abyAddr3, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN); - - pMSRRep->byCategory = 0; - pMSRRep->byAction = 1; - pMSRRep->byDialogToken = ((PWLAN_FRAME_MSRREQ) (pMgmt->abyCurrentMSRReq))->byDialogToken; - - uLength = pMgmt->uLengthOfRepEIDs + offsetof(WLAN_FRAME_MSRREP, sMSRRepEIDs); - - pTxPacket->cbMPDULen = uLength; - pTxPacket->cbPayloadLen = uLength - WLAN_HDR_ADDR3_LEN; - if (csMgmt_xmit(pMgmt->pAdapter, pTxPacket) != CMD_STATUS_PENDING) - return (false); - return (true); -// return (CARDbSendPacket(pMgmt->pAdapter, pMSRRep, PKT_TYPE_802_11_MNG, uLength)); + PSMgmtObject pMgmt = (PSMgmtObject) pMgmtHandle; + PWLAN_FRAME_MSRREP pMSRRep = (PWLAN_FRAME_MSRREP) +(pMgmt->abyCurrentMSRRep + sizeof(STxMgmtPacket)); + size_t uLength = 0; + PSTxMgmtPacket pTxPacket = NULL; + + pTxPacket = (PSTxMgmtPacket)pMgmt->abyCurrentMSRRep; + memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN); + pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + +sizeof(STxMgmtPacket)); + + pMSRRep->Header.wFrameCtl = (WLAN_SET_FC_FTYPE(WLAN_FTYPE_MGMT) | + WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_ACTION) + ); + + memcpy(pMSRRep->Header.abyAddr1, ((PWLAN_FRAME_MSRREQ) + (pMgmt->abyCurrentMSRReq))->Header.abyAddr2, WLAN_ADDR_LEN); + memcpy(pMSRRep->Header.abyAddr2, + CARDpGetCurrentAddress(pMgmt->pAdapter), WLAN_ADDR_LEN); + memcpy(pMSRRep->Header.abyAddr3, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN); + + pMSRRep->byCategory = 0; + pMSRRep->byAction = 1; + pMSRRep->byDialogToken = ((PWLAN_FRAME_MSRREQ) + (pMgmt->abyCurrentMSRReq))->byDialogToken; + + uLength = pMgmt->uLengthOfRepEIDs + offsetof(WLAN_FRAME_MSRREP, + sMSRRepEIDs); + + pTxPacket->cbMPDULen = uLength; + pTxPacket->cbPayloadLen = uLength - WLAN_HDR_ADDR3_LEN; + if (csMgmt_xmit(pMgmt->pAdapter, pTxPacket) != CMD_STATUS_PENDING) + return false; + return true; +/* return (CARDbSendPacket(pMgmt->pAdapter, pMSRRep, PKT_TYPE_802_11_MNG, +uLength)); */ } diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index 8cb9116..d8dd784 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -815,14 +815,8 @@ else CARDbRadioPowerOn(pDevice); pMgmt->eScanType = WMAC_SCAN_PASSIVE; // get Permanent network address SROMvReadEtherAddress(pDevice->PortOffset, pDevice->abyCurrentNetAddr); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Network address = %02x-%02x-%02x=%02x-%02x-%02x\n", - pDevice->abyCurrentNetAddr[0], - pDevice->abyCurrentNetAddr[1], - pDevice->abyCurrentNetAddr[2], - pDevice->abyCurrentNetAddr[3], - pDevice->abyCurrentNetAddr[4], - pDevice->abyCurrentNetAddr[5]); - + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Network address = %pM\n", + pDevice->abyCurrentNetAddr); // reset Tx pointer CARDvSafeResetRx(pDevice); diff --git a/drivers/staging/vt6655/dpc.c b/drivers/staging/vt6655/dpc.c index cf0deac..c0fab4b 100644 --- a/drivers/staging/vt6655/dpc.c +++ b/drivers/staging/vt6655/dpc.c @@ -1107,30 +1107,12 @@ static bool s_bAPModeRxCtl ( &Status ); 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], - p802_11Header->abyAddr3[3], - p802_11Header->abyAddr3[4], - p802_11Header->abyAddr3[5] - ); - 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], - p802_11Header->abyAddr2[3], - p802_11Header->abyAddr2[4], - p802_11Header->abyAddr2[5] - ); - 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], - p802_11Header->abyAddr1[3], - p802_11Header->abyAddr1[4], - p802_11Header->abyAddr1[5] - ); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BSSID:%pM\n", + p802_11Header->abyAddr3); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ADDR2:%pM\n", + p802_11Header->abyAddr2); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ADDR1:%pM\n", + p802_11Header->abyAddr1); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: wFrameCtl= %x\n", p802_11Header->wFrameCtl ); VNSvInPortB(pDevice->PortOffset + MAC_REG_RCR, &(pDevice->byRxMode)); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc:pDevice->byRxMode = %x\n", pDevice->byRxMode ); diff --git a/drivers/staging/vt6655/ioctl.c b/drivers/staging/vt6655/ioctl.c index 8cf88c3..432a209 100644 --- a/drivers/staging/vt6655/ioctl.c +++ b/drivers/staging/vt6655/ioctl.c @@ -38,715 +38,617 @@ #include "wpactl.h" #include "rf.h" -/*--------------------- Static Definitions -------------------------*/ - -/*--------------------- Static Classes ----------------------------*/ - -/*--------------------- Static Variables --------------------------*/ -//static int msglevel =MSG_LEVEL_DEBUG; -static int msglevel =MSG_LEVEL_INFO; +static int msglevel = MSG_LEVEL_INFO; #ifdef WPA_SM_Transtatus - SWPAResult wpa_Result; + SWPAResult wpa_Result; #endif -/*--------------------- Static Functions --------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -int private_ioctl(PSDevice pDevice, struct ifreq *rq) { - - PSCmdRequest pReq = (PSCmdRequest)rq; - PSMgmtObject pMgmt = pDevice->pMgmt; - int result = 0; - PWLAN_IE_SSID pItemSSID; - SCmdBSSJoin sJoinCmd; - SCmdZoneTypeSet sZoneTypeCmd; - SCmdScan sScanCmd; - SCmdStartAP sStartAPCmd; - SCmdSetWEP sWEPCmd; - SCmdValue sValue; - SBSSIDList sList; - SNodeList sNodeList; - PSBSSIDList pList; - PSNodeList pNodeList; - unsigned int cbListCount; - PKnownBSS pBSS; - PKnownNodeDB pNode; - unsigned int ii, jj; - SCmdLinkStatus sLinkStatus; - unsigned char abySuppRates[] = {WLAN_EID_SUPP_RATES, 4, 0x02, 0x04, 0x0B, 0x16}; - unsigned char abyNullAddr[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - unsigned long dwKeyIndex= 0; - unsigned char abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; - long ldBm; - - pReq->wResult = 0; - - switch (pReq->wCmdCode) { - - case WLAN_CMD_BSS_SCAN: - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_BSS_SCAN..begin \n"); - if (copy_from_user(&sScanCmd, pReq->data, sizeof(SCmdScan))) { +int private_ioctl(PSDevice pDevice, struct ifreq *rq) +{ + PSCmdRequest pReq = (PSCmdRequest)rq; + PSMgmtObject pMgmt = pDevice->pMgmt; + int result = 0; + PWLAN_IE_SSID pItemSSID; + SCmdBSSJoin sJoinCmd; + SCmdZoneTypeSet sZoneTypeCmd; + SCmdScan sScanCmd; + SCmdStartAP sStartAPCmd; + SCmdSetWEP sWEPCmd; + SCmdValue sValue; + SBSSIDList sList; + SNodeList sNodeList; + PSBSSIDList pList; + PSNodeList pNodeList; + unsigned int cbListCount; + PKnownBSS pBSS; + PKnownNodeDB pNode; + unsigned int ii, jj; + SCmdLinkStatus sLinkStatus; + unsigned char abySuppRates[] = {WLAN_EID_SUPP_RATES, 4, 0x02, 0x04, 0x0B, 0x16}; + unsigned char abyNullAddr[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + unsigned long dwKeyIndex = 0; + unsigned char abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; + long ldBm; + + pReq->wResult = 0; + + switch (pReq->wCmdCode) { + case WLAN_CMD_BSS_SCAN: + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_BSS_SCAN..begin\n"); + if (copy_from_user(&sScanCmd, pReq->data, sizeof(SCmdScan))) { result = -EFAULT; break; } - pItemSSID = (PWLAN_IE_SSID)sScanCmd.ssid; - if (pItemSSID->len != 0) { - memset(abyScanSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); - memcpy(abyScanSSID, pItemSSID, pItemSSID->len + WLAN_IEHDR_LEN); - } - - if (pDevice->bMACSuspend == true) { - if (pDevice->bRadioOff == true) - CARDbRadioPowerOn(pDevice); - vMgrTimerInit(pDevice); - MACvIntEnable(pDevice->PortOffset, IMR_MASK_VALUE); - add_timer(&pMgmt->sTimerSecondCallback); - pDevice->bMACSuspend = false; - } - spin_lock_irq(&pDevice->lock); - if (memcmp(pMgmt->abyCurrBSSID, &abyNullAddr[0], 6) == 0) - BSSvClearBSSList((void *)pDevice, false); - else - BSSvClearBSSList((void *)pDevice, pDevice->bLinkPass); - - if (pItemSSID->len != 0) - bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, abyScanSSID); - else - bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, NULL); - spin_unlock_irq(&pDevice->lock); - break; - - case WLAN_CMD_ZONETYPE_SET: - //mike add :cann't support. - result=-EOPNOTSUPP; - break; - - if (copy_from_user(&sZoneTypeCmd, pReq->data, sizeof(SCmdZoneTypeSet))) { - result = -EFAULT; - break; + pItemSSID = (PWLAN_IE_SSID)sScanCmd.ssid; + if (pItemSSID->len > WLAN_SSID_MAXLEN + 1) + return -EINVAL; + if (pItemSSID->len != 0) { + memset(abyScanSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); + memcpy(abyScanSSID, pItemSSID, pItemSSID->len + WLAN_IEHDR_LEN); + } + + if (pDevice->bMACSuspend == true) { + if (pDevice->bRadioOff == true) + CARDbRadioPowerOn(pDevice); + vMgrTimerInit(pDevice); + MACvIntEnable(pDevice->PortOffset, IMR_MASK_VALUE); + add_timer(&pMgmt->sTimerSecondCallback); + pDevice->bMACSuspend = false; } + spin_lock_irq(&pDevice->lock); + if (memcmp(pMgmt->abyCurrBSSID, &abyNullAddr[0], 6) == 0) + BSSvClearBSSList((void *)pDevice, false); + else + BSSvClearBSSList((void *)pDevice, pDevice->bLinkPass); + + if (pItemSSID->len != 0) + bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, abyScanSSID); + else + bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, NULL); + spin_unlock_irq(&pDevice->lock); + break; - if(sZoneTypeCmd.bWrite==true) { - //////write zonetype - if(sZoneTypeCmd.ZoneType == ZoneType_USA) { - //set to USA - printk("set_ZoneType:USA\n"); - } - else if(sZoneTypeCmd.ZoneType == ZoneType_Japan) { - //set to Japan - printk("set_ZoneType:Japan\n"); - } - else if(sZoneTypeCmd.ZoneType == ZoneType_Europe) { - //set to Europe - printk("set_ZoneType:Europe\n"); - } - } - else { - ///////read zonetype - unsigned char zonetype=0; - - - if(zonetype == 0x00) { //USA - sZoneTypeCmd.ZoneType = ZoneType_USA; - } - else if(zonetype == 0x01) { //Japan - sZoneTypeCmd.ZoneType = ZoneType_Japan; - } - else if(zonetype == 0x02) { //Europe - sZoneTypeCmd.ZoneType = ZoneType_Europe; - } - else { //Unknown ZoneType - printk("Error:ZoneType[%x] Unknown ???\n",zonetype); - result = -EFAULT; + case WLAN_CMD_ZONETYPE_SET: + /* mike add :cann't support. */ + result = -EOPNOTSUPP; break; - } - if (copy_to_user(pReq->data, &sZoneTypeCmd, sizeof(SCmdZoneTypeSet))) { + + if (copy_from_user(&sZoneTypeCmd, pReq->data, sizeof(SCmdZoneTypeSet))) { result = -EFAULT; break; } - } - break; - - case WLAN_CMD_BSS_JOIN: + if (sZoneTypeCmd.bWrite == true) { + /* write zonetype */ + if (sZoneTypeCmd.ZoneType == ZoneType_USA) { + /* set to USA */ + printk("set_ZoneType:USA\n"); + } else if (sZoneTypeCmd.ZoneType == ZoneType_Japan) { + /* set to Japan */ + printk("set_ZoneType:Japan\n"); + } else if (sZoneTypeCmd.ZoneType == ZoneType_Europe) { + /* set to Europe */ + printk("set_ZoneType:Europe\n"); + } + } else { + /* read zonetype */ + unsigned char zonetype = 0; + + if (zonetype == 0x00) { /* USA */ + sZoneTypeCmd.ZoneType = ZoneType_USA; + } else if (zonetype == 0x01) { /* Japan */ + sZoneTypeCmd.ZoneType = ZoneType_Japan; + } else if (zonetype == 0x02) { /* Europe */ + sZoneTypeCmd.ZoneType = ZoneType_Europe; + } else { /* Unknown ZoneType */ + printk("Error:ZoneType[%x] Unknown ???\n", zonetype); + result = -EFAULT; + break; + } + if (copy_to_user(pReq->data, &sZoneTypeCmd, sizeof(SCmdZoneTypeSet))) { + result = -EFAULT; + break; + } + } + break; - if (pDevice->bMACSuspend == true) { - if (pDevice->bRadioOff == true) - CARDbRadioPowerOn(pDevice); - vMgrTimerInit(pDevice); - MACvIntEnable(pDevice->PortOffset, IMR_MASK_VALUE); - add_timer(&pMgmt->sTimerSecondCallback); - pDevice->bMACSuspend = false; - } + case WLAN_CMD_BSS_JOIN: + if (pDevice->bMACSuspend == true) { + if (pDevice->bRadioOff == true) + CARDbRadioPowerOn(pDevice); + vMgrTimerInit(pDevice); + MACvIntEnable(pDevice->PortOffset, IMR_MASK_VALUE); + add_timer(&pMgmt->sTimerSecondCallback); + pDevice->bMACSuspend = false; + } - if (copy_from_user(&sJoinCmd, pReq->data, sizeof(SCmdBSSJoin))) { + if (copy_from_user(&sJoinCmd, pReq->data, sizeof(SCmdBSSJoin))) { result = -EFAULT; break; } - pItemSSID = (PWLAN_IE_SSID)sJoinCmd.ssid; - memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); + pItemSSID = (PWLAN_IE_SSID)sJoinCmd.ssid; + if (pItemSSID->len > WLAN_SSID_MAXLEN + 1) + return -EINVAL; + memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); memcpy(pMgmt->abyDesireSSID, pItemSSID, pItemSSID->len + WLAN_IEHDR_LEN); - if (sJoinCmd.wBSSType == ADHOC) { - pMgmt->eConfigMode = WMAC_CONFIG_IBSS_STA; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ioct set to adhoc mode\n"); - } - else { - pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ioct set to STA mode\n"); - } - if (sJoinCmd.bPSEnable == true) { - pDevice->ePSMode = WMAC_POWER_FAST; -// pDevice->ePSMode = WMAC_POWER_MAX; - pMgmt->wListenInterval = 2; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Power Saving On\n"); - } - else { - pDevice->ePSMode = WMAC_POWER_CAM; - pMgmt->wListenInterval = 1; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Power Saving Off \n"); - } - - if (sJoinCmd.bShareKeyAuth == true){ - pMgmt->bShareKeyAlgorithm = true; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Share Key \n"); - } - else { - pMgmt->bShareKeyAlgorithm = false; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Open System \n"); - } - pDevice->uChannel = sJoinCmd.uChannel; - netif_stop_queue(pDevice->dev); - spin_lock_irq(&pDevice->lock); - pMgmt->eCurrState = WMAC_STATE_IDLE; - bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID); - bScheduleCommand((void *) pDevice, WLAN_CMD_SSID, NULL); - spin_unlock_irq(&pDevice->lock); - break; - - case WLAN_CMD_SET_WEP: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_WEP Key. \n"); - memset(&sWEPCmd, 0 ,sizeof(SCmdSetWEP)); - if (copy_from_user(&sWEPCmd, pReq->data, sizeof(SCmdSetWEP))) { + if (sJoinCmd.wBSSType == ADHOC) { + pMgmt->eConfigMode = WMAC_CONFIG_IBSS_STA; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ioct set to adhoc mode\n"); + } else { + pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ioct set to STA mode\n"); + } + if (sJoinCmd.bPSEnable == true) { + pDevice->ePSMode = WMAC_POWER_FAST; + pMgmt->wListenInterval = 2; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Power Saving On\n"); + } else { + pDevice->ePSMode = WMAC_POWER_CAM; + pMgmt->wListenInterval = 1; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Power Saving Off\n"); + } + + if (sJoinCmd.bShareKeyAuth == true) { + pMgmt->bShareKeyAlgorithm = true; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Share Key\n"); + } else { + pMgmt->bShareKeyAlgorithm = false; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Open System\n"); + } + pDevice->uChannel = sJoinCmd.uChannel; + netif_stop_queue(pDevice->dev); + spin_lock_irq(&pDevice->lock); + pMgmt->eCurrState = WMAC_STATE_IDLE; + bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID); + bScheduleCommand((void *) pDevice, WLAN_CMD_SSID, NULL); + spin_unlock_irq(&pDevice->lock); + break; + + case WLAN_CMD_SET_WEP: + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_WEP Key.\n"); + memset(&sWEPCmd, 0, sizeof(SCmdSetWEP)); + if (copy_from_user(&sWEPCmd, pReq->data, sizeof(SCmdSetWEP))) { result = -EFAULT; break; } - if (sWEPCmd.bEnableWep != true) { - pDevice->bEncryptionEnable = false; - pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; - MACvDisableDefaultKey(pDevice->PortOffset); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WEP function disable. \n"); - break; - } - - for (ii = 0; ii < WLAN_WEP_NKEYS; ii ++) { - if (sWEPCmd.bWepKeyAvailable[ii]) { - if (ii == sWEPCmd.byKeyIndex) - //2006-1123-02,<Modify> by EinsnLiu - //Evaluate the "dwKeyIndex" error - // dwKeyIndex |= (1 << 31); - dwKeyIndex =ii|(1 << 31); - else - dwKeyIndex = ii; - - KeybSetDefaultKey(&(pDevice->sKey), - dwKeyIndex, - sWEPCmd.auWepKeyLength[ii], - NULL, - (unsigned char *)&sWEPCmd.abyWepKey[ii][0], - KEY_CTL_WEP, - pDevice->PortOffset, - pDevice->byLocalID); - } - } - pDevice->byKeyIndex = sWEPCmd.byKeyIndex; - pDevice->bTransmitKey = true; - pDevice->bEncryptionEnable = true; - pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; - - break; - - case WLAN_CMD_GET_LINK: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_GET_LINK status. \n"); - - memset(sLinkStatus.abySSID, 0 , WLAN_SSID_MAXLEN + 1); - - if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) - sLinkStatus.wBSSType = ADHOC; - else - sLinkStatus.wBSSType = INFRA; - - if (pMgmt->eCurrState == WMAC_STATE_JOINTED) - sLinkStatus.byState = ADHOC_JOINTED; - else - sLinkStatus.byState = ADHOC_STARTED; - - sLinkStatus.uChannel = pMgmt->uCurrChannel; - if (pDevice->bLinkPass == true) { - sLinkStatus.bLink = true; - pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID; - memcpy(sLinkStatus.abySSID, pItemSSID->abySSID, pItemSSID->len); - memcpy(sLinkStatus.abyBSSID, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN); - sLinkStatus.uLinkRate = pMgmt->sNodeDBTable[0].wTxDataRate; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Link Success ! \n"); - } - else { - sLinkStatus.bLink = false; - } - if (copy_to_user(pReq->data, &sLinkStatus, sizeof(SCmdLinkStatus))) { - result = -EFAULT; + if (sWEPCmd.bEnableWep != true) { + pDevice->bEncryptionEnable = false; + pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; + MACvDisableDefaultKey(pDevice->PortOffset); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WEP function disable.\n"); break; } - break; + for (ii = 0; ii < WLAN_WEP_NKEYS; ii++) { + if (sWEPCmd.bWepKeyAvailable[ii]) { + if (ii == sWEPCmd.byKeyIndex) + dwKeyIndex = ii | (1 << 31); + else + dwKeyIndex = ii; + + KeybSetDefaultKey(&(pDevice->sKey), + dwKeyIndex, + sWEPCmd.auWepKeyLength[ii], + NULL, + (unsigned char *)&sWEPCmd.abyWepKey[ii][0], + KEY_CTL_WEP, + pDevice->PortOffset, + pDevice->byLocalID); + } + } + pDevice->byKeyIndex = sWEPCmd.byKeyIndex; + pDevice->bTransmitKey = true; + pDevice->bEncryptionEnable = true; + pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; + break; - case WLAN_CMD_GET_LISTLEN: + case WLAN_CMD_GET_LINK: + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_GET_LINK status.\n"); + + memset(sLinkStatus.abySSID, 0 , WLAN_SSID_MAXLEN + 1); + + if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) + sLinkStatus.wBSSType = ADHOC; + else + sLinkStatus.wBSSType = INFRA; + + if (pMgmt->eCurrState == WMAC_STATE_JOINTED) + sLinkStatus.byState = ADHOC_JOINTED; + else + sLinkStatus.byState = ADHOC_STARTED; + + sLinkStatus.uChannel = pMgmt->uCurrChannel; + if (pDevice->bLinkPass == true) { + sLinkStatus.bLink = true; + pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID; + memcpy(sLinkStatus.abySSID, pItemSSID->abySSID, pItemSSID->len); + memcpy(sLinkStatus.abyBSSID, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN); + sLinkStatus.uLinkRate = pMgmt->sNodeDBTable[0].wTxDataRate; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Link Success!\n"); + } else { + sLinkStatus.bLink = false; + sLinkStatus.uLinkRate = 0; + } + if (copy_to_user(pReq->data, &sLinkStatus, sizeof(SCmdLinkStatus))) { + result = -EFAULT; + break; + } + break; + + case WLAN_CMD_GET_LISTLEN: cbListCount = 0; pBSS = &(pMgmt->sBSSList[0]); - for (ii = 0; ii < MAX_BSS_NUM; ii++) { - pBSS = &(pMgmt->sBSSList[ii]); - if (!pBSS->bActive) - continue; - cbListCount++; - } - sList.uItem = cbListCount; - if (copy_to_user(pReq->data, &sList, sizeof(SBSSIDList))) { + for (ii = 0; ii < MAX_BSS_NUM; ii++) { + pBSS = &(pMgmt->sBSSList[ii]); + if (!pBSS->bActive) + continue; + cbListCount++; + } + sList.uItem = cbListCount; + if (copy_to_user(pReq->data, &sList, sizeof(SBSSIDList))) { result = -EFAULT; break; } - pReq->wResult = 0; - break; + pReq->wResult = 0; + break; - case WLAN_CMD_GET_LIST: - if (copy_from_user(&sList, pReq->data, sizeof(SBSSIDList))) { + case WLAN_CMD_GET_LIST: + if (copy_from_user(&sList, pReq->data, sizeof(SBSSIDList))) { result = -EFAULT; break; } - pList = (PSBSSIDList)kmalloc(sizeof(SBSSIDList) + (sList.uItem * sizeof(SBSSIDItem)), (int)GFP_ATOMIC); - if (pList == NULL) { - result = -ENOMEM; - break; - } + pList = (PSBSSIDList)kmalloc(sizeof(SBSSIDList) + (sList.uItem * sizeof(SBSSIDItem)), (int)GFP_ATOMIC); + if (pList == NULL) { + result = -ENOMEM; + break; + } pList->uItem = sList.uItem; pBSS = &(pMgmt->sBSSList[0]); - for (ii = 0, jj = 0; jj < MAX_BSS_NUM ; jj++) { - pBSS = &(pMgmt->sBSSList[jj]); - if (pBSS->bActive) { - pList->sBSSIDList[ii].uChannel = pBSS->uChannel; - pList->sBSSIDList[ii].wBeaconInterval = pBSS->wBeaconInterval; - pList->sBSSIDList[ii].wCapInfo = pBSS->wCapInfo; -// pList->sBSSIDList[ii].uRSSI = pBSS->uRSSI; - RFvRSSITodBm(pDevice, (unsigned char)(pBSS->uRSSI), &ldBm); - pList->sBSSIDList[ii].uRSSI = (unsigned int)ldBm; - memcpy(pList->sBSSIDList[ii].abyBSSID, pBSS->abyBSSID, WLAN_BSSID_LEN); - pItemSSID = (PWLAN_IE_SSID)pBSS->abySSID; - memset(pList->sBSSIDList[ii].abySSID, 0, WLAN_SSID_MAXLEN + 1); - memcpy(pList->sBSSIDList[ii].abySSID, pItemSSID->abySSID, pItemSSID->len); - if (WLAN_GET_CAP_INFO_ESS(pBSS->wCapInfo)) { - pList->sBSSIDList[ii].byNetType = INFRA; - } - else { - pList->sBSSIDList[ii].byNetType = ADHOC; - } - if (WLAN_GET_CAP_INFO_PRIVACY(pBSS->wCapInfo)) { - pList->sBSSIDList[ii].bWEPOn = true; - } - else { - pList->sBSSIDList[ii].bWEPOn = false; - } - ii ++; - if (ii >= pList->uItem) - break; - } - } - - if (copy_to_user(pReq->data, pList, sizeof(SBSSIDList) + (sList.uItem * sizeof(SBSSIDItem)))) { + for (ii = 0, jj = 0; jj < MAX_BSS_NUM ; jj++) { + pBSS = &(pMgmt->sBSSList[jj]); + if (pBSS->bActive) { + pList->sBSSIDList[ii].uChannel = pBSS->uChannel; + pList->sBSSIDList[ii].wBeaconInterval = pBSS->wBeaconInterval; + pList->sBSSIDList[ii].wCapInfo = pBSS->wCapInfo; + /* pList->sBSSIDList[ii].uRSSI = pBSS->uRSSI; */ + RFvRSSITodBm(pDevice, (unsigned char)(pBSS->uRSSI), &ldBm); + pList->sBSSIDList[ii].uRSSI = (unsigned int)ldBm; + memcpy(pList->sBSSIDList[ii].abyBSSID, pBSS->abyBSSID, WLAN_BSSID_LEN); + pItemSSID = (PWLAN_IE_SSID)pBSS->abySSID; + memset(pList->sBSSIDList[ii].abySSID, 0, WLAN_SSID_MAXLEN + 1); + memcpy(pList->sBSSIDList[ii].abySSID, pItemSSID->abySSID, pItemSSID->len); + if (WLAN_GET_CAP_INFO_ESS(pBSS->wCapInfo)) { + pList->sBSSIDList[ii].byNetType = INFRA; + } else { + pList->sBSSIDList[ii].byNetType = ADHOC; + } + if (WLAN_GET_CAP_INFO_PRIVACY(pBSS->wCapInfo)) { + pList->sBSSIDList[ii].bWEPOn = true; + } else { + pList->sBSSIDList[ii].bWEPOn = false; + } + ii++; + if (ii >= pList->uItem) + break; + } + } + + if (copy_to_user(pReq->data, pList, sizeof(SBSSIDList) + (sList.uItem * sizeof(SBSSIDItem)))) { result = -EFAULT; break; } - kfree(pList); - pReq->wResult = 0; - break; + kfree(pList); + pReq->wResult = 0; + break; - case WLAN_CMD_GET_MIB: - if (copy_to_user(pReq->data, &(pDevice->s802_11Counter), sizeof(SDot11MIBCount))) { + case WLAN_CMD_GET_MIB: + if (copy_to_user(pReq->data, &(pDevice->s802_11Counter), sizeof(SDot11MIBCount))) { result = -EFAULT; break; } - break; + break; - case WLAN_CMD_GET_STAT: - if (copy_to_user(pReq->data, &(pDevice->scStatistic), sizeof(SStatCounter))) { + case WLAN_CMD_GET_STAT: + if (copy_to_user(pReq->data, &(pDevice->scStatistic), sizeof(SStatCounter))) { result = -EFAULT; break; } - break; - case WLAN_CMD_STOP_MAC: - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_STOP_MAC\n"); - netif_stop_queue(pDevice->dev); - - spin_lock_irq(&pDevice->lock); - if (pDevice->bRadioOff == false) { - CARDbRadioPowerOff(pDevice); - } - pDevice->bLinkPass = false; - memset(pMgmt->abyCurrBSSID, 0, 6); - pMgmt->eCurrState = WMAC_STATE_IDLE; - del_timer(&pDevice->sTimerCommand); - del_timer(&pMgmt->sTimerSecondCallback); - pDevice->bCmdRunning = false; - pDevice->bMACSuspend = true; - MACvIntDisable(pDevice->PortOffset); - spin_unlock_irq(&pDevice->lock); - - break; + break; - case WLAN_CMD_START_MAC: + case WLAN_CMD_STOP_MAC: + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_STOP_MAC\n"); + netif_stop_queue(pDevice->dev); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_START_MAC\n"); + spin_lock_irq(&pDevice->lock); + if (pDevice->bRadioOff == false) { + CARDbRadioPowerOff(pDevice); + } + pDevice->bLinkPass = false; + memset(pMgmt->abyCurrBSSID, 0, 6); + pMgmt->eCurrState = WMAC_STATE_IDLE; + del_timer(&pDevice->sTimerCommand); + del_timer(&pMgmt->sTimerSecondCallback); + pDevice->bCmdRunning = false; + pDevice->bMACSuspend = true; + MACvIntDisable(pDevice->PortOffset); + spin_unlock_irq(&pDevice->lock); + break; - if (pDevice->bMACSuspend == true) { - if (pDevice->bRadioOff == true) - CARDbRadioPowerOn(pDevice); - vMgrTimerInit(pDevice); - MACvIntEnable(pDevice->PortOffset, IMR_MASK_VALUE); - add_timer(&pMgmt->sTimerSecondCallback); - pDevice->bMACSuspend = false; - } - break; + case WLAN_CMD_START_MAC: + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_START_MAC\n"); - case WLAN_CMD_SET_HOSTAPD: + if (pDevice->bMACSuspend == true) { + if (pDevice->bRadioOff == true) + CARDbRadioPowerOn(pDevice); + vMgrTimerInit(pDevice); + MACvIntEnable(pDevice->PortOffset, IMR_MASK_VALUE); + add_timer(&pMgmt->sTimerSecondCallback); + pDevice->bMACSuspend = false; + } + break; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_HOSTAPD\n"); + case WLAN_CMD_SET_HOSTAPD: + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_HOSTAPD\n"); - if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) { + if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) { result = -EFAULT; break; } if (sValue.dwValue == 1) { - if (vt6655_hostap_set_hostapd(pDevice, 1, 1) == 0){ - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable HOSTAP\n"); - } - else { - result = -EFAULT; - break; + if (vt6655_hostap_set_hostapd(pDevice, 1, 1) == 0) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable HOSTAP\n"); + } else { + result = -EFAULT; + break; } - } - else { - vt6655_hostap_set_hostapd(pDevice, 0, 1); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable HOSTAP\n"); - } - - break; - - case WLAN_CMD_SET_HOSTAPD_STA: - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_HOSTAPD_STA\n"); + } else { + vt6655_hostap_set_hostapd(pDevice, 0, 1); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable HOSTAP\n"); + } + break; - break; - case WLAN_CMD_SET_802_1X: + case WLAN_CMD_SET_HOSTAPD_STA: + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_HOSTAPD_STA\n"); + break; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_802_1X\n"); - if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) { + case WLAN_CMD_SET_802_1X: + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_802_1X\n"); + if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) { result = -EFAULT; break; } if (sValue.dwValue == 1) { - pDevice->bEnable8021x = true; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable 802.1x\n"); - } - else { - pDevice->bEnable8021x = false; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable 802.1x\n"); - } - - break; - - - case WLAN_CMD_SET_HOST_WEP: + pDevice->bEnable8021x = true; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable 802.1x\n"); + } else { + pDevice->bEnable8021x = false; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable 802.1x\n"); + } + break; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_HOST_WEP\n"); - if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) { + case WLAN_CMD_SET_HOST_WEP: + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_HOST_WEP\n"); + if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) { result = -EFAULT; break; } if (sValue.dwValue == 1) { - pDevice->bEnableHostWEP = true; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable HostWEP\n"); - } - else { - pDevice->bEnableHostWEP = false; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable HostWEP\n"); - } - - break; + pDevice->bEnableHostWEP = true; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable HostWEP\n"); + } else { + pDevice->bEnableHostWEP = false; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable HostWEP\n"); + } + break; - case WLAN_CMD_SET_WPA: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_WPA\n"); + case WLAN_CMD_SET_WPA: + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_WPA\n"); - if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) { + if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) { result = -EFAULT; break; } if (sValue.dwValue == 1) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "up wpadev\n"); - memcpy(pDevice->wpadev->dev_addr, pDevice->dev->dev_addr, ETH_ALEN); - pDevice->bWPADEVUp = true; - } - else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "close wpadev\n"); - pDevice->bWPADEVUp = false; - } - - break; - - case WLAN_CMD_AP_START: - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_AP_START\n"); - if (pDevice->bRadioOff == true) { - CARDbRadioPowerOn(pDevice); - vMgrTimerInit(pDevice); - MACvIntEnable(pDevice->PortOffset, IMR_MASK_VALUE); - add_timer(&pMgmt->sTimerSecondCallback); - } - if (copy_from_user(&sStartAPCmd, pReq->data, sizeof(SCmdStartAP))) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "up wpadev\n"); + memcpy(pDevice->wpadev->dev_addr, pDevice->dev->dev_addr, ETH_ALEN); + pDevice->bWPADEVUp = true; + } else { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "close wpadev\n"); + pDevice->bWPADEVUp = false; + } + break; + + case WLAN_CMD_AP_START: + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_AP_START\n"); + if (pDevice->bRadioOff == true) { + CARDbRadioPowerOn(pDevice); + vMgrTimerInit(pDevice); + MACvIntEnable(pDevice->PortOffset, IMR_MASK_VALUE); + add_timer(&pMgmt->sTimerSecondCallback); + } + if (copy_from_user(&sStartAPCmd, pReq->data, sizeof(SCmdStartAP))) { result = -EFAULT; break; } - if (sStartAPCmd.wBSSType == AP) { - pMgmt->eConfigMode = WMAC_CONFIG_AP; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ioct set to AP mode\n"); - } - else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ioct BSS type not set to AP mode\n"); + if (sStartAPCmd.wBSSType == AP) { + pMgmt->eConfigMode = WMAC_CONFIG_AP; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ioct set to AP mode\n"); + } else { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ioct BSS type not set to AP mode\n"); result = -EFAULT; break; - } - + } - if (sStartAPCmd.wBBPType == PHY80211g) { - pMgmt->byAPBBType = PHY_TYPE_11G; - } - else if (sStartAPCmd.wBBPType == PHY80211a) { - pMgmt->byAPBBType = PHY_TYPE_11A; - } - else { - pMgmt->byAPBBType = PHY_TYPE_11B; - } + if (sStartAPCmd.wBBPType == PHY80211g) { + pMgmt->byAPBBType = PHY_TYPE_11G; + } else if (sStartAPCmd.wBBPType == PHY80211a) { + pMgmt->byAPBBType = PHY_TYPE_11A; + } else { + pMgmt->byAPBBType = PHY_TYPE_11B; + } - pItemSSID = (PWLAN_IE_SSID)sStartAPCmd.ssid; - memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); + pItemSSID = (PWLAN_IE_SSID)sStartAPCmd.ssid; + if (pItemSSID->len > WLAN_SSID_MAXLEN + 1) + return -EINVAL; + memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); memcpy(pMgmt->abyDesireSSID, pItemSSID, pItemSSID->len + WLAN_IEHDR_LEN); - if ((sStartAPCmd.uChannel > 0)&&(sStartAPCmd.uChannel <= 14)) - pDevice->uChannel = sStartAPCmd.uChannel; - - if ((sStartAPCmd.uBeaconInt >= 20) && (sStartAPCmd.uBeaconInt <= 1000)) - pMgmt->wIBSSBeaconPeriod = sStartAPCmd.uBeaconInt; - else - pMgmt->wIBSSBeaconPeriod = 100; - - if (sStartAPCmd.bShareKeyAuth == true){ - pMgmt->bShareKeyAlgorithm = true; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Share Key \n"); - } - else { - pMgmt->bShareKeyAlgorithm = false; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Open System \n"); - } - memcpy(pMgmt->abyIBSSSuppRates, abySuppRates, 6); - - if (sStartAPCmd.byBasicRate & BIT3) { - pMgmt->abyIBSSSuppRates[2] |= BIT7; - pMgmt->abyIBSSSuppRates[3] |= BIT7; - pMgmt->abyIBSSSuppRates[4] |= BIT7; - pMgmt->abyIBSSSuppRates[5] |= BIT7; - }else if (sStartAPCmd.byBasicRate & BIT2) { - pMgmt->abyIBSSSuppRates[2] |= BIT7; - pMgmt->abyIBSSSuppRates[3] |= BIT7; - pMgmt->abyIBSSSuppRates[4] |= BIT7; - }else if (sStartAPCmd.byBasicRate & BIT1) { - pMgmt->abyIBSSSuppRates[2] |= BIT7; - pMgmt->abyIBSSSuppRates[3] |= BIT7; - }else if (sStartAPCmd.byBasicRate & BIT1) { - pMgmt->abyIBSSSuppRates[2] |= BIT7; - }else { - //default 1,2M - pMgmt->abyIBSSSuppRates[2] |= BIT7; - pMgmt->abyIBSSSuppRates[3] |= BIT7; - } - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Support Rate= %x %x %x %x\n", - pMgmt->abyIBSSSuppRates[2], - pMgmt->abyIBSSSuppRates[3], - pMgmt->abyIBSSSuppRates[4], - pMgmt->abyIBSSSuppRates[5] - ); - - netif_stop_queue(pDevice->dev); - spin_lock_irq(&pDevice->lock); - bScheduleCommand((void *)pDevice, WLAN_CMD_RUN_AP, NULL); - spin_unlock_irq(&pDevice->lock); - break; - - case WLAN_CMD_GET_NODE_CNT: + if ((sStartAPCmd.uChannel > 0) && (sStartAPCmd.uChannel <= 14)) + pDevice->uChannel = sStartAPCmd.uChannel; + + if ((sStartAPCmd.uBeaconInt >= 20) && (sStartAPCmd.uBeaconInt <= 1000)) + pMgmt->wIBSSBeaconPeriod = sStartAPCmd.uBeaconInt; + else + pMgmt->wIBSSBeaconPeriod = 100; + + if (sStartAPCmd.bShareKeyAuth == true) { + pMgmt->bShareKeyAlgorithm = true; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Share Key\n"); + } else { + pMgmt->bShareKeyAlgorithm = false; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Open System\n"); + } + memcpy(pMgmt->abyIBSSSuppRates, abySuppRates, 6); + + if (sStartAPCmd.byBasicRate & BIT3) { + pMgmt->abyIBSSSuppRates[2] |= BIT7; + pMgmt->abyIBSSSuppRates[3] |= BIT7; + pMgmt->abyIBSSSuppRates[4] |= BIT7; + pMgmt->abyIBSSSuppRates[5] |= BIT7; + } else if (sStartAPCmd.byBasicRate & BIT2) { + pMgmt->abyIBSSSuppRates[2] |= BIT7; + pMgmt->abyIBSSSuppRates[3] |= BIT7; + pMgmt->abyIBSSSuppRates[4] |= BIT7; + } else if (sStartAPCmd.byBasicRate & BIT1) { + pMgmt->abyIBSSSuppRates[2] |= BIT7; + pMgmt->abyIBSSSuppRates[3] |= BIT7; + } else if (sStartAPCmd.byBasicRate & BIT1) { + pMgmt->abyIBSSSuppRates[2] |= BIT7; + } else { + /* default 1,2M */ + pMgmt->abyIBSSSuppRates[2] |= BIT7; + pMgmt->abyIBSSSuppRates[3] |= BIT7; + } + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Support Rate= %x %x %x %x\n", + pMgmt->abyIBSSSuppRates[2], + pMgmt->abyIBSSSuppRates[3], + pMgmt->abyIBSSSuppRates[4], + pMgmt->abyIBSSSuppRates[5]); + + netif_stop_queue(pDevice->dev); + spin_lock_irq(&pDevice->lock); + bScheduleCommand((void *)pDevice, WLAN_CMD_RUN_AP, NULL); + spin_unlock_irq(&pDevice->lock); + break; + case WLAN_CMD_GET_NODE_CNT: cbListCount = 0; pNode = &(pMgmt->sNodeDBTable[0]); - for (ii = 0; ii < (MAX_NODE_NUM + 1); ii++) { - pNode = &(pMgmt->sNodeDBTable[ii]); - if (!pNode->bActive) - continue; - cbListCount++; - } - - sNodeList.uItem = cbListCount; - if (copy_to_user(pReq->data, &sNodeList, sizeof(SNodeList))) { + for (ii = 0; ii < (MAX_NODE_NUM + 1); ii++) { + pNode = &(pMgmt->sNodeDBTable[ii]); + if (!pNode->bActive) + continue; + cbListCount++; + } + + sNodeList.uItem = cbListCount; + if (copy_to_user(pReq->data, &sNodeList, sizeof(SNodeList))) { result = -EFAULT; break; } - pReq->wResult = 0; - break; - - case WLAN_CMD_GET_NODE_LIST: + pReq->wResult = 0; + break; - if (copy_from_user(&sNodeList, pReq->data, sizeof(SNodeList))) { + case WLAN_CMD_GET_NODE_LIST: + if (copy_from_user(&sNodeList, pReq->data, sizeof(SNodeList))) { result = -EFAULT; break; } - pNodeList = (PSNodeList)kmalloc(sizeof(SNodeList) + (sNodeList.uItem * sizeof(SNodeItem)), (int)GFP_ATOMIC); - if (pNodeList == NULL) { - result = -ENOMEM; - break; - } + pNodeList = (PSNodeList)kmalloc(sizeof(SNodeList) + (sNodeList.uItem * sizeof(SNodeItem)), (int)GFP_ATOMIC); + if (pNodeList == NULL) { + result = -ENOMEM; + break; + } pNodeList->uItem = sNodeList.uItem; pNode = &(pMgmt->sNodeDBTable[0]); - for (ii = 0, jj = 0; ii < (MAX_NODE_NUM + 1); ii++) { - pNode = &(pMgmt->sNodeDBTable[ii]); - if (pNode->bActive) { - pNodeList->sNodeList[jj].wAID = pNode->wAID; - memcpy(pNodeList->sNodeList[jj].abyMACAddr, pNode->abyMACAddr, WLAN_ADDR_LEN); - pNodeList->sNodeList[jj].wTxDataRate = pNode->wTxDataRate; - pNodeList->sNodeList[jj].wInActiveCount = (unsigned short)pNode->uInActiveCount; - pNodeList->sNodeList[jj].wEnQueueCnt = (unsigned short)pNode->wEnQueueCnt; - pNodeList->sNodeList[jj].wFlags = (unsigned short)pNode->dwFlags; - pNodeList->sNodeList[jj].bPWBitOn = pNode->bPSEnable; - pNodeList->sNodeList[jj].byKeyIndex = pNode->byKeyIndex; - pNodeList->sNodeList[jj].wWepKeyLength = pNode->uWepKeyLength; - memcpy(&(pNodeList->sNodeList[jj].abyWepKey[0]), &(pNode->abyWepKey[0]), WEP_KEYMAXLEN); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "key= %2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n", - pNodeList->sNodeList[jj].abyWepKey[0], - pNodeList->sNodeList[jj].abyWepKey[1], - pNodeList->sNodeList[jj].abyWepKey[2], - pNodeList->sNodeList[jj].abyWepKey[3], - pNodeList->sNodeList[jj].abyWepKey[4] - ); - pNodeList->sNodeList[jj].bIsInFallback = pNode->bIsInFallback; - pNodeList->sNodeList[jj].uTxFailures = pNode->uTxFailures; - pNodeList->sNodeList[jj].uTxAttempts = pNode->uTxAttempts; - pNodeList->sNodeList[jj].wFailureRatio = (unsigned short)pNode->uFailureRatio; - jj ++; - if (jj >= pNodeList->uItem) - break; - } - } - if (copy_to_user(pReq->data, pNodeList, sizeof(SNodeList) + (sNodeList.uItem * sizeof(SNodeItem)))) { + for (ii = 0, jj = 0; ii < (MAX_NODE_NUM + 1); ii++) { + pNode = &(pMgmt->sNodeDBTable[ii]); + if (pNode->bActive) { + pNodeList->sNodeList[jj].wAID = pNode->wAID; + memcpy(pNodeList->sNodeList[jj].abyMACAddr, pNode->abyMACAddr, WLAN_ADDR_LEN); + pNodeList->sNodeList[jj].wTxDataRate = pNode->wTxDataRate; + pNodeList->sNodeList[jj].wInActiveCount = (unsigned short)pNode->uInActiveCount; + pNodeList->sNodeList[jj].wEnQueueCnt = (unsigned short)pNode->wEnQueueCnt; + pNodeList->sNodeList[jj].wFlags = (unsigned short)pNode->dwFlags; + pNodeList->sNodeList[jj].bPWBitOn = pNode->bPSEnable; + pNodeList->sNodeList[jj].byKeyIndex = pNode->byKeyIndex; + pNodeList->sNodeList[jj].wWepKeyLength = pNode->uWepKeyLength; + memcpy(&(pNodeList->sNodeList[jj].abyWepKey[0]), &(pNode->abyWepKey[0]), WEP_KEYMAXLEN); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "key= %2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n", + pNodeList->sNodeList[jj].abyWepKey[0], + pNodeList->sNodeList[jj].abyWepKey[1], + pNodeList->sNodeList[jj].abyWepKey[2], + pNodeList->sNodeList[jj].abyWepKey[3], + pNodeList->sNodeList[jj].abyWepKey[4]); + pNodeList->sNodeList[jj].bIsInFallback = pNode->bIsInFallback; + pNodeList->sNodeList[jj].uTxFailures = pNode->uTxFailures; + pNodeList->sNodeList[jj].uTxAttempts = pNode->uTxAttempts; + pNodeList->sNodeList[jj].wFailureRatio = (unsigned short)pNode->uFailureRatio; + jj++; + if (jj >= pNodeList->uItem) + break; + } + } + if (copy_to_user(pReq->data, pNodeList, sizeof(SNodeList) + (sNodeList.uItem * sizeof(SNodeItem)))) { result = -EFAULT; break; } - kfree(pNodeList); - pReq->wResult = 0; - break; + kfree(pNodeList); + pReq->wResult = 0; + break; #ifdef WPA_SM_Transtatus - case 0xFF: - memset(wpa_Result.ifname,0,sizeof(wpa_Result.ifname)); - wpa_Result.proto = 0; - wpa_Result.key_mgmt = 0; - wpa_Result.eap_type = 0; - wpa_Result.authenticated = false; - pDevice->fWPA_Authened = false; - if (copy_from_user(&wpa_Result, pReq->data, sizeof(wpa_Result))) { - result = -EFAULT; + case 0xFF: + memset(wpa_Result.ifname, 0, sizeof(wpa_Result.ifname)); + wpa_Result.proto = 0; + wpa_Result.key_mgmt = 0; + wpa_Result.eap_type = 0; + wpa_Result.authenticated = false; + pDevice->fWPA_Authened = false; + if (copy_from_user(&wpa_Result, pReq->data, sizeof(wpa_Result))) { + result = -EFAULT; break; } -if(wpa_Result.authenticated==true) { - #ifdef SndEvt_ToAPI - { - union iwreq_data wrqu; + if (wpa_Result.authenticated == true) { +#ifdef SndEvt_ToAPI + { + union iwreq_data wrqu; - pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID; + pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID; - memset(&wrqu, 0, sizeof(wrqu)); - wrqu.data.flags = RT_WPACONNECTED_EVENT_FLAG; - wrqu.data.length =pItemSSID->len; - wireless_send_event(pDevice->dev, IWEVCUSTOM, &wrqu, pItemSSID->abySSID); - } - #endif - pDevice->fWPA_Authened = true; //is successful peer to wpa_Result.authenticated? -} - - //printk("get private wpa_supplicant announce WPA SM\n"); - //printk("wpa-->ifname=%s\n",wpa_Result.ifname); - //printk("wpa-->proto=%d\n",wpa_Result.proto); - //printk("wpa-->key-mgmt=%d\n",wpa_Result.key_mgmt); - //printk("wpa-->eap_type=%d\n",wpa_Result.eap_type); - //printk("wpa-->authenticated is %s\n",(wpa_Result.authenticated==true)?"true":"false"); - - pReq->wResult = 0; - break; + memset(&wrqu, 0, sizeof(wrqu)); + wrqu.data.flags = RT_WPACONNECTED_EVENT_FLAG; + wrqu.data.length = pItemSSID->len; + wireless_send_event(pDevice->dev, IWEVCUSTOM, &wrqu, pItemSSID->abySSID); + } +#endif + pDevice->fWPA_Authened = true; /* is successful peer to wpa_Result.authenticated? */ + } + pReq->wResult = 0; + break; #endif - default: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Private command not support..\n"); - } - - return result; -} + default: + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Private command not support..\n"); + } -/* -void -vConfigWEPKey ( - PSDevice pDevice, - unsigned long dwKeyIndex, - unsigned char *pbyKey, - unsigned long uKeyLength - ) -{ - int ii; - - - memset(&pDevice->abyWepKey[dwKeyIndex][0], 0, WLAN_WEPMAX_KEYLEN); - memcpy(&pDevice->abyWepKey[dwKeyIndex][0], pbyKey, uKeyLength); - - pDevice->bWepKeyAvailable[dwKeyIndex] = true; - pDevice->auWepKeyLength[dwKeyIndex] = uKeyLength; - - MACvSetDefaultKeyEntry(pDevice->PortOffset, uKeyLength, dwKeyIndex, - (unsigned long *) &(pDevice->abyWepKey[dwKeyIndex][0]), pDevice->byLocalID); - - if (pDevice->eEncryptionStatus < Ndis802_11EncryptionNotSupported) { - for(ii=0; ii<MAX_GROUP_KEY; ii++) { - if ((pDevice->bWepKeyAvailable[ii] == true) && - (pDevice->auWepKeyLength[ii] == WLAN_WEP232_KEYLEN)) { - pDevice->uCurrentWEPMode = TX_WEP_SW232; - MACvDisableDefaultKey(pDevice->PortOffset); - break; - } - } - if ((ii == MAX_GROUP_KEY) && - (pDevice->eEncryptionStatus < Ndis802_11EncryptionNotSupported)) { - MACvEnableDefaultKey(pDevice->PortOffset, pDevice->byLocalID); - } - } + return result; } -*/ diff --git a/drivers/staging/vt6655/wmgr.c b/drivers/staging/vt6655/wmgr.c index ab289c3..c46d519 100644 --- a/drivers/staging/vt6655/wmgr.c +++ b/drivers/staging/vt6655/wmgr.c @@ -2521,14 +2521,8 @@ vMgrCreateOwnIBSS( if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { // AP mode BSSID = MAC addr memcpy(pMgmt->abyCurrBSSID, pMgmt->abyMACAddr, WLAN_ADDR_LEN); - DBG_PRT(MSG_LEVEL_INFO, KERN_INFO"AP beacon created BSSID:%02x-%02x-%02x-%02x-%02x-%02x \n", - pMgmt->abyCurrBSSID[0], - pMgmt->abyCurrBSSID[1], - pMgmt->abyCurrBSSID[2], - pMgmt->abyCurrBSSID[3], - pMgmt->abyCurrBSSID[4], - pMgmt->abyCurrBSSID[5] - ); + DBG_PRT(MSG_LEVEL_INFO, KERN_INFO"AP beacon created BSSID:%pM\n", + pMgmt->abyCurrBSSID); } if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) { @@ -2550,14 +2544,8 @@ vMgrCreateOwnIBSS( pMgmt->abyCurrBSSID[0] |= IEEE_ADDR_UNIVERSAL; - DBG_PRT(MSG_LEVEL_INFO, KERN_INFO"Adhoc beacon created bssid:%02x-%02x-%02x-%02x-%02x-%02x \n", - pMgmt->abyCurrBSSID[0], - pMgmt->abyCurrBSSID[1], - pMgmt->abyCurrBSSID[2], - pMgmt->abyCurrBSSID[3], - pMgmt->abyCurrBSSID[4], - pMgmt->abyCurrBSSID[5] - ); + DBG_PRT(MSG_LEVEL_INFO, KERN_INFO"Adhoc beacon created bssid:%pM\n", + pMgmt->abyCurrBSSID); } // Set Capability Info @@ -2887,14 +2875,8 @@ vMgrJoinBSSBegin( // pDevice->bLinkPass = true; // memcpy(pDevice->abyBSSID, pCurr->abyBSSID, WLAN_BSSID_LEN); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Join IBSS ok:%02x-%02x-%02x-%02x-%02x-%02x \n", - pMgmt->abyCurrBSSID[0], - pMgmt->abyCurrBSSID[1], - pMgmt->abyCurrBSSID[2], - pMgmt->abyCurrBSSID[3], - pMgmt->abyCurrBSSID[4], - pMgmt->abyCurrBSSID[5] - ); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Join IBSS ok:%pM\n", + pMgmt->abyCurrBSSID); // Preamble type auto-switch: if AP can receive short-preamble cap, // and if registry setting is short preamble we can turn on too. @@ -2984,13 +2966,8 @@ s_vMgrSynchBSS ( MACvReadBSSIDAddress(pDevice->PortOffset, pMgmt->abyCurrBSSID); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Sync:set CurrBSSID address = %02x-%02x-%02x=%02x-%02x-%02x\n", - pMgmt->abyCurrBSSID[0], - pMgmt->abyCurrBSSID[1], - pMgmt->abyCurrBSSID[2], - pMgmt->abyCurrBSSID[3], - pMgmt->abyCurrBSSID[4], - pMgmt->abyCurrBSSID[5]); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Sync:set CurrBSSID address = " + "%pM\n", pMgmt->abyCurrBSSID); if (pCurr->eNetworkTypeInUse == PHY_TYPE_11A) { if ((pMgmt->eConfigPHYMode == PHY_TYPE_11A) || @@ -4462,14 +4439,8 @@ s_vMgrRxProbeRequest( sFrame.pBuf = (unsigned char *)pRxPacket->p80211Header; vMgrDecodeProbeRequest(&sFrame); /* - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request rx:MAC addr:%02x-%02x-%02x=%02x-%02x-%02x \n", - sFrame.pHdr->sA3.abyAddr2[0], - sFrame.pHdr->sA3.abyAddr2[1], - sFrame.pHdr->sA3.abyAddr2[2], - sFrame.pHdr->sA3.abyAddr2[3], - sFrame.pHdr->sA3.abyAddr2[4], - sFrame.pHdr->sA3.abyAddr2[5] - ); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request rx:MAC addr:%pM\n", + sFrame.pHdr->sA3.abyAddr2); */ if (sFrame.pSSID->len != 0) { if (sFrame.pSSID->len != ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len) diff --git a/drivers/staging/vt6655/wpactl.c b/drivers/staging/vt6655/wpactl.c index a0f994e..732ba88 100644 --- a/drivers/staging/vt6655/wpactl.c +++ b/drivers/staging/vt6655/wpactl.c @@ -213,7 +213,9 @@ int wpa_set_wpadev(PSDevice pDevice, int val) int uu, ii; - if (param->u.wpa_key.alg_name > WPA_ALG_CCMP) + if (param->u.wpa_key.alg_name > WPA_ALG_CCMP || + param->u.wpa_key.key_len >= MAX_KEY_LEN || + param->u.wpa_key.seq_len >= MAX_KEY_LEN) return -EINVAL; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "param->u.wpa_key.alg_name = %d \n", param->u.wpa_key.alg_name); |