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

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

parent 796fd547
Loading
Loading
Loading
Loading
+215 −191
Original line number Diff line number Diff line
@@ -86,7 +86,7 @@ typedef struct _WLAN_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
@@ -104,43 +104,57 @@ static bool s_bRxMSRReq(PSMgmtObject pMgmt, PWLAN_FRAME_MSRREQ pMSRReq,
	size_t    uNumOfEIDs = 0;
	bool bResult = true;

    if (uLength <= WLAN_A3FR_MAXLEN) {
	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]);
	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,
				((PWLAN_FRAME_MSRREQ)
				(pMgmt->abyCurrentMSRReq))->sMSRReqEIDs,
				uNumOfEIDs
				);
    return (bResult);
	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));
	pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket +
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)
				);

    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);
	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->byDialogToken = ((PWLAN_FRAME_MSRREQ)
(pMgmt->abyCurrentMSRReq))->byDialogToken;

	pFrame->sTPCRepEIDs.byElementID = WLAN_EID_TPC_REP;
	pFrame->sTPCRepEIDs.len = 2;
@@ -174,11 +188,13 @@ static bool s_bRxTPCReq(PSMgmtObject pMgmt, PWLAN_FRAME_TPCREQ pTPCReq, unsigned
}

	pTxPacket->cbMPDULen = sizeof(WLAN_FRAME_TPCREP);
    pTxPacket->cbPayloadLen = sizeof(WLAN_FRAME_TPCREP) - WLAN_HDR_ADDR3_LEN;
	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)));
		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
	/* decode the frame */
	uLength = ((PSRxMgmtPacket)pRxPacket)->cbMPDULen;
    if (uLength > WLAN_A3FR_MAXLEN) {
        return (false);
    }
	if (uLength > WLAN_A3FR_MAXLEN)
		return false;


    pAction = (PWLAN_FRAME_ACTION) (((PSRxMgmtPacket)pRxPacket)->p80211Header);
	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));
			return s_bRxMSRReq(pMgmt,
					(PWLAN_FRAME_MSRREQ)
					pAction,
					uLength);
			break;
		case ACTION_MSRREP:
			break;
		case ACTION_TPCREQ:
                return (s_bRxTPCReq(pMgmt,
			return s_bRxTPCReq(pMgmt,
				(PWLAN_FRAME_TPCREQ) pAction,
				((PSRxMgmtPacket)pRxPacket)->byRxRate,
                                    (unsigned char) ((PSRxMgmtPacket)pRxPacket)->uRSSI));
				(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
			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
                                        );
				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);
			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);
	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 (CARDbSendPacket(pMgmt->pAdapter, pAction, PKT_TYPE_802_11_MNG,
uLength));*/
	return true;
	}
    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));
	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));

	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.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;
	pMSRRep->byDialogToken = ((PWLAN_FRAME_MSRREQ)
		(pMgmt->abyCurrentMSRReq))->byDialogToken;

    uLength = pMgmt->uLengthOfRepEIDs + offsetof(WLAN_FRAME_MSRREP, sMSRRepEIDs);
	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));
		return false;
	return true;
/*    return (CARDbSendPacket(pMgmt->pAdapter, pMSRRep, PKT_TYPE_802_11_MNG,
uLength)); */

}