Commit 51ce068c authored by Toon Schoenmakers's avatar Toon Schoenmakers Committed by Greg Kroah-Hartman

staging: vt6655: Fixed all the indents and other errors in IEEE11h.c

Signed-off-by: default avatarToon Schoenmakers <nighteyes1993@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 796fd547
...@@ -41,52 +41,52 @@ ...@@ -41,52 +41,52 @@
#include "channel.h" #include "channel.h"
/*--------------------- Static Definitions -------------------------*/ /*--------------------- Static Definitions -------------------------*/
static int msglevel =MSG_LEVEL_INFO; static int msglevel = MSG_LEVEL_INFO;
#pragma pack(1) #pragma pack(1)
typedef struct _WLAN_FRAME_ACTION { typedef struct _WLAN_FRAME_ACTION {
WLAN_80211HDR_A3 Header; WLAN_80211HDR_A3 Header;
unsigned char byCategory; unsigned char byCategory;
unsigned char byAction; unsigned char byAction;
unsigned char abyVars[1]; unsigned char abyVars[1];
} WLAN_FRAME_ACTION, *PWLAN_FRAME_ACTION; } WLAN_FRAME_ACTION, *PWLAN_FRAME_ACTION;
typedef struct _WLAN_FRAME_MSRREQ { typedef struct _WLAN_FRAME_MSRREQ {
WLAN_80211HDR_A3 Header; WLAN_80211HDR_A3 Header;
unsigned char byCategory; unsigned char byCategory;
unsigned char byAction; unsigned char byAction;
unsigned char byDialogToken; unsigned char byDialogToken;
WLAN_IE_MEASURE_REQ sMSRReqEIDs[1]; WLAN_IE_MEASURE_REQ sMSRReqEIDs[1];
} WLAN_FRAME_MSRREQ, *PWLAN_FRAME_MSRREQ; } WLAN_FRAME_MSRREQ, *PWLAN_FRAME_MSRREQ;
typedef struct _WLAN_FRAME_MSRREP { typedef struct _WLAN_FRAME_MSRREP {
WLAN_80211HDR_A3 Header; WLAN_80211HDR_A3 Header;
unsigned char byCategory; unsigned char byCategory;
unsigned char byAction; unsigned char byAction;
unsigned char byDialogToken; unsigned char byDialogToken;
WLAN_IE_MEASURE_REP sMSRRepEIDs[1]; WLAN_IE_MEASURE_REP sMSRRepEIDs[1];
} WLAN_FRAME_MSRREP, *PWLAN_FRAME_MSRREP; } WLAN_FRAME_MSRREP, *PWLAN_FRAME_MSRREP;
typedef struct _WLAN_FRAME_TPCREQ { typedef struct _WLAN_FRAME_TPCREQ {
WLAN_80211HDR_A3 Header; WLAN_80211HDR_A3 Header;
unsigned char byCategory; unsigned char byCategory;
unsigned char byAction; unsigned char byAction;
unsigned char byDialogToken; unsigned char byDialogToken;
WLAN_IE_TPC_REQ sTPCReqEIDs; WLAN_IE_TPC_REQ sTPCReqEIDs;
} WLAN_FRAME_TPCREQ, *PWLAN_FRAME_TPCREQ; } WLAN_FRAME_TPCREQ, *PWLAN_FRAME_TPCREQ;
typedef struct _WLAN_FRAME_TPCREP { typedef struct _WLAN_FRAME_TPCREP {
WLAN_80211HDR_A3 Header; WLAN_80211HDR_A3 Header;
unsigned char byCategory; unsigned char byCategory;
unsigned char byAction; unsigned char byAction;
unsigned char byDialogToken; unsigned char byDialogToken;
WLAN_IE_TPC_REP sTPCRepEIDs; WLAN_IE_TPC_REP sTPCRepEIDs;
} WLAN_FRAME_TPCREP, *PWLAN_FRAME_TPCREP; } WLAN_FRAME_TPCREP, *PWLAN_FRAME_TPCREP;
#pragma pack() #pragma pack()
// action field reference ieee 802.11h Table 20e /* action field reference ieee 802.11h Table 20e */
#define ACTION_MSRREQ 0 #define ACTION_MSRREQ 0
#define ACTION_MSRREP 1 #define ACTION_MSRREP 1
#define ACTION_TPCREQ 2 #define ACTION_TPCREQ 2
...@@ -101,84 +101,100 @@ typedef struct _WLAN_FRAME_TPCREP { ...@@ -101,84 +101,100 @@ typedef struct _WLAN_FRAME_TPCREP {
static bool s_bRxMSRReq(PSMgmtObject pMgmt, PWLAN_FRAME_MSRREQ pMSRReq, static bool s_bRxMSRReq(PSMgmtObject pMgmt, PWLAN_FRAME_MSRREQ pMSRReq,
unsigned int uLength) unsigned int uLength)
{ {
size_t uNumOfEIDs = 0; size_t uNumOfEIDs = 0;
bool bResult = true; bool bResult = true;
if (uLength <= WLAN_A3FR_MAXLEN) { if (uLength <= WLAN_A3FR_MAXLEN)
memcpy(pMgmt->abyCurrentMSRReq, pMSRReq, uLength); memcpy(pMgmt->abyCurrentMSRReq, pMSRReq, uLength);
} uNumOfEIDs = ((uLength - offsetof(WLAN_FRAME_MSRREQ,
uNumOfEIDs = ((uLength - offsetof(WLAN_FRAME_MSRREQ, sMSRReqEIDs))/ (sizeof(WLAN_IE_MEASURE_REQ))); sMSRReqEIDs))/
pMgmt->pCurrMeasureEIDRep = &(((PWLAN_FRAME_MSRREP) (pMgmt->abyCurrentMSRRep))->sMSRRepEIDs[0]); (sizeof(WLAN_IE_MEASURE_REQ)));
pMgmt->uLengthOfRepEIDs = 0; pMgmt->pCurrMeasureEIDRep = &(((PWLAN_FRAME_MSRREP)
bResult = CARDbStartMeasure(pMgmt->pAdapter, (pMgmt->abyCurrentMSRRep))->sMSRRepEIDs[0]);
((PWLAN_FRAME_MSRREQ) (pMgmt->abyCurrentMSRReq))->sMSRReqEIDs, pMgmt->uLengthOfRepEIDs = 0;
uNumOfEIDs bResult = CARDbStartMeasure(pMgmt->pAdapter,
); ((PWLAN_FRAME_MSRREQ)
return (bResult); (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; PWLAN_FRAME_TPCREP pFrame;
PSTxMgmtPacket pTxPacket = NULL; PSTxMgmtPacket pTxPacket = NULL;
pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool; memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN);
memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN); pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket +
pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket)); sizeof(STxMgmtPacket));
pFrame = (PWLAN_FRAME_TPCREP)((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) 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.abyAddr1,
memcpy( pFrame->Header.abyAddr3, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN); pTPCReq->Header.abyAddr2,
WLAN_ADDR_LEN);
pFrame->byCategory = 0; memcpy(pFrame->Header.abyAddr2,
pFrame->byAction = 3; CARDpGetCurrentAddress(pMgmt->pAdapter),
pFrame->byDialogToken = ((PWLAN_FRAME_MSRREQ) (pMgmt->abyCurrentMSRReq))->byDialogToken; WLAN_ADDR_LEN);
memcpy(pFrame->Header.abyAddr3,
pFrame->sTPCRepEIDs.byElementID = WLAN_EID_TPC_REP; pMgmt->abyCurrBSSID,
pFrame->sTPCRepEIDs.len = 2; WLAN_BSSID_LEN);
pFrame->sTPCRepEIDs.byTxPower = CARDbyGetTransmitPower(pMgmt->pAdapter);
switch (byRate) { pFrame->byCategory = 0;
case RATE_54M: pFrame->byAction = 3;
pFrame->sTPCRepEIDs.byLinkMargin = 65 - byRSSI; pFrame->byDialogToken = ((PWLAN_FRAME_MSRREQ)
break; (pMgmt->abyCurrentMSRReq))->byDialogToken;
case RATE_48M:
pFrame->sTPCRepEIDs.byLinkMargin = 66 - byRSSI; pFrame->sTPCRepEIDs.byElementID = WLAN_EID_TPC_REP;
break; pFrame->sTPCRepEIDs.len = 2;
case RATE_36M: pFrame->sTPCRepEIDs.byTxPower = CARDbyGetTransmitPower(pMgmt->pAdapter);
pFrame->sTPCRepEIDs.byLinkMargin = 70 - byRSSI; switch (byRate) {
break; case RATE_54M:
case RATE_24M: pFrame->sTPCRepEIDs.byLinkMargin = 65 - byRSSI;
pFrame->sTPCRepEIDs.byLinkMargin = 74 - byRSSI; break;
break; case RATE_48M:
case RATE_18M: pFrame->sTPCRepEIDs.byLinkMargin = 66 - byRSSI;
pFrame->sTPCRepEIDs.byLinkMargin = 77 - byRSSI; break;
break; case RATE_36M:
case RATE_12M: pFrame->sTPCRepEIDs.byLinkMargin = 70 - byRSSI;
pFrame->sTPCRepEIDs.byLinkMargin = 79 - byRSSI; break;
break; case RATE_24M:
case RATE_9M: pFrame->sTPCRepEIDs.byLinkMargin = 74 - byRSSI;
pFrame->sTPCRepEIDs.byLinkMargin = 81 - byRSSI; break;
break; case RATE_18M:
case RATE_6M: pFrame->sTPCRepEIDs.byLinkMargin = 77 - byRSSI;
default: break;
pFrame->sTPCRepEIDs.byLinkMargin = 82 - byRSSI; case RATE_12M:
break; pFrame->sTPCRepEIDs.byLinkMargin = 79 - byRSSI;
} break;
case RATE_9M:
pTxPacket->cbMPDULen = sizeof(WLAN_FRAME_TPCREP); pFrame->sTPCRepEIDs.byLinkMargin = 81 - byRSSI;
pTxPacket->cbPayloadLen = sizeof(WLAN_FRAME_TPCREP) - WLAN_HDR_ADDR3_LEN; break;
if (csMgmt_xmit(pMgmt->pAdapter, pTxPacket) != CMD_STATUS_PENDING) case RATE_6M:
return (false); default:
return (true); pFrame->sTPCRepEIDs.byLinkMargin = 82 - byRSSI;
// return (CARDbSendPacket(pMgmt->pAdapter, pFrame, PKT_TYPE_802_11_MNG, sizeof(WLAN_FRAME_TPCREP))); 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 ...@@ -204,102 +220,110 @@ static bool s_bRxTPCReq(PSMgmtObject pMgmt, PWLAN_FRAME_TPCREQ pTPCReq, unsigned
* *
-*/ -*/
bool bool
IEEE11hbMgrRxAction ( IEEE11hbMgrRxAction(void *pMgmtHandle, void *pRxPacket)
void *pMgmtHandle,
void *pRxPacket
)
{ {
PSMgmtObject pMgmt = (PSMgmtObject) pMgmtHandle; PSMgmtObject pMgmt = (PSMgmtObject) pMgmtHandle;
PWLAN_FRAME_ACTION pAction = NULL; PWLAN_FRAME_ACTION pAction = NULL;
unsigned int uLength = 0; unsigned int uLength = 0;
PWLAN_IE_CH_SW pChannelSwitch = NULL; PWLAN_IE_CH_SW pChannelSwitch = NULL;
/* decode the frame */
// decode the frame uLength = ((PSRxMgmtPacket)pRxPacket)->cbMPDULen;
uLength = ((PSRxMgmtPacket)pRxPacket)->cbMPDULen; if (uLength > WLAN_A3FR_MAXLEN)
if (uLength > WLAN_A3FR_MAXLEN) { return false;
return (false);
} pAction = (PWLAN_FRAME_ACTION)
(((PSRxMgmtPacket)pRxPacket)->p80211Header);
pAction = (PWLAN_FRAME_ACTION) (((PSRxMgmtPacket)pRxPacket)->p80211Header); if (pAction->byCategory == 0) {
switch (pAction->byAction) {
if (pAction->byCategory == 0) { case ACTION_MSRREQ:
switch (pAction->byAction) { return s_bRxMSRReq(pMgmt,
case ACTION_MSRREQ: (PWLAN_FRAME_MSRREQ)
return (s_bRxMSRReq(pMgmt, (PWLAN_FRAME_MSRREQ) pAction, uLength)); pAction,
break; uLength);
case ACTION_MSRREP: break;
break; case ACTION_MSRREP:
case ACTION_TPCREQ: break;
return (s_bRxTPCReq(pMgmt, case ACTION_TPCREQ:
(PWLAN_FRAME_TPCREQ) pAction, return s_bRxTPCReq(pMgmt,
((PSRxMgmtPacket)pRxPacket)->byRxRate, (PWLAN_FRAME_TPCREQ) pAction,
(unsigned char) ((PSRxMgmtPacket)pRxPacket)->uRSSI)); ((PSRxMgmtPacket)pRxPacket)->byRxRate,
break; (unsigned char)
case ACTION_TPCREP: ((PSRxMgmtPacket)pRxPacket)->uRSSI);
break; break;
case ACTION_CHSW: case ACTION_TPCREP:
pChannelSwitch = (PWLAN_IE_CH_SW) (pAction->abyVars); break;
if ((pChannelSwitch->byElementID == WLAN_EID_CH_SWITCH) && case ACTION_CHSW:
(pChannelSwitch->len == 3)) { pChannelSwitch = (PWLAN_IE_CH_SW) (pAction->abyVars);
// valid element id if ((pChannelSwitch->byElementID == WLAN_EID_CH_SWITCH)
CARDbChannelSwitch( pMgmt->pAdapter, && (pChannelSwitch->len == 3)) {
pChannelSwitch->byMode, /* valid element id */
get_channel_mapping(pMgmt->pAdapter, pChannelSwitch->byChannel, pMgmt->eCurrentPHYMode), CARDbChannelSwitch(pMgmt->pAdapter,
pChannelSwitch->byCount pChannelSwitch->byMode,
); get_channel_mapping(pMgmt->pAdapter,
} pChannelSwitch->byChannel,
break; pMgmt->eCurrentPHYMode),
default: pChannelSwitch->byCount);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Unknown Action = %d\n", pAction->byAction); }
break; break;
} default:
} else { DBG_PRT(MSG_LEVEL_DEBUG,
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Unknown Category = %d\n", pAction->byCategory); KERN_INFO"Unknown Action = %d\n",
pAction->byCategory |= 0x80; pAction->byAction);
break;
//return (CARDbSendPacket(pMgmt->pAdapter, pAction, PKT_TYPE_802_11_MNG, uLength)); }
return (true); } else {
} DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Unknown Category = %d\n",
return (true); pAction->byCategory);
pAction->byCategory |= 0x80;
/*return (CARDbSendPacket(pMgmt->pAdapter, pAction, PKT_TYPE_802_11_MNG,
uLength));*/
return true;
}
return true;
} }
bool IEEE11hbMSRRepTx ( bool IEEE11hbMSRRepTx(void *pMgmtHandle)
void *pMgmtHandle
)
{ {
PSMgmtObject pMgmt = (PSMgmtObject) pMgmtHandle; PSMgmtObject pMgmt = (PSMgmtObject) pMgmtHandle;
PWLAN_FRAME_MSRREP pMSRRep = (PWLAN_FRAME_MSRREP) (pMgmt->abyCurrentMSRRep + sizeof(STxMgmtPacket)); PWLAN_FRAME_MSRREP pMSRRep = (PWLAN_FRAME_MSRREP)
size_t uLength = 0; (pMgmt->abyCurrentMSRRep + sizeof(STxMgmtPacket));
PSTxMgmtPacket pTxPacket = NULL; size_t uLength = 0;
PSTxMgmtPacket pTxPacket = NULL;
pTxPacket = (PSTxMgmtPacket)pMgmt->abyCurrentMSRRep;
memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN); pTxPacket = (PSTxMgmtPacket)pMgmt->abyCurrentMSRRep;
pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket)); 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) 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.abyAddr1, ((PWLAN_FRAME_MSRREQ)
memcpy( pMSRRep->Header.abyAddr3, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN); (pMgmt->abyCurrentMSRReq))->Header.abyAddr2, WLAN_ADDR_LEN);
memcpy(pMSRRep->Header.abyAddr2,
pMSRRep->byCategory = 0; CARDpGetCurrentAddress(pMgmt->pAdapter), WLAN_ADDR_LEN);
pMSRRep->byAction = 1; memcpy(pMSRRep->Header.abyAddr3, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN);
pMSRRep->byDialogToken = ((PWLAN_FRAME_MSRREQ) (pMgmt->abyCurrentMSRReq))->byDialogToken;
pMSRRep->byCategory = 0;
uLength = pMgmt->uLengthOfRepEIDs + offsetof(WLAN_FRAME_MSRREP, sMSRRepEIDs); pMSRRep->byAction = 1;
pMSRRep->byDialogToken = ((PWLAN_FRAME_MSRREQ)
pTxPacket->cbMPDULen = uLength; (pMgmt->abyCurrentMSRReq))->byDialogToken;
pTxPacket->cbPayloadLen = uLength - WLAN_HDR_ADDR3_LEN;
if (csMgmt_xmit(pMgmt->pAdapter, pTxPacket) != CMD_STATUS_PENDING) uLength = pMgmt->uLengthOfRepEIDs + offsetof(WLAN_FRAME_MSRREP,
return (false); sMSRRepEIDs);
return (true);
// return (CARDbSendPacket(pMgmt->pAdapter, pMSRRep, PKT_TYPE_802_11_MNG, uLength)); 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)); */
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment