コード例 #1
0
ファイル: ba_action.c プロジェクト: acassis/emlinux-ssd1935
/* 
 * generate ADDBA request to 
 * set up BA agreement
 */
VOID BAOriSessionSetUp(
					  IN PRTMP_ADAPTER    pAd, 
					  IN MAC_TABLE_ENTRY  *pEntry,
					  IN UCHAR            TID,
					  IN USHORT           TimeOut,
					  IN ULONG            DelayTime,
					  IN BOOLEAN          isForced)

{
	//MLME_ADDBA_REQ_STRUCT	AddbaReq;
	BA_ORI_ENTRY            *pBAEntry = NULL;
	USHORT                  Idx;
	BOOLEAN                 Cancelled;
	
	if ((pAd->CommonCfg.BACapability.field.AutoBA != TRUE)  &&  (isForced == FALSE))
		return;

	// if this entry is limited to use legacy tx mode, it doesn't generate BA.  
	if (RTMPStaFixedTxMode(pAd, pEntry) != FIXED_TXMODE_HT)
		return;

	if ((pEntry->BADeclineBitmap & (1<<TID)) && (isForced == FALSE))
	{
		// try again after 3 secs
		DelayTime = 3000; 
//		DBGPRINT(RT_DEBUG_TRACE, ("DeCline BA from Peer\n"));
//		return;
	}

	
	Idx = pEntry->BAOriWcidArray[TID];  
	if (Idx == 0)
	{
		// allocate a BA session
		pBAEntry = BATableAllocOriEntry(pAd, &Idx);     
		if (pBAEntry == NULL)
		{
			DBGPRINT(RT_DEBUG_TRACE,("ADDBA - MlmeADDBAAction() allocate BA session failed \n"));
			return;
		}
	}
	else
	{
		pBAEntry =&pAd->BATable.BAOriEntry[Idx];
	}

	if (pBAEntry->ORI_BA_Status >= Originator_WaitRes)
	{
		return;
	}

	pEntry->BAOriWcidArray[TID] = Idx;

	// Initialize BA session 
	pBAEntry->ORI_BA_Status = Originator_WaitRes;       
	pBAEntry->Wcid = pEntry->Aid;
	pBAEntry->BAWinSize = pAd->CommonCfg.BACapability.field.RxBAWinLimit;   
	pBAEntry->Sequence = BA_ORI_INIT_SEQ;
	pBAEntry->Token = 1;	// (2008-01-21) Jan Lee recommends it - this token can't be 0
	pBAEntry->TID = TID;
	pBAEntry->TimeOutValue = TimeOut;   
	pBAEntry->pAdapter = pAd;
	
	if (!(pEntry->TXBAbitmap & (1<<TID)))
	{
		RTMPInitTimer(pAd, &pBAEntry->ORIBATimer, GET_TIMER_FUNCTION(BAOriSessionSetupTimeout), pBAEntry, FALSE);
	}
	else
		RTMPCancelTimer(&pBAEntry->ORIBATimer, &Cancelled);

	// set timer to send ADDBA request 
	RTMPSetTimer(&pBAEntry->ORIBATimer, DelayTime);
}
コード例 #2
0
ファイル: ba_action.c プロジェクト: ANFS/ANFS-kernel
/*
 * generate ADDBA request to
 * set up BA agreement
 */
void BAOriSessionSetUp(struct rt_rtmp_adapter *pAd,
		       struct rt_mac_table_entry *pEntry,
		       u8 TID,
		       u16 TimeOut,
		       unsigned long DelayTime, IN BOOLEAN isForced)
{
	/*struct rt_mlme_addba_req AddbaReq; */
	struct rt_ba_ori_entry *pBAEntry = NULL;
	u16 Idx;
	BOOLEAN Cancelled;

	if ((pAd->CommonCfg.BACapability.field.AutoBA != TRUE)
	    && (isForced == FALSE))
		return;

	/* if this entry is limited to use legacy tx mode, it doesn't generate BA. */
	if (RTMPStaFixedTxMode(pAd, pEntry) != FIXED_TXMODE_HT)
		return;

	if ((pEntry->BADeclineBitmap & (1 << TID)) && (isForced == FALSE)) {
		/* try again after 3 secs */
		DelayTime = 3000;
/*              DBGPRINT(RT_DEBUG_TRACE, ("DeCline BA from Peer\n")); */
/*              return; */
	}

	Idx = pEntry->BAOriWcidArray[TID];
	if (Idx == 0) {
		/* allocate a BA session */
		pBAEntry = BATableAllocOriEntry(pAd, &Idx);
		if (pBAEntry == NULL) {
			DBGPRINT(RT_DEBUG_TRACE,
				 ("ADDBA - MlmeADDBAAction() allocate BA session failed \n"));
			return;
		}
	} else {
		pBAEntry = &pAd->BATable.BAOriEntry[Idx];
	}

	if (pBAEntry->ORI_BA_Status >= Originator_WaitRes) {
		return;
	}

	pEntry->BAOriWcidArray[TID] = Idx;

	/* Initialize BA session */
	pBAEntry->ORI_BA_Status = Originator_WaitRes;
	pBAEntry->Wcid = pEntry->Aid;
	pBAEntry->BAWinSize = pAd->CommonCfg.BACapability.field.RxBAWinLimit;
	pBAEntry->Sequence = BA_ORI_INIT_SEQ;
	pBAEntry->Token = 1;	/* (2008-01-21) Jan Lee recommends it - this token can't be 0 */
	pBAEntry->TID = TID;
	pBAEntry->TimeOutValue = TimeOut;
	pBAEntry->pAdapter = pAd;

	if (!(pEntry->TXBAbitmap & (1 << TID))) {
		RTMPInitTimer(pAd, &pBAEntry->ORIBATimer,
			      GET_TIMER_FUNCTION(BAOriSessionSetupTimeout),
			      pBAEntry, FALSE);
	} else
		RTMPCancelTimer(&pBAEntry->ORIBATimer, &Cancelled);

	/* set timer to send ADDBA request */
	RTMPSetTimer(&pBAEntry->ORIBATimer, DelayTime);
}