VOID RTMPWriteTxWI_Data(RTMP_ADAPTER *pAd, TXWI_STRUC *pTxWI, TX_BLK *pTxBlk) { HTTRANSMIT_SETTING *pTransmit; MAC_TABLE_ENTRY *pMacEntry; UINT8 TXWISize = pAd->chipCap.TXWISize; UCHAR wcid, pkt_id; UCHAR sgi, mcs, bw, stbc, phy_mode, ldpc; #ifdef DOT11_N_SUPPORT UCHAR basize, ampdu, mimops = 0, mpdu_density = 0; #endif /* DOT11_N_SUPPORT */ #ifdef MCS_LUT_SUPPORT BOOLEAN lut_enable = 0; UCHAR mbc_wcid; #endif /* MCS_LUT_SUPPORT */ UCHAR tx_stream_mode = 0; ASSERT(pTxWI); pTransmit = pTxBlk->pTransmit; pMacEntry = pTxBlk->pMacEntry; /* Always use Long preamble before verifiation short preamble functionality works well. Todo: remove the following line if short preamble functionality works */ OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_SHORT_PREAMBLE_INUSED); NdisZeroMemory(pTxWI, TXWISize); wcid = pTxBlk->Wcid; sgi = pTransmit->field.ShortGI; stbc = pTransmit->field.STBC; ldpc = pTransmit->field.ldpc; mcs = pTransmit->field.MCS; phy_mode = pTransmit->field.MODE; /* If CCK or OFDM, BW must be 20 */ bw = (pTransmit->field.MODE <= MODE_OFDM) ? (BW_20) : (pTransmit->field.BW); #ifdef MT76x2 if (MT_REV_GTE(pAd, MT76x2, REV_MT76x2E4)) tx_stream_mode = 0x3; else if (MT_REV_ET(pAd, MT76x2, REV_MT76x2E3)) tx_stream_mode = (pTransmit->field.MODE <= MODE_OFDM) ? 0x83 : 0x0; #endif /* MT76x2 */ #ifdef DOT11_N_SUPPORT #ifdef DOT11N_DRAFT3 if (bw) bw = (pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth == 0) ? (BW_20) : (pTransmit->field.BW); #endif /* DOT11N_DRAFT3 */ ampdu = ((pTxBlk->TxFrameType == TX_AMPDU_FRAME) ? TRUE : FALSE); basize = pAd->CommonCfg.TxBASize; if(ampdu && pMacEntry) { /* * Under HT20, 2x2 chipset, OPEN, and with some atero chipsets * reduce BASize to 7 to add one bulk A-MPDU during one TXOP * to improve throughput */ if ((pAd->CommonCfg.BBPCurrentBW == BW_20) && (pAd->Antenna.field.TxPath == 2) && (pMacEntry->bIAmBadAtheros) && (pMacEntry->WepStatus == Ndis802_11EncryptionDisabled)) { basize = 7; } else { UCHAR RABAOriIdx = pTxBlk->pMacEntry->BAOriWcidArray[pTxBlk->UserPriority]; basize = pAd->BATable.BAOriEntry[RABAOriIdx].BAWinSize; } } #endif /* DOT11_N_SUPPORT */ #ifdef DOT11_N_SUPPORT if (pMacEntry) { if ((pMacEntry->MmpsMode == MMPS_DYNAMIC) && (mcs > 7)) mimops = 1; else if (pMacEntry->MmpsMode == MMPS_STATIC) { if ((pTransmit->field.MODE == MODE_HTMIX || pTransmit->field.MODE == MODE_HTGREENFIELD) && (mcs > 7)) { mcs = 7; mimops = 0; } } if ((pAd->CommonCfg.BBPCurrentBW == BW_20) && (pMacEntry->bIAmBadAtheros)) mpdu_density = 7; else mpdu_density = pMacEntry->MpduDensity; } #endif /* DOT11_N_SUPPORT */ #ifdef DBG_DIAGNOSE if (pTxBlk->QueIdx== 0) { pAd->DiagStruct.diag_info[pAd->DiagStruct.ArrayCurIdx].TxDataCnt++; #ifdef DBG_TX_MCS pAd->DiagStruct.diag_info[pAd->DiagStruct.ArrayCurIdx].TxMcsCnt_HT[mcs]++; #endif /* DBG_TX_MCS */ } #endif /* DBG_DIAGNOSE */ /* for rate adapation*/ pkt_id = mcs; #ifdef INF_AMAZON_SE /*Iverson patch for WMM A5-T07 ,WirelessStaToWirelessSta do not bulk out aggregate */ if( RTMP_GET_PACKET_NOBULKOUT(pTxBlk->pPacket)) { if(phy_mode == MODE_CCK) pkt_id = 6; } #endif /* INF_AMAZON_SE */ #ifdef MCS_LUT_SUPPORT if ((RTMP_TEST_MORE_FLAG(pAd, fASIC_CAP_MCS_LUT)) && (wcid < 128) && (pMacEntry && pMacEntry->bAutoTxRateSwitch == TRUE)) { HTTRANSMIT_SETTING rate_ctrl; rate_ctrl.field.MODE = phy_mode; rate_ctrl.field.STBC = stbc; rate_ctrl.field.ShortGI = sgi; rate_ctrl.field.BW = bw; rate_ctrl.field.ldpc = ldpc; rate_ctrl.field.MCS = mcs; if (rate_ctrl.word == pTransmit->word) lut_enable = TRUE; } #ifdef PEER_DELBA_TX_ADAPT GET_GroupKey_WCID(pAd, mbc_wcid, pTxBlk->apidx); if (RTMP_GET_PACKET_LOWRATE(pTxBlk->pPacket) || (wcid == mbc_wcid) || (pMacEntry && (pMacEntry->MmpsMode == MMPS_STATIC))) lut_enable = FALSE; else lut_enable = TRUE; #endif /* PEER_DELBA_TX_ADAPT */ #endif /* MCS_LUT_SUPPORT */ #ifdef RLT_MAC if (pAd->chipCap.hif_type == HIF_RLT) { struct _TXWI_NMAC *txwi_n = (struct _TXWI_NMAC *)pTxWI; txwi_n->FRAG = TX_BLK_TEST_FLAG(pTxBlk, fTX_bAllowFrag); txwi_n->ACK = TX_BLK_TEST_FLAG(pTxBlk, fTX_bAckRequired); if (RTMP_GET_PACKET_TDLS_WAIT_ACK(pTxBlk->pPacket)) { txwi_n->TxPktId |= 0x80; DBGPRINT(RT_DEBUG_INFO,("PktID |= 0x80 : [%x]\n",txwi_n->TxPktId)); } else { txwi_n->TxPktId &= 0x7f; DBGPRINT(RT_DEBUG_INFO,("PktID : [%x]\n",txwi_n->TxPktId)); } #ifdef WFA_VHT_PF if (pAd->force_noack == TRUE) txwi_n->ACK = 0; #endif /* WFA_VHT_PF */ txwi_n->txop = pTxBlk->FrameGap; txwi_n->wcid = wcid; txwi_n->MPDUtotalByteCnt = pTxBlk->MpduHeaderLen + pTxBlk->SrcBufLen; txwi_n->CFACK = TX_BLK_TEST_FLAG(pTxBlk, fTX_bPiggyBack); txwi_n->ShortGI = sgi; txwi_n->STBC = stbc; txwi_n->LDPC = ldpc; txwi_n->TxStreamMode = tx_stream_mode; txwi_n->MCS = mcs; txwi_n->PHYMODE = phy_mode; txwi_n->BW = bw; txwi_n->TxPktId = pkt_id; #ifdef DOT11_N_SUPPORT txwi_n->AMPDU = ampdu; txwi_n->BAWinSize = basize; txwi_n->MIMOps = mimops; txwi_n->MpduDensity = mpdu_density; #endif /* DOT11_N_SUPPORT */ #ifdef MCS_LUT_SUPPORT txwi_n->lut_en = lut_enable; #endif /* MCS_LUT_SUPPORT */ } #endif /* RLT_MAC */ #ifdef RTMP_MAC if (pAd->chipCap.hif_type == HIF_RTMP) { struct _TXWI_OMAC *txwi_o = (struct _TXWI_OMAC *)pTxWI; txwi_o->FRAG = TX_BLK_TEST_FLAG(pTxBlk, fTX_bAllowFrag); txwi_o->ACK = TX_BLK_TEST_FLAG(pTxBlk, fTX_bAckRequired); #ifdef WFA_VHT_PF if (pAd->force_noack == TRUE) txwi_o->ACK = 0; #endif /* WFA_VHT_PF */ txwi_o->txop = pTxBlk->FrameGap; txwi_o->wcid = wcid; txwi_o->MPDUtotalByteCnt = pTxBlk->MpduHeaderLen + pTxBlk->SrcBufLen; txwi_o->CFACK = TX_BLK_TEST_FLAG(pTxBlk, fTX_bPiggyBack); txwi_o->ShortGI = sgi; txwi_o->STBC = stbc; txwi_o->MCS = mcs; txwi_o->PHYMODE = phy_mode; txwi_o->BW = bw; txwi_o->PacketId = pkt_id; #ifdef DOT11_N_SUPPORT txwi_o->AMPDU = ampdu; txwi_o->BAWinSize = basize; txwi_o->MIMOps = mimops; txwi_o->MpduDensity= mpdu_density; #endif /* DOT11_N_SUPPORT */ } #endif /* RTMP_MAC */ }
VOID RTMPWriteTxWI_Data(RTMP_ADAPTER *pAd, TXWI_STRUC *pTxWI, TX_BLK *pTxBlk) { HTTRANSMIT_SETTING *pTransmit; MAC_TABLE_ENTRY *pMacEntry; #ifdef DOT11_N_SUPPORT UCHAR BASize; #endif /* DOT11_N_SUPPORT */ UINT8 TXWISize = pAd->chipCap.TXWISize; ASSERT(pTxWI); pTransmit = pTxBlk->pTransmit; pMacEntry = pTxBlk->pMacEntry; /* Always use Long preamble before verifiation short preamble functionality works well. Todo: remove the following line if short preamble functionality works */ OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_SHORT_PREAMBLE_INUSED); NdisZeroMemory(pTxWI, TXWISize); pTxWI->TxWIFRAG = TX_BLK_TEST_FLAG(pTxBlk, fTX_bAllowFrag); pTxWI->TxWIACK = TX_BLK_TEST_FLAG(pTxBlk, fTX_bAckRequired); pTxWI->TxWITXOP = pTxBlk->FrameGap; pTxWI->TxWIWirelessCliID = pTxBlk->Wcid; pTxWI->TxWIMPDUByteCnt = pTxBlk->MpduHeaderLen + pTxBlk->SrcBufLen; pTxWI->TxWICFACK = TX_BLK_TEST_FLAG(pTxBlk, fTX_bPiggyBack); #ifdef WFA_VHT_PF if (pAd->force_noack == TRUE) pTxWI->TxWIACK = 0; #endif /* WFA_VHT_PF */ pTxWI->TxWIShortGI = pTransmit->field.ShortGI; pTxWI->TxWISTBC = pTransmit->field.STBC; pTxWI->TxWIMCS = pTransmit->field.MCS; pTxWI->TxWIPHYMODE = pTransmit->field.MODE; /* If CCK or OFDM, BW must be 20 */ pTxWI->TxWIBW = (pTransmit->field.MODE <= MODE_OFDM) ? (BW_20) : (pTransmit->field.BW); #ifdef DOT11_N_SUPPORT #ifdef DOT11N_DRAFT3 if (pTxWI->TxWIBW) pTxWI->TxWIBW = (pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth == 0) ? (BW_20) : (pTransmit->field.BW); #endif /* DOT11N_DRAFT3 */ pTxWI->TxWIAMPDU = ((pTxBlk->TxFrameType == TX_AMPDU_FRAME) ? TRUE : FALSE); BASize = pAd->CommonCfg.TxBASize; if((pTxBlk->TxFrameType == TX_AMPDU_FRAME) && (pMacEntry)) { UCHAR RABAOriIdx = pTxBlk->pMacEntry->BAOriWcidArray[pTxBlk->UserPriority]; BASize = pAd->BATable.BAOriEntry[RABAOriIdx].BAWinSize; } pTxWI->TxWIBAWinSize = BASize; #ifdef TXBF_SUPPORT if(pTxBlk->TxSndgPkt > SNDG_TYPE_DISABLE) pTxWI->TxWIAMPDU = FALSE; if (pTxBlk->TxSndgPkt == SNDG_TYPE_SOUNDING) { pTxWI->Sounding = 1; DBGPRINT(RT_DEBUG_TRACE, ("ETxBF in RTMPWriteTxWI_Data(): sending normal sounding, eTxBF=%d\n", pTxWI->eTxBF)); pTxWI->iTxBF = 0; } else if (pTxBlk->TxSndgPkt == SNDG_TYPE_NDP) { if (pTxBlk->TxNDPSndgMcs >= 16) pTxWI->NDPSndRate = 2; else if (pTxBlk->TxNDPSndgMcs >= 8) pTxWI->NDPSndRate = 1; else pTxWI->NDPSndRate = 0; pTxWI->NDPSndBW = pTransmit->field.BW; pTxWI->iTxBF = 0; } else { #ifdef MFB_SUPPORT if (pMacEntry && (pMacEntry->mrqCnt >0) && (pMacEntry->toTxMrq == TRUE)) pTxWI->eTxBF = ~(pTransmit->field.eTxBF); else #endif /* MFB_SUPPORT */ pTxWI->eTxBF = pTransmit->field.eTxBF; pTxWI->iTxBF = pTransmit->field.iTxBF; } if (pTxBlk->TxSndgPkt == SNDG_TYPE_NDP || pTxBlk->TxSndgPkt == SNDG_TYPE_SOUNDING || pTxWI->eTxBF) pTxWI->TxWISTBC = 0; #endif /* TXBF_SUPPORT */ #endif /* DOT11_N_SUPPORT */ #ifdef DOT11_N_SUPPORT if (pMacEntry) { if ((pMacEntry->MmpsMode == MMPS_DYNAMIC) && (pTransmit->field.MCS > 7)) { /* Dynamic MIMO Power Save Mode*/ pTxWI->TxWIMIMOps = 1; } else if (pMacEntry->MmpsMode == MMPS_STATIC) { /* Static MIMO Power Save Mode*/ if ((pTransmit->field.MODE == MODE_HTMIX || pTransmit->field.MODE == MODE_HTGREENFIELD) && (pTransmit->field.MCS > 7)) { pTxWI->TxWIMCS = 7; pTxWI->TxWIMIMOps = 0; } } pTxWI->TxWIMpduDensity = pMacEntry->MpduDensity; } #endif /* DOT11_N_SUPPORT */ #ifdef TXBF_SUPPORT if (pTxBlk->TxSndgPkt > SNDG_TYPE_DISABLE) { pTxWI->TxWIMCS = 0; pTxWI->TxWIAMPDU = FALSE; } #endif /* TXBF_SUPPORT */ #ifdef DBG_DIAGNOSE if (pTxBlk->QueIdx== 0) { pAd->DiagStruct.diag_info[pAd->DiagStruct.ArrayCurIdx].TxDataCnt++; #ifdef DBG_TX_MCS #ifdef DOT11_VHT_AC if (pTxWI->TxWIPHYMODE == MODE_VHT) { pAd->DiagStruct.diag_info[pAd->DiagStruct.ArrayCurIdx].TxMcsCnt_VHT[pTxWI->TxWIMCS]++; if (pTxWI->TxWIShortGI) pAd->DiagStruct.diag_info[pAd->DiagStruct.ArrayCurIdx].TxSGICnt_VHT[pTxWI->TxWIMCS]++; } else #endif /* DOT11_VHT_AC */ pAd->DiagStruct.diag_info[pAd->DiagStruct.ArrayCurIdx].TxMcsCnt_HT[pTxWI->TxWIMCS]++; #endif /* DBG_TX_MCS */ } #endif /* DBG_DIAGNOSE */ /* for rate adapation*/ pTxWI->TxWIPacketId = pTxWI->TxWIMCS; #ifdef INF_AMAZON_SE /*Iverson patch for WMM A5-T07 ,WirelessStaToWirelessSta do not bulk out aggregate */ if( RTMP_GET_PACKET_NOBULKOUT(pTxBlk->pPacket)) { if(pTxWI->TxWIPHYMODE == MODE_CCK) pTxWI->TxWIPacketId = 6; } #endif /* INF_AMAZON_SE */ #ifdef FPGA_MODE if (pAd->fpga_on & 0x6) { pTxWI->TxWIPHYMODE = pAd->data_phy; pTxWI->TxWIMCS = pAd->data_mcs; pTxWI->TxWIBW = pAd->data_bw; pTxWI->TxWIShortGI = pAd->data_gi; if (pAd->data_basize) pTxWI->TxWIBAWinSize = pAd->data_basize; } #endif /* FPGA_MODE */ #ifdef MCS_LUT_SUPPORT if ((RTMP_TEST_MORE_FLAG(pAd, fASIC_CAP_MCS_LUT)) && (pTxWI->TxWIWirelessCliID < 128) && (pMacEntry && pMacEntry->bAutoTxRateSwitch == TRUE)) { HTTRANSMIT_SETTING rate_ctrl; rate_ctrl.field.MODE = pTxWI->TxWIPHYMODE; #ifdef TXBF_SUPPORT rate_ctrl.field.iTxBF = pTxWI->iTxBF; rate_ctrl.field.eTxBF = pTxWI->eTxBF; #endif /* TXBF_SUPPORT */ rate_ctrl.field.STBC = pTxWI->TxWISTBC; rate_ctrl.field.ShortGI = pTxWI->TxWIShortGI; rate_ctrl.field.BW = pTxWI->TxWIBW; rate_ctrl.field.MCS = pTxWI->TxWIMCS; if (rate_ctrl.word == pTransmit->word) pTxWI->TxWILutEn = 1; pTxWI->TxWILutEn = 0; } #ifdef PEER_DELBA_TX_ADAPT if (RTMP_GET_PACKET_LOWRATE(pTxBlk->pPacket) || (pTxBlk->TxFrameType == TX_MCAST_FRAME) || (pMacEntry && (pMacEntry->MmpsMode == MMPS_STATIC))) pTxWI->TxWILutEn = 0; else pTxWI->TxWILutEn = 1; #endif /* PEER_DELBA_TX_ADAPT */ #endif /* MCS_LUT_SUPPORT */ #ifdef DOT11_VHT_AC if (pTxWI->TxWIPHYMODE == MODE_VHT) { DBGPRINT(RT_DEBUG_INFO | DBG_FUNC_RA, ("TxPkt with MODE:VHT, Nss:%d, MCS:%d,BW:%d,basize:%d\n", (pTxWI->TxWIMCS >> 4), (pTxWI->TxWIMCS & 0xf), pTxWI->TxWIBW, pTxWI->TxWIBAWinSize)); }