Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ec278fa2 authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz Committed by Greg Kroah-Hartman
Browse files

Staging: rt28x0: fix comments in common/*.c files

parent 9f548a2a
Loading
Loading
Loading
Loading
+34 −34
Original line number Diff line number Diff line
@@ -113,13 +113,13 @@ VOID MlmeADDBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
	NdisZeroMemory(&Frame, sizeof(FRAME_ADDBA_REQ));

	if (MlmeAddBAReqSanity(pAd, Elem->Msg, Elem->MsgLen, Addr)) {
		NStatus = MlmeAllocateMemory(pAd, &pOutBuffer);	//Get an unused nonpaged memory
		NStatus = MlmeAllocateMemory(pAd, &pOutBuffer);	/*Get an unused nonpaged memory */
		if (NStatus != NDIS_STATUS_SUCCESS) {
			DBGPRINT(RT_DEBUG_TRACE,
				 ("BA - MlmeADDBAAction() allocate memory failed \n"));
			return;
		}
		// 1. find entry
		/* 1. find entry */
		Idx =
		    pAd->MacTab.Content[pInfo->Wcid].BAOriWcidArray[pInfo->TID];
		if (Idx == 0) {
@@ -200,27 +200,27 @@ VOID MlmeDELBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
	FRAME_BAR FrameBar;

	pInfo = (MLME_DELBA_REQ_STRUCT *) Elem->Msg;
	// must send back DELBA
	/* must send back DELBA */
	NdisZeroMemory(&Frame, sizeof(FRAME_DELBA_REQ));
	DBGPRINT(RT_DEBUG_TRACE,
		 ("==> MlmeDELBAAction(), Initiator(%d) \n", pInfo->Initiator));

	if (MlmeDelBAReqSanity(pAd, Elem->Msg, Elem->MsgLen)) {
		NStatus = MlmeAllocateMemory(pAd, &pOutBuffer);	//Get an unused nonpaged memory
		NStatus = MlmeAllocateMemory(pAd, &pOutBuffer);	/*Get an unused nonpaged memory */
		if (NStatus != NDIS_STATUS_SUCCESS) {
			DBGPRINT(RT_DEBUG_ERROR,
				 ("BA - MlmeDELBAAction() allocate memory failed 1. \n"));
			return;
		}

		NStatus = MlmeAllocateMemory(pAd, &pOutBuffer2);	//Get an unused nonpaged memory
		NStatus = MlmeAllocateMemory(pAd, &pOutBuffer2);	/*Get an unused nonpaged memory */
		if (NStatus != NDIS_STATUS_SUCCESS) {
			MlmeFreeMemory(pAd, pOutBuffer);
			DBGPRINT(RT_DEBUG_ERROR,
				 ("BA - MlmeDELBAAction() allocate memory failed 2. \n"));
			return;
		}
		// SEND BAR (Send BAR to refresh peer reordering buffer.)
		/* SEND BAR (Send BAR to refresh peer reordering buffer.) */
		Idx =
		    pAd->MacTab.Content[pInfo->Wcid].BAOriWcidArray[pInfo->TID];

@@ -228,12 +228,12 @@ VOID MlmeDELBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
			      pAd->MacTab.Content[pInfo->Wcid].Addr,
			      pAd->CurrentAddress);

		FrameBar.StartingSeq.field.FragNum = 0;	// make sure sequence not clear in DEL funciton.
		FrameBar.StartingSeq.field.StartSeq = pAd->MacTab.Content[pInfo->Wcid].TxSeq[pInfo->TID];	// make sure sequence not clear in DEL funciton.
		FrameBar.BarControl.TID = pInfo->TID;	// make sure sequence not clear in DEL funciton.
		FrameBar.BarControl.ACKPolicy = IMMED_BA;	// make sure sequence not clear in DEL funciton.
		FrameBar.BarControl.Compressed = 1;	// make sure sequence not clear in DEL funciton.
		FrameBar.BarControl.MTID = 0;	// make sure sequence not clear in DEL funciton.
		FrameBar.StartingSeq.field.FragNum = 0;	/* make sure sequence not clear in DEL funciton. */
		FrameBar.StartingSeq.field.StartSeq = pAd->MacTab.Content[pInfo->Wcid].TxSeq[pInfo->TID];	/* make sure sequence not clear in DEL funciton. */
		FrameBar.BarControl.TID = pInfo->TID;	/* make sure sequence not clear in DEL funciton. */
		FrameBar.BarControl.ACKPolicy = IMMED_BA;	/* make sure sequence not clear in DEL funciton. */
		FrameBar.BarControl.Compressed = 1;	/* make sure sequence not clear in DEL funciton. */
		FrameBar.BarControl.MTID = 0;	/* make sure sequence not clear in DEL funciton. */

		MakeOutgoingFrame(pOutBuffer2, &FrameLen,
				  sizeof(FRAME_BAR), &FrameBar, END_OF_ARGS);
@@ -242,7 +242,7 @@ VOID MlmeDELBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
		DBGPRINT(RT_DEBUG_TRACE,
			 ("BA - MlmeDELBAAction() . Send BAR to refresh peer reordering buffer \n"));

		// SEND DELBA FRAME
		/* SEND DELBA FRAME */
		FrameLen = 0;

		{
@@ -263,7 +263,7 @@ VOID MlmeDELBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
		Frame.Action = DELBA;
		Frame.DelbaParm.Initiator = pInfo->Initiator;
		Frame.DelbaParm.TID = pInfo->TID;
		Frame.ReasonCode = 39;	// Time Out
		Frame.ReasonCode = 39;	/* Time Out */
		*(USHORT *) (&Frame.DelbaParm) =
		    cpu2le16(*(USHORT *) (&Frame.DelbaParm));
		Frame.ReasonCode = cpu2le16(Frame.ReasonCode);
@@ -288,8 +288,8 @@ VOID MlmeDLSAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)

VOID MlmeInvalidAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
{
	//PUCHAR                   pOutBuffer = NULL;
	//Return the receiving frame except the MSB of category filed set to 1.  7.3.1.11
	/*PUCHAR                   pOutBuffer = NULL; */
	/*Return the receiving frame except the MSB of category filed set to 1.  7.3.1.11 */
}

VOID PeerQOSAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
@@ -347,20 +347,20 @@ static VOID respond_ht_information_exchange_action(IN PRTMP_ADAPTER pAd,
	FRAME_HT_INFO HTINFOframe, *pFrame;
	UCHAR *pAddr;

	// 2. Always send back ADDBA Response
	NStatus = MlmeAllocateMemory(pAd, &pOutBuffer);	//Get an unused nonpaged memory
	/* 2. Always send back ADDBA Response */
	NStatus = MlmeAllocateMemory(pAd, &pOutBuffer);	/*Get an unused nonpaged memory */

	if (NStatus != NDIS_STATUS_SUCCESS) {
		DBGPRINT(RT_DEBUG_TRACE,
			 ("ACTION - respond_ht_information_exchange_action() allocate memory failed \n"));
		return;
	}
	// get RA
	/* get RA */
	pFrame = (FRAME_HT_INFO *) & Elem->Msg[0];
	pAddr = pFrame->Hdr.Addr2;

	NdisZeroMemory(&HTINFOframe, sizeof(FRAME_HT_INFO));
	// 2-1. Prepare ADDBA Response frame.
	/* 2-1. Prepare ADDBA Response frame. */
	{
		if (ADHOC_ON(pAd))
			ActHeaderInit(pAd, &HTINFOframe.Hdr, pAddr,
@@ -400,21 +400,21 @@ VOID PeerHTAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
			 ("ACTION - HT Notify Channel bandwidth action----> \n"));

		if (pAd->StaActive.SupportedPhyInfo.bHtEnable == FALSE) {
			// Note, this is to patch DIR-1353 AP. When the AP set to Wep, it will use legacy mode. But AP still keeps
			// sending BW_Notify Action frame, and cause us to linkup and linkdown.
			// In legacy mode, don't need to parse HT action frame.
			/* Note, this is to patch DIR-1353 AP. When the AP set to Wep, it will use legacy mode. But AP still keeps */
			/* sending BW_Notify Action frame, and cause us to linkup and linkdown. */
			/* In legacy mode, don't need to parse HT action frame. */
			DBGPRINT(RT_DEBUG_TRACE,
				 ("ACTION -Ignore HT Notify Channel BW when link as legacy mode. BW = %d---> \n",
				  Elem->Msg[LENGTH_802_11 + 2]));
			break;
		}

		if (Elem->Msg[LENGTH_802_11 + 2] == 0)	// 7.4.8.2. if value is 1, keep the same as supported channel bandwidth.
		if (Elem->Msg[LENGTH_802_11 + 2] == 0)	/* 7.4.8.2. if value is 1, keep the same as supported channel bandwidth. */
			pAd->MacTab.Content[Elem->Wcid].HTPhyMode.field.BW = 0;

		break;
	case SMPS_ACTION:
		// 7.3.1.25
		/* 7.3.1.25 */
		DBGPRINT(RT_DEBUG_TRACE, ("ACTION - SMPS action----> \n"));
		if (((Elem->Msg[LENGTH_802_11 + 2] & 0x1) == 0)) {
			pAd->MacTab.Content[Elem->Wcid].MmpsMode = MMPS_ENABLE;
@@ -427,7 +427,7 @@ VOID PeerHTAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
		DBGPRINT(RT_DEBUG_TRACE,
			 ("Aid(%d) MIMO PS = %d\n", Elem->Wcid,
			  pAd->MacTab.Content[Elem->Wcid].MmpsMode));
		// rt2860c : add something for smps change.
		/* rt2860c : add something for smps change. */
		break;

	case SETPCO_ACTION:
@@ -441,7 +441,7 @@ VOID PeerHTAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
			pHT_info =
			    (HT_INFORMATION_OCTET *) & Elem->Msg[LENGTH_802_11 +
								 2];
			// 7.4.8.10
			/* 7.4.8.10 */
			DBGPRINT(RT_DEBUG_TRACE,
				 ("ACTION - HT Information Exchange action----> \n"));
			if (pHT_info->Request) {
@@ -512,7 +512,7 @@ VOID SendRefreshBAR(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry)

			ASSERT(pBAEntry->Wcid < MAX_LEN_OF_MAC_TABLE);

			NStatus = MlmeAllocateMemory(pAd, &pOutBuffer);	//Get an unused nonpaged memory
			NStatus = MlmeAllocateMemory(pAd, &pOutBuffer);	/*Get an unused nonpaged memory */
			if (NStatus != NDIS_STATUS_SUCCESS) {
				DBGPRINT(RT_DEBUG_ERROR,
					 ("BA - MlmeADDBAAction() allocate memory failed \n"));
@@ -524,17 +524,17 @@ VOID SendRefreshBAR(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry)
			BarHeaderInit(pAd, &FrameBar, pEntry->Addr,
				      pAd->CurrentAddress);

			FrameBar.StartingSeq.field.FragNum = 0;	// make sure sequence not clear in DEL function.
			FrameBar.StartingSeq.field.StartSeq = Sequence;	// make sure sequence not clear in DEL funciton.
			FrameBar.BarControl.TID = TID;	// make sure sequence not clear in DEL funciton.
			FrameBar.StartingSeq.field.FragNum = 0;	/* make sure sequence not clear in DEL function. */
			FrameBar.StartingSeq.field.StartSeq = Sequence;	/* make sure sequence not clear in DEL funciton. */
			FrameBar.BarControl.TID = TID;	/* make sure sequence not clear in DEL funciton. */

			MakeOutgoingFrame(pOutBuffer, &FrameLen,
					  sizeof(FRAME_BAR), &FrameBar,
					  END_OF_ARGS);
			//if (!(CLIENT_STATUS_TEST_FLAG(pEntry, fCLIENT_STATUS_RALINK_CHIPSET)))
			if (1)	// Now we always send BAR.
			/*if (!(CLIENT_STATUS_TEST_FLAG(pEntry, fCLIENT_STATUS_RALINK_CHIPSET))) */
			if (1)	/* Now we always send BAR. */
			{
				//MiniportMMRequestUnlock(pAd, 0, pOutBuffer, FrameLen);
				/*MiniportMMRequestUnlock(pAd, 0, pOutBuffer, FrameLen); */
				MiniportMMRequest(pAd,
						  (MGMT_USE_QUEUE_FLAG |
						   MapUserPriorityToAccessCategory
+170 −170

File changed.

Preview size limit exceeded, changes collapsed.

+33 −33
Original line number Diff line number Diff line
@@ -277,7 +277,7 @@ void construct_mic_header2(unsigned char *mic_header2,
	mic_header2[4] = mpdu[20];
	mic_header2[5] = mpdu[21];

	// In Sequence Control field, mute sequence numer bits (12-bit)
	/* In Sequence Control field, mute sequence numer bits (12-bit) */
	mic_header2[6] = mpdu[22] & 0x0f;	/* SC */
	mic_header2[7] = 0x00;	/* mpdu[23]; */

@@ -403,7 +403,7 @@ void construct_ctr_preload(unsigned char *ctr_preload,
	for (i = 8; i < 14; i++)
		ctr_preload[i] = pn_vector[13 - i];	/* ctr_preload[8:13] = PN[5:0] */
#endif
	ctr_preload[14] = (unsigned char)(c / 256);	// Ctr
	ctr_preload[14] = (unsigned char)(c / 256);	/* Ctr */
	ctr_preload[15] = (unsigned char)(c % 256);

}
@@ -477,12 +477,12 @@ BOOLEAN RTMPSoftDecryptAES(IN PRTMP_ADAPTER pAd,
	PN[4] = *(pData + HeaderLen + 6);
	PN[5] = *(pData + HeaderLen + 7);

	payload_len = DataByteCnt - HeaderLen - 8 - 8;	// 8 bytes for CCMP header , 8 bytes for MIC
	payload_len = DataByteCnt - HeaderLen - 8 - 8;	/* 8 bytes for CCMP header , 8 bytes for MIC */
	payload_remainder = (payload_len) % 16;
	num_blocks = (payload_len) / 16;

	// Find start of payload
	payload_index = HeaderLen + 8;	//IV+EIV
	/* Find start of payload */
	payload_index = HeaderLen + 8;	/*IV+EIV */

	for (i = 0; i < num_blocks; i++) {
		construct_ctr_preload(ctr_preload,
@@ -495,10 +495,10 @@ BOOLEAN RTMPSoftDecryptAES(IN PRTMP_ADAPTER pAd,
		payload_index += 16;
	}

	//
	// If there is a short final block, then pad it
	// encrypt it and copy the unpadded part back
	//
	/* */
	/* If there is a short final block, then pad it */
	/* encrypt it and copy the unpadded part back */
	/* */
	if (payload_remainder > 0) {
		construct_ctr_preload(ctr_preload,
				      a4_exists,
@@ -515,9 +515,9 @@ BOOLEAN RTMPSoftDecryptAES(IN PRTMP_ADAPTER pAd,
			       payload_remainder);
		payload_index += payload_remainder;
	}
	//
	// Descrypt the MIC
	//
	/* */
	/* Descrypt the MIC */
	/* */
	construct_ctr_preload(ctr_preload, a4_exists, qc_exists, pData, PN, 0);
	NdisZeroMemory(padded_buffer, 16);
	NdisMoveMemory(padded_buffer, pData + payload_index, 8);
@@ -528,15 +528,15 @@ BOOLEAN RTMPSoftDecryptAES(IN PRTMP_ADAPTER pAd,

	NdisMoveMemory(TrailMIC, chain_buffer, 8);

	//
	// Calculate MIC
	//
	/* */
	/* Calculate MIC */
	/* */

	//Force the protected frame bit on
	/*Force the protected frame bit on */
	*(pData + 1) = *(pData + 1) | 0x40;

	// Find start of payload
	// Because the CCMP header has been removed
	/* Find start of payload */
	/* Because the CCMP header has been removed */
	payload_index = HeaderLen;

	construct_mic_iv(mic_iv, qc_exists, a4_exists, pData, payload_len, PN);
@@ -551,14 +551,14 @@ BOOLEAN RTMPSoftDecryptAES(IN PRTMP_ADAPTER pAd,
	bitwise_xor(aes_out, mic_header2, chain_buffer);
	aes128k128d(pWpaKey[KeyID].Key, chain_buffer, aes_out);

	// iterate through each 16 byte payload block
	/* iterate through each 16 byte payload block */
	for (i = 0; i < num_blocks; i++) {
		bitwise_xor(aes_out, pData + payload_index, chain_buffer);
		payload_index += 16;
		aes128k128d(pWpaKey[KeyID].Key, chain_buffer, aes_out);
	}

	// Add on the final payload block if it needs padding
	/* Add on the final payload block if it needs padding */
	if (payload_remainder > 0) {
		NdisZeroMemory(padded_buffer, 16);
		NdisMoveMemory(padded_buffer, pData + payload_index,
@@ -567,13 +567,13 @@ BOOLEAN RTMPSoftDecryptAES(IN PRTMP_ADAPTER pAd,
		bitwise_xor(aes_out, padded_buffer, chain_buffer);
		aes128k128d(pWpaKey[KeyID].Key, chain_buffer, aes_out);
	}
	// aes_out contains padded mic, discard most significant
	// 8 bytes to generate 64 bit MIC
	/* aes_out contains padded mic, discard most significant */
	/* 8 bytes to generate 64 bit MIC */
	for (i = 0; i < 8; i++)
		MIC[i] = aes_out[i];

	if (!NdisEqualMemory(MIC, TrailMIC, 8)) {
		DBGPRINT(RT_DEBUG_ERROR, ("RTMPSoftDecryptAES, MIC Error !\n"));	//MIC error.
		DBGPRINT(RT_DEBUG_ERROR, ("RTMPSoftDecryptAES, MIC Error !\n"));	/*MIC error. */
		return FALSE;
	}

@@ -1208,27 +1208,27 @@ VOID AES_GTK_KEY_WRAP(IN UCHAR * key,
{
	UCHAR A[8], BIN[16], BOUT[16];
	UCHAR R[512];
	INT num_blocks = p_len / 8;	// unit:64bits
	INT num_blocks = p_len / 8;	/* unit:64bits */
	INT i, j;
	aes_context aesctx;
	UCHAR xor;

	rt_aes_set_key(&aesctx, key, 128);

	// Init IA
	/* Init IA */
	for (i = 0; i < 8; i++)
		A[i] = 0xa6;

	//Input plaintext
	/*Input plaintext */
	for (i = 0; i < num_blocks; i++) {
		for (j = 0; j < 8; j++)
			R[8 * (i + 1) + j] = plaintext[8 * i + j];
	}

	// Key Mix
	/* Key Mix */
	for (j = 0; j < 6; j++) {
		for (i = 1; i <= num_blocks; i++) {
			//phase 1
			/*phase 1 */
			NdisMoveMemory(BIN, A, 8);
			NdisMoveMemory(&BIN[8], &R[8 * i], 8);
			rt_aes_encrypt(&aesctx, BIN, BOUT);
@@ -1240,7 +1240,7 @@ VOID AES_GTK_KEY_WRAP(IN UCHAR * key,
		}
	}

	// Output ciphertext
	/* Output ciphertext */
	NdisMoveMemory(ciphertext, A, 8);

	for (i = 1; i <= num_blocks; i++) {
@@ -1273,7 +1273,7 @@ VOID AES_GTK_KEY_UNWRAP(IN UCHAR * key,
	INT i, j;
	aes_context aesctx;
	UCHAR *R;
	INT num_blocks = c_len / 8;	// unit:64bits
	INT num_blocks = c_len / 8;	/* unit:64bits */

	os_alloc_mem(NULL, (PUCHAR *) & R, 512);

@@ -1283,9 +1283,9 @@ VOID AES_GTK_KEY_UNWRAP(IN UCHAR * key,
		return;
	}
	/* End of if */
	// Initialize
	/* Initialize */
	NdisMoveMemory(A, ciphertext, 8);
	//Input plaintext
	/*Input plaintext */
	for (i = 0; i < (c_len - 8); i++) {
		R[i] = ciphertext[i + 8];
	}
@@ -1304,7 +1304,7 @@ VOID AES_GTK_KEY_UNWRAP(IN UCHAR * key,
		}
	}

	// OUTPUT
	/* OUTPUT */
	for (i = 0; i < c_len; i++) {
		plaintext[i] = R[i];
	}
+350 −350

File changed.

Preview size limit exceeded, changes collapsed.

+10 −10
Original line number Diff line number Diff line
@@ -95,8 +95,8 @@ INT RT_CfgSetCountryRegion(IN PRTMP_ADAPTER pAd, IN PSTRING arg, IN INT band)
		regionMax = REGION_MAXIMUM_A_BAND;
	}

	// TODO: Is it neccesay for following check???
	// Country can be set only when EEPROM not programmed
	/* TODO: Is it neccesay for following check??? */
	/* Country can be set only when EEPROM not programmed */
	if (*pCountryRegion & 0x80) {
		DBGPRINT(RT_DEBUG_ERROR,
			 ("CfgSetCountryRegion():CountryRegion in eeprom was programmed\n"));
@@ -154,7 +154,7 @@ INT RT_CfgSetShortSlot(IN PRTMP_ADAPTER pAd, IN PSTRING arg)
	else if (ShortSlot == 0)
		pAd->CommonCfg.bUseShortSlotTime = FALSE;
	else
		return FALSE;	//Invalid argument
		return FALSE;	/*Invalid argument */

	return TRUE;
}
@@ -176,29 +176,29 @@ INT RT_CfgSetWepKey(IN PRTMP_ADAPTER pAd,
	UCHAR CipherAlg = CIPHER_NONE;
	BOOLEAN bKeyIsHex = FALSE;

	// TODO: Shall we do memset for the original key info??
	/* TODO: Shall we do memset for the original key info?? */
	memset(pSharedKey, 0, sizeof(CIPHER_KEY));
	KeyLen = strlen(keyString);
	switch (KeyLen) {
	case 5:		//wep 40 Ascii type
	case 13:		//wep 104 Ascii type
	case 5:		/*wep 40 Ascii type */
	case 13:		/*wep 104 Ascii type */
		bKeyIsHex = FALSE;
		pSharedKey->KeyLen = KeyLen;
		NdisMoveMemory(pSharedKey->Key, keyString, KeyLen);
		break;

	case 10:		//wep 40 Hex type
	case 26:		//wep 104 Hex type
	case 10:		/*wep 40 Hex type */
	case 26:		/*wep 104 Hex type */
		for (i = 0; i < KeyLen; i++) {
			if (!isxdigit(*(keyString + i)))
				return FALSE;	//Not Hex value;
				return FALSE;	/*Not Hex value; */
		}
		bKeyIsHex = TRUE;
		pSharedKey->KeyLen = KeyLen / 2;
		AtoH(keyString, pSharedKey->Key, pSharedKey->KeyLen);
		break;

	default:		//Invalid argument
	default:		/*Invalid argument */
		DBGPRINT(RT_DEBUG_TRACE,
			 ("RT_CfgSetWepKey(keyIdx=%d):Invalid argument (arg=%s)\n",
			  keyIdx, keyString));
Loading