/****************************************************************************
* Ralink Tech Inc.
* Taiwan, R.O.C.
*
* (c) Copyright 2002, Ralink Technology, Inc.
*
* All rights reserved. Ralink's source code is an unpublished work and the
* use of a copyright notice does not imply otherwise. This source code
* contains confidential trade secret material of Ralink Tech. Any attemp
* or participation in deciphering, decoding, reverse engineering or in any
* way altering the source code is stricitly prohibited, unless the prior
* written consent of Ralink Technology, Inc. is obtained.
***************************************************************************/
/****************************************************************************
Abstract:
All related WMM ACM common (AP/STA) function body.
History:
1. 2009/08/26 Sample Lin
(1) Move ACM_APSD_Ctrl() to ACM_TC_Destroy()
(2) Do not delete TSPEC if DELTS is not sent to STA when STA
is in Power Save mode, i.e. UAPSD mode.
(3) Duplicate action frames to legacy PS queue
in AP_QueuePsActionPacket if UAPSD of VO is enabled,
not all ACs are UAPSD mode and STA is in PS mode.
2. 2009/09/29 Sample Lin
(1) Improve WMM ACM TCLAS add command in acm_iocl.c.
(2) No need check timeout if timeout function is disabled in
ACMP_DataNullHandle().
(3) No need TCLAS UP check in ACMP_DataNullHandle().
3. 2009/11/09 Sample Lin
(1) Add some TODO in the fucture.
***************************************************************************/
#include "rt_config.h"
//#define PERFORMANCE_IMPACT_TEST /* only for test */
//#define WMM_ACM_FUNC_DEBUG
#ifdef WMM_ACM_SUPPORT
/* IEEE802.11E related include files */
#include "acm_extr.h" /* used for other modules */
#include "acm_comm.h" /* used for edca/wmm */
#include "acm_edca.h" /* used for edca/wmm */
#ifdef WMM_ACM_FUNC_DEBUG
#define WMM_ACM_FUNC_NAME_PRINT(__pMsg) \
ACMR_DEBUG(ACMR_DEBUG_ERR, ("acm_func> %s: %s\n", __FUNCTION__, __pMsg));
#else
#define WMM_ACM_FUNC_NAME_PRINT(__pMsg)
#endif // WMM_ACM_FUNC_DEBUG //
/* ----- Extern Variable ----- */
/* other modules */
extern VOID RT28XX_IOCTL_MaxRateGet(
IN RTMP_ADAPTER *pAd,
IN PHTTRANSMIT_SETTING pHtPhyMode,
OUT UINT32 *pRate);
extern VOID BA_MaxWinSizeReasign(
IN PRTMP_ADAPTER pAd,
IN MAC_TABLE_ENTRY *pEntryPeer,
OUT UCHAR *pWinSize);
/* from EDCA module (acm_edca.c) */
extern UCHAR gEDCA_UP_AC[]; /* EDCA Priority vs. AC */
extern UCHAR gEDCA_AC_UP[]; /* EDCA AC vs. Priority */
extern UCHAR gEDCA_UP_DSCP[]; /* DSCP vs. Priority */
/* ----- Private Variable ----- */
/* TCLAS related */
UCHAR gTCLAS_Elm_Len[3] = { ACM_TCLAS_TYPE_WME_ETHERNET_LEN,
ACM_TCLAS_TYPE_WME_IP_V4_LEN,
ACM_TCLAS_TYPE_WME_8021DQ_LEN };
UCHAR gAcmTestFlag = 0; /* used for self-test */
static const UCHAR gAcmRateLegacy[4] =
{ ACM_RATE_11M, ACM_RATE_5_5M, ACM_RATE_2M, ACM_RATE_1M};
static const UCHAR gAcmRateG[8] =
{ ACM_RATE_54M, ACM_RATE_48M, ACM_RATE_36M, ACM_RATE_24M,
ACM_RATE_18M, ACM_RATE_12M, ACM_RATE_9M, ACM_RATE_6M};
/* cck & ofdm MCS */
#define ACM_RATE_UNIT ((UINT32)100000) /* 100000bps */
#define ACM_CCK_LPM_MIN_MCS 0
#define ACM_CCK_LPM_MAX_MCS 3
#define ACM_CCK_SPM_MIN_MCS 8
#define ACM_CCK_SPM_MAX_MCS 11
UINT8 gAcmMCS_CCK[2][4][2] =
{
/* b mode, [2]: long preamble and short preamble */
/* unit: 100000bps */
{ { 0, 10 }, { 1, 20 }, { 2, 55 }, { 3, 110 } },
{ { 8, 10 }, { 9, 20 }, { 10, 55 }, { 11, 110 } }
};
UINT16 gAcmMCS_OFDM[8][2] =
{
/* g mode */
/* unit: 100000bps */
{ 0, 60 }, { 1, 90 }, { 2, 120 }, { 3, 180 },
{ 4, 240 }, { 5, 360 }, { 6, 480 }, { 7, 540 }
};
#ifndef ACM_CC_FUNC_AUX_TX_TIME
static UINT16 gAcmTxTimeBody[ACM_RATE_MAX_NUM][ACM_PRE_TIME_DATA_SIZE_NUM];
static UINT16 gAcmTxTimeOthers[ACM_RATE_MAX_NUM][2][5];
#endif // ACM_CC_FUNC_AUX_TX_TIME //
#ifdef ACM_CC_FUNC_11N
static const UINT16 gAcmMCS_HT[2][2][32] =
{
/* 20MHz */
{
/* Regular GI */
/* MCS0 ~ MCS31: (unit 100000bps) */
{
65, 130, 195, 260, 390, 520, 585, 650, 130, 260,
390, 520, 780, 1040, 1170, 1300, 195, 390, 585, 780,
1170, 1560, 1755, 1950, 260, 520, 780, 1040, 1560, 2080,
2340, 2600
},
/* Short GI */
/* MCS0 ~ MCS31: (unit 100000bps) */
{
72, 144, 217, 289, 433, 578, 650, 722, 144, 289,
433, 578, 867, 1156, 1300, 1444, 217, 433, 650, 867,
1300, 1733, 1950, 2167, 2890, 578, 867, 1156, 1733, 2311,
2600, 2889
},
},
/* 40MHz */
{
/* Regular GI */
/* MCS0 ~ MCS31: (unit 100000bps) */
{
135, 270, 405, 540, 810, 1080, 1215, 1350, 270, 540,
810, 1080, 1620, 2160, 2430, 2700, 405, 810, 1215, 1620,
2430, 3240, 3645, 4050, 540, 1080, 1620, 2160, 3240, 4320,
4860, 5400
},
/* Short GI */
/* MCS0 ~ MCS31: (unit 100000bps) */
{
150, 300, 450, 600, 900, 1200, 1350, 1500, 300, 600,
900, 1200, 1800, 2400, 2700, 3000, 450, 900, 1350, 1800,
2700, 3600, 4050, 4500, 600, 1200, 1800, 2400, 3600, 4800,
5400, 6000
},
},
};
static const UINT16 gAcmRateNdbps[2][32] =
{
/* MCS0 ~ MCS31 */
/* 20MHz */
{
26, 52, 78, 104, 156, 208, 234, 260,
52, 104, 156, 208, 312, 416, 468, 520,
78, 156, 234, 312, 468, 624, 702, 780,
104, 208, 312, 416, 624, 832, 936, 1040
},
/* MCS0 ~ MCS31 */
/* 40MHz */
{
54, 108, 162, 216, 324, 432, 486, 540,
108, 216, 324, 432, 648, 864, 972, 1080,
162, 324, 486, 648, 972, 1296, 1458, 1620,
216, 432, 648, 864, 1296, 1728, 1944, 2160
},
};
static const UINT32 gAcmRateNes[2] = { 0x00000000, 0xF0E00000 };
#ifndef ACM_CC_FUNC_AUX_TX_TIME
static UINT16 gAcmTxTimeBodyHT[2][2][ACM_RATE_MAX_NUM_HT][ACM_PRE_TIME_DATA_SIZE_NUM][2];
/* tx time for block ack whatever 20/40 or GI */
static UINT16 gAcmTxTimeOthersHT;
#endif // ACM_CC_FUNC_AUX_TX_TIME //
#endif // ACM_CC_FUNC_11N //
/* for memory allocation/free test purpose */
#ifdef ACM_MEMORY_TEST
UINT32 gAcmMemAllocNum = 0;
UINT32 gAcmMemFreeNum = 0;
#endif // ACM_MEMORY_TEST //
/* =========================== Global Function (AP) ========================= */
/*
========================================================================
Routine Description:
Initialize the ACM Module.
Arguments:
pAd - WLAN control block pointer
FlgIsAcm0Enable - the ACM flag for AC0
FlgIsAcm1Enable - the ACM flag for AC1
FlgIsAcm2Enable - the ACM flag for AC2
FlgIsAcm3Enable - the ACM flag for AC3
FlgDatl - the Dynamic ATL flag
Return Value:
ACM_RTN_OK - init OK
ACM_RTN_FAIL - init fail
Note:
FlgIsAcm0Enable ~ FlgIsAcm3Enable and FlgDatl are valid only for QAP mode.
========================================================================
*/
#ifdef CONFIG_AP_SUPPORT
ACM_FUNC_STATUS ACMP_Init(
ACM_PARAM_IN ACMR_PWLAN_STRUC pAd,
ACM_PARAM_IN UCHAR FlgIsAcm0Enable,
ACM_PARAM_IN UCHAR FlgIsAcm1Enable,
ACM_PARAM_IN UCHAR FlgIsAcm2Enable,
ACM_PARAM_IN UCHAR FlgIsAcm3Enable,
ACM_PARAM_IN UCHAR FlgDatl)
#endif // CONFIG_AP_SUPPORT //
{
ACM_CTRL_PARAM *pEdcaParam;
/* allocate ACM Control Block memory */
ACMR_ADAPTER_DB = ACMR_MEM_ALLOC(sizeof(ACM_CTRL_BLOCK));
if (ACMR_ADAPTER_DB == NULL)
return ACM_RTN_FAIL;
/* End of if */
ACMR_MEM_ZERO(ACMR_ADAPTER_DB, sizeof(ACM_CTRL_BLOCK));
/* init tasklets */
ACMR_TASK_INIT(pAd, ACMR_CB->TaskletTspecReqCheck,
ACM_TASK_TC_ReqCheck, pAd, "ACM_TCREQ");
ACMR_TASK_INIT(pAd, ACMR_CB->TaskletStreamAliveCheck,
ACM_TASK_STM_Check, pAd, "ACM_AVCK");
/* init timers */
ACMR_TIMER_INIT(pAd, ACMR_CB->TimerTspecReqCheck,
ACMP_TR_TC_ReqCheck, pAd);
ACMR_TIMER_INIT(pAd, ACMR_CB->TimerStreamAliveCheck,
ACMP_TR_STM_Check, pAd);
/* init other parameters */
pEdcaParam = &ACMR_CB->EdcaCtrlParam;
/* enable channel busy time calculation */
pEdcaParam->FlgIsChanUtilEnable = 1;
ACMR_CHAN_BUSY_DETECT_ENABLE(pAd);
#ifdef CONFIG_AP_SUPPORT
/* init availabl
- 1
- 2
- 3
- 4
- 5
- 6
前往页