/* ======================================================================== Routine Description: This routine is used to do insert packet into power-saveing queue. Arguments: pAd: Pointer to our adapter pPacket: Pointer to send packet pMacEntry: portint to entry of MacTab. the pMacEntry store attribute of client (STA). QueIdx: Priority queue idex. Return Value: NDIS_STATUS_SUCCESS:If succes to queue the packet into TxSwQueue. NDIS_STATUS_FAILURE: If failed to do en-queue. ======================================================================== */ NDIS_STATUS RtmpInsertPsQueue( IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket, IN MAC_TABLE_ENTRY *pMacEntry, IN UCHAR QueIdx) { ULONG IrqFlags; #ifdef UAPSD_SUPPORT /* put the U-APSD packet to its U-APSD queue by AC ID */ UINT32 ac_id = QueIdx - QID_AC_BE; /* should be >= 0 */ if (UAPSD_MR_IS_UAPSD_AC(pMacEntry, ac_id)) { UAPSD_PacketEnqueue(pAd, pMacEntry, pPacket, ac_id); #ifdef DOT11Z_TDLS_SUPPORT TDLS_UAPSDP_TrafficIndSend(pAd, pMacEntry->Addr); #endif /* DOT11Z_TDLS_SUPPORT */ } else #endif /* UAPSD_SUPPORT */ { if (pMacEntry->PsQueue.Number >= MAX_PACKETS_IN_PS_QUEUE) { RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); return NDIS_STATUS_FAILURE; } else { DBGPRINT(RT_DEBUG_TRACE, ("legacy ps> queue a packet!\n")); RTMP_IRQ_LOCK(&pAd->irq_lock, IrqFlags); InsertTailQueue(&pMacEntry->PsQueue, PACKET_TO_QUEUE_ENTRY(pPacket)); RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags); } } #ifdef CONFIG_AP_SUPPORT /* mark corresponding TIM bit in outgoing BEACON frame */ #ifdef UAPSD_SUPPORT if (UAPSD_MR_IS_NOT_TIM_BIT_NEEDED_HANDLED(pMacEntry, QueIdx)) { /* 1. the station is UAPSD station; 2. one of AC is non-UAPSD (legacy) AC; 3. the destinated AC of the packet is UAPSD AC. */ /* So we can not set TIM bit due to one of AC is legacy AC */ } else #endif /* UAPSD_SUPPORT */ { WLAN_MR_TIM_BIT_SET(pAd, pMacEntry->apidx, pMacEntry->Aid); } #endif /* CONFIG_AP_SUPPORT */ return NDIS_STATUS_SUCCESS; }
VOID MtEnqTxSwqFromPsQueue(RTMP_ADAPTER *pAd, UCHAR qidx, STA_TR_ENTRY *tr_entry) { ULONG IrqFlags = 0; //struct tx_swq_fifo *fifo_swq; QUEUE_ENTRY *pQEntry; QUEUE_HEADER *pAcPsQue; QUEUE_HEADER *pAcTxQue; #ifdef UAPSD_SUPPORT MAC_TABLE_ENTRY *pEntry = &pAd->MacTab.Content[tr_entry->wcid]; #endif /* UAPSD_SUPPORT */ //fifo_swq = &pAd->tx_swq[qidx]; pAcPsQue = &tr_entry->ps_queue; pAcTxQue = &tr_entry->tx_queue[qidx]; RTMP_IRQ_LOCK(&pAd->irq_lock, IrqFlags); #ifdef UAPSD_SUPPORT if (UAPSD_MR_IS_UAPSD_AC(pEntry, qidx)) { while(pAcPsQue->Head) { pQEntry = RemoveTailQueue(pAcPsQue); UAPSD_PacketEnqueue(pAd, pEntry, PACKET_TO_QUEUE_ENTRY(pQEntry), qidx, TRUE); } } else #endif /* UAPSD_SUPPORT */ { /*check and insert PS Token queue*/ if(pAcPsQue->Number > 0 && tr_entry->wcid > 0 && tr_entry->wcid < MAX_LEN_OF_TR_TABLE) { rtmp_ps_enq(pAd,tr_entry); DBGPRINT(RT_DEBUG_TRACE | DBG_FUNC_PS, ("pAcPsQue->Number=%d,PS:%d\n",pAcPsQue->Number,tr_entry->PsTokenFlag)); } while(pAcPsQue->Head) { pQEntry = RemoveTailQueue(pAcPsQue); if(tr_entry->enqCount > SQ_ENQ_NORMAL_MAX) { RELEASE_NDIS_PACKET(pAd, QUEUE_ENTRY_TO_PACKET(pQEntry), NDIS_STATUS_FAILURE); continue; } InsertHeadQueue(pAcTxQue, pQEntry); #ifdef LIMIT_GLOBAL_SW_QUEUE TR_ENQ_COUNT_INC(tr_entry, &pAd->TxSwQueue[qidx]); #else /* LIMIT_GLOBAL_SW_QUEUE */ TR_ENQ_COUNT_INC(tr_entry); #endif /* ! LIMIT_GLOBAL_SW_QUEUE */ } } RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags); return; }
/* ======================================================================== Routine Description: This routine is used to do insert packet into power-saveing queue. Arguments: pAd: Pointer to our adapter pPacket: Pointer to send packet pMacEntry: portint to entry of MacTab. the pMacEntry store attribute of client (STA). QueIdx: Priority queue idex. Return Value: NDIS_STATUS_SUCCESS:If succes to queue the packet into TxSwQueue. NDIS_STATUS_FAILURE: If failed to do en-queue. ======================================================================== */ NDIS_STATUS RtmpInsertPsQueue( IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket, IN MAC_TABLE_ENTRY *pMacEntry, IN UCHAR QueIdx) { ULONG IrqFlags; #ifdef UAPSD_SUPPORT /* put the U-APSD packet to its U-APSD queue by AC ID */ UINT32 ac_id = QueIdx - QID_AC_BE; /* should be >= 0 */ if (UAPSD_MR_IS_UAPSD_AC(pMacEntry, ac_id)) { UAPSD_PacketEnqueue(pAd, pMacEntry, pPacket, ac_id); #ifdef DOT11Z_TDLS_SUPPORT TDLS_UAPSDP_TrafficIndSend(pAd, pMacEntry->Addr); #endif /* DOT11Z_TDLS_SUPPORT */ } else #endif /* UAPSD_SUPPORT */ { if (pMacEntry->PsQueue.Number >= MAX_PACKETS_IN_PS_QUEUE) { RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); return NDIS_STATUS_FAILURE; } else { DBGPRINT(RT_DEBUG_TRACE, ("legacy ps> queue a packet!\n")); RTMP_IRQ_LOCK(&pAd->irq_lock, IrqFlags); InsertTailQueue(&pMacEntry->PsQueue, PACKET_TO_QUEUE_ENTRY(pPacket)); RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags); } } return NDIS_STATUS_SUCCESS; }