VOID MtSetIgnorePsm( RTMP_ADAPTER *pAd, MAC_TABLE_ENTRY *pEntry, UCHAR value) { #ifdef RTMP_PCI_SUPPORT ULONG IrqFlags = 0; #endif /* RTMP_PCI_SUPPORT */ struct wtbl_entry tb_entry; union WTBL_1_DW3 *dw3 = (union WTBL_1_DW3 *)&tb_entry.wtbl_1.wtbl_1_d3.word; NdisZeroMemory(&tb_entry, sizeof(tb_entry)); if (mt_wtbl_get_entry234(pAd, pEntry->wcid, &tb_entry) == FALSE) { DBGPRINT(RT_DEBUG_INFO | DBG_FUNC_PS, ("%s():Cannot found WTBL2/3/4\n",__FUNCTION__)); return; } #ifdef RTMP_PCI_SUPPORT RTMP_IRQ_LOCK(&pAd->irq_lock, IrqFlags); #endif /* RTMP_PCI_SUPPORT */ pEntry->i_psm = value; RTMP_IO_READ32(pAd, tb_entry.wtbl_addr[0]+12, &dw3->word); dw3->field.du_i_psm = value; /* I_PSM changed by HW automatically is enabled. */ dw3->field.i_psm = value; /* follow PSM value. */ RTMP_IO_WRITE32(pAd, tb_entry.wtbl_addr[0] + 12, dw3->word); #ifdef RTMP_PCI_SUPPORT RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags); #endif /* RTMP_PCI_SUPPORT */ }
VOID tr_tb_set_entry(RTMP_ADAPTER *pAd, UCHAR tr_tb_idx, MAC_TABLE_ENTRY *pEntry) { struct _STA_TR_ENTRY *tr_entry; INT qidx, tid,upId; //MAC_TABLE_ENTRY *mac_entry; struct wtbl_entry tb_entry; //struct wtbl_2_struc *wtbl_2; if (tr_tb_idx < MAX_LEN_OF_TR_TABLE) { tr_entry = &pAd->MacTab.tr_entry[tr_tb_idx]; tr_entry->EntryType = pEntry->EntryType; tr_entry->wdev = pEntry->wdev; tr_entry->func_tb_idx = pEntry->func_tb_idx; tr_entry->wcid = pEntry->wcid; NdisMoveMemory(tr_entry->Addr, pEntry->Addr, MAC_ADDR_LEN); tr_entry->NonQosDataSeq = 0; for (tid = 0; tid < NUM_OF_TID; tid++) tr_entry->TxSeq[tid] = 0; for(upId = 0 ; upId < NUM_OF_UP ; upId ++) { tr_entry->cacheSn[upId] = -1; } /* Reset BA SSN & Score Board Bitmap, for BA Receiptor */ NdisZeroMemory(&tb_entry, sizeof(tb_entry)); if (mt_wtbl_get_entry234(pAd, tr_entry->wcid, &tb_entry) == FALSE) { DBGPRINT(RT_DEBUG_ERROR, ("%s(): Not found WTBL2/3/4 for tr_entry->wcid(%d), !ERROR!\n", __FUNCTION__, tr_entry->wcid)); return; } //mac_entry = &pAd->MacTab.Content[tr_entry->wcid]; tr_entry->PsMode = PWR_ACTIVE; tr_entry->isCached = FALSE; tr_entry->PortSecured = WPA_802_1X_PORT_NOT_SECURED; tr_entry->CurrTxRate = pEntry->CurrTxRate; for (qidx = 0 ; qidx < WMM_QUE_NUM; qidx++) { InitializeQueueHeader(&tr_entry->tx_queue[qidx]); NdisAllocateSpinLock(pAd, &tr_entry->txq_lock[qidx]); } InitializeQueueHeader(&tr_entry->ps_queue); NdisAllocateSpinLock(pAd, &tr_entry->ps_queue_lock); tr_entry->deq_cnt = 0; tr_entry->deq_bytes = 0; tr_entry->PsQIdleCount = 0; tr_entry->enq_cap = TRUE; tr_entry->deq_cap = TRUE; tr_entry->PsTokenFlag = 0; NdisMoveMemory(tr_entry->bssid, pEntry->wdev->bssid, MAC_ADDR_LEN); } }
VOID CheckSkipTX( RTMP_ADAPTER *pAd, MAC_TABLE_ENTRY *pEntry) { struct wtbl_entry tb_entry; union WTBL_1_DW3 *dw3 = (union WTBL_1_DW3 *)&tb_entry.wtbl_1.wtbl_1_d3.word; STA_TR_ENTRY *tr_entry; CHAR isChange = FALSE; NdisZeroMemory(&tb_entry, sizeof(tb_entry)); if (mt_wtbl_get_entry234(pAd, pEntry->wcid, &tb_entry) == FALSE) { DBGPRINT(RT_DEBUG_INFO | DBG_FUNC_PS, ("%s():Cannot found WTBL2/3/4\n",__FUNCTION__)); return; } tr_entry = &pAd->MacTab.tr_entry[pEntry->wcid]; RTMP_IO_READ32(pAd, tb_entry.wtbl_addr[0]+12, &dw3->word); if ((tr_entry->ps_state != APPS_RETRIEVE_START_PS) && (dw3->field.skip_tx == 1)) { dw3->field.skip_tx = 0; isChange = TRUE; } if ((tr_entry->ps_state < APPS_RETRIEVE_DONE) && (dw3->field.du_i_psm == 1)) { dw3->field.du_i_psm = 0; dw3->field.i_psm = 0; /* also sync pEntry flag*/ pEntry->i_psm = 0 ; isChange = TRUE; } if (isChange == TRUE) { pAd->SkipTxRCount++; RTMP_IO_WRITE32(pAd, tb_entry.wtbl_addr[0]+12, dw3->word); } return; }
VOID MtPsSendToken( RTMP_ADAPTER *pAd, UINT32 WlanIdx) { MAC_TABLE_ENTRY *pEntry = NULL; STA_TR_ENTRY *tr_entry; NDIS_STATUS token_status; struct wtbl_entry tb_entry; union WTBL_1_DW3 *dw3; UINT32 Reg = 0; BOOLEAN pfgForce = 0; unsigned char q_idx; if (pAd->chipCap.hif_type != HIF_MT) { return; } DBGPRINT(RT_DEBUG_ERROR | DBG_FUNC_PS, ("%s(wcid=%d): Driver didn't receive PsRetrieveStartRsp from FW.\n",__FUNCTION__, WlanIdx)); pEntry = &pAd->MacTab.Content[WlanIdx]; tr_entry = &pAd->MacTab.tr_entry[WlanIdx]; NdisZeroMemory(&tb_entry, sizeof(tb_entry)); dw3 = (union WTBL_1_DW3 *)&tb_entry.wtbl_1.wtbl_1_d3.word; if (mt_wtbl_get_entry234(pAd, WlanIdx, &tb_entry) == FALSE) { DBGPRINT(RT_DEBUG_ERROR | DBG_FUNC_PS, ("%s():Cannot found WTBL2/3/4, wcid=%d\n",__FUNCTION__, WlanIdx)); return; } RTMP_IO_READ32(pAd, tb_entry.wtbl_addr[0]+12, &dw3->word); MtReadPseRdTabAccessReg(pAd, pEntry->wcid, &Reg); pfgForce = ( BOOLEAN ) GET_PSE_RTA_RD_RULE_F(Reg); if (pfgForce == 0) { DBGPRINT(RT_DEBUG_WARN | DBG_FUNC_PS, ("%s(ps_state = %d): PS Redirect mode didn't be enabled. Driver doesn't need to send token.\n",__FUNCTION__, tr_entry->ps_state)); DBGPRINT(RT_DEBUG_WARN | DBG_FUNC_PS, ("%s: Reset ps_state to IDLE.\n",__FUNCTION__)); tr_entry->ps_state = APPS_RETRIEVE_IDLE; return; } DBGPRINT(RT_DEBUG_INFO | DBG_FUNC_PS, ("---->%s: Start to send TOKEN frames.\n", __FUNCTION__)); tr_entry->ps_state = APPS_RETRIEVE_GOING; tr_entry->ps_qbitmap = 0; for (q_idx = 0; q_idx < NUM_OF_TX_RING; q_idx++) { token_status = RtmpEnqueueTokenFrame(pAd, &(pEntry->Addr[0]), 0, WlanIdx, 0, q_idx); if (!token_status) tr_entry->ps_qbitmap |= (1 << q_idx); else DBGPRINT(RT_DEBUG_ERROR | DBG_FUNC_PS, ("%s(%d) Fail: Send TOKEN Frame, AC=%d\n", __FUNCTION__, __LINE__, q_idx)); } if (tr_entry->ps_qbitmap == 0) { tr_entry->ps_state = APPS_RETRIEVE_WAIT_EVENT; RTEnqueueInternalCmd(pAd, CMDTHREAD_PS_CLEAR, (VOID *)&WlanIdx, sizeof(UINT32)); DBGPRINT(RT_DEBUG_WARN | DBG_FUNC_PS, ("(ps_state = %d) token enqueue failed for all queues ==> send CMDTHREAD_PS_CLEAR cmd.\n", tr_entry->ps_state)); } }