blob: 91098dc7433f89925eb8c67baa1fa573824923d8 [file] [log] [blame]
/******************************************************************************
*
* This file is provided under a dual license. When you use or
* distribute this software, you may choose to be licensed under
* version 2 of the GNU General Public License ("GPLv2 License")
* or BSD License.
*
* GPLv2 License
*
* Copyright(C) 2016 MediaTek Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See http://www.gnu.org/licenses/gpl-2.0.html for more details.
*
* BSD LICENSE
*
* Copyright(C) 2016 MediaTek Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*****************************************************************************/
/*
** Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/mgmt/rlm.h#2
*/
/*! \file "rlm.h"
* \brief
*/
#ifndef _RLM_H
#define _RLM_H
/*******************************************************************************
* C O M P I L E R F L A G S
********************************************************************************
*/
/*******************************************************************************
* E X T E R N A L R E F E R E N C E S
********************************************************************************
*/
extern BOOLEAN g_bIcapEnable;
extern BOOLEAN g_bCaptureDone;
extern UINT_16 g_u2DumpIndex;
#if CFG_SUPPORT_QA_TOOL
extern UINT_32 g_au4Offset[2][2];
extern UINT_32 g_au4IQData[256];
#endif
/*******************************************************************************
* C O N S T A N T S
********************************************************************************
*/
#define ELEM_EXT_CAP_DEFAULT_VAL \
(ELEM_EXT_CAP_20_40_COEXIST_SUPPORT /*| ELEM_EXT_CAP_PSMP_CAP*/)
#if CFG_SUPPORT_RX_STBC
#define FIELD_HT_CAP_INFO_RX_STBC HT_CAP_INFO_RX_STBC_1_SS
#else
#define FIELD_HT_CAP_INFO_RX_STBC HT_CAP_INFO_RX_STBC_NO_SUPPORTED
#endif
#if CFG_SUPPORT_RX_SGI
#define FIELD_HT_CAP_INFO_SGI_20M HT_CAP_INFO_SHORT_GI_20M
#define FIELD_HT_CAP_INFO_SGI_40M HT_CAP_INFO_SHORT_GI_40M
#else
#define FIELD_HT_CAP_INFO_SGI_20M 0
#define FIELD_HT_CAP_INFO_SGI_40M 0
#endif
#if CFG_SUPPORT_RX_HT_GF
#define FIELD_HT_CAP_INFO_HT_GF HT_CAP_INFO_HT_GF
#else
#define FIELD_HT_CAP_INFO_HT_GF 0
#endif
#define HT_CAP_INFO_DEFAULT_VAL \
(HT_CAP_INFO_SUP_CHNL_WIDTH | HT_CAP_INFO_DSSS_CCK_IN_40M | HT_CAP_INFO_SM_POWER_SAVE)
#define AMPDU_PARAM_DEFAULT_VAL \
(AMPDU_PARAM_MAX_AMPDU_LEN_64K | AMPDU_PARAM_MSS_NO_RESTRICIT)
#define SUP_MCS_TX_DEFAULT_VAL \
SUP_MCS_TX_SET_DEFINED /* TX defined and TX/RX equal (TBD) */
#if CFG_SUPPORT_MFB
#define FIELD_HT_EXT_CAP_MFB HT_EXT_CAP_MCS_FEEDBACK_BOTH
#else
#define FIELD_HT_EXT_CAP_MFB HT_EXT_CAP_MCS_FEEDBACK_NO_FB
#endif
#if CFG_SUPPORT_RX_RDG
#define FIELD_HT_EXT_CAP_RDR HT_EXT_CAP_RD_RESPONDER
#else
#define FIELD_HT_EXT_CAP_RDR 0
#endif
#if CFG_SUPPORT_MFB || CFG_SUPPORT_RX_RDG
#define FIELD_HT_EXT_CAP_HTC HT_EXT_CAP_HTC_SUPPORT
#else
#define FIELD_HT_EXT_CAP_HTC 0
#endif
#define HT_EXT_CAP_DEFAULT_VAL \
(HT_EXT_CAP_PCO | HT_EXT_CAP_PCO_TRANS_TIME_NONE | \
FIELD_HT_EXT_CAP_MFB | FIELD_HT_EXT_CAP_HTC | \
FIELD_HT_EXT_CAP_RDR)
#define TX_BEAMFORMING_CAP_DEFAULT_VAL 0
#if CFG_SUPPORT_BFEE
#define TX_BEAMFORMING_CAP_BFEE \
(TXBF_RX_NDP_CAPABLE | \
TXBF_EXPLICIT_COMPRESSED_FEEDBACK_IMMEDIATE_CAPABLE | \
TXBF_MINIMAL_GROUPING_1_2_3_CAPABLE | \
TXBF_COMPRESSED_TX_ANTENNANUM_4_SUPPORTED | \
TXBF_CHANNEL_ESTIMATION_4STS_CAPABILITY)
#else
#define TX_BEAMFORMING_CAP_BFEE 0
#endif
#if CFG_SUPPORT_BFER
#define TX_BEAMFORMING_CAP_BFER \
(TXBF_TX_NDP_CAPABLE | \
TXBF_EXPLICIT_COMPRESSED_TX_CAPAB)
#else
#define TX_BEAMFORMING_CAP_BFER 0
#endif
#define ASEL_CAP_DEFAULT_VAL 0
/* Define bandwidth from user setting */
#define CONFIG_BW_20_40M 0
#define CONFIG_BW_20M 1 /* 20MHz only */
#if CFG_SUPPORT_802_11AC
#if CFG_SUPPORT_BFEE
#define FIELD_VHT_CAP_INFO_BFEE \
(VHT_CAP_INFO_SU_BEAMFORMEE_CAPABLE)
#define VHT_CAP_INFO_BEAMFORMEE_STS_CAP_MAX 3
#else
#define FIELD_VHT_CAP_INFO_BFEE 0
#endif
#if CFG_SUPPORT_BFER
#define FIELD_VHT_CAP_INFO_BFER \
(VHT_CAP_INFO_SU_BEAMFORMER_CAPABLE| \
VHT_CAP_INFO_NUMBER_OF_SOUNDING_DIMENSIONS_2_SUPPORTED)
#else
#define FIELD_VHT_CAP_INFO_BFER 0
#endif
#define VHT_CAP_INFO_DEFAULT_VAL \
(VHT_CAP_INFO_MAX_MPDU_LEN_3K | \
(AMPDU_PARAM_MAX_AMPDU_LEN_1024K << VHT_CAP_INFO_MAX_AMPDU_LENGTH_OFFSET))
#define VHT_CAP_INFO_DEFAULT_HIGHEST_DATA_RATE 0
#endif
/*******************************************************************************
* D A T A T Y P E S
********************************************************************************
*/
#if CFG_SUPPORT_CAL_RESULT_BACKUP_TO_HOST
typedef struct _RLM_CAL_RESULT_ALL_V2_T {
/* Used for checking the Cal Data is damaged */
UINT_32 u4MagicNum1;
/* Thermal Value when do these Calibration */
UINT_32 u4ThermalInfo;
/* Total Rom Data Length Backup in Host Side */
UINT_32 u4ValidRomCalDataLength;
/* Total Ram Data Length Backup in Host Side */
UINT_32 u4ValidRamCalDataLength;
/* All Rom Cal Data Dumpped by FW */
UINT_32 au4RomCalData[10000];
/* All Ram Cal Data Dumpped by FW */
UINT_32 au4RamCalData[10000];
/* Used for checking the Cal Data is damaged */
UINT_32 u4MagicNum2;
} RLM_CAL_RESULT_ALL_V2_T, *P_RLM_CAL_RESULT_ALL_V2_T;
extern RLM_CAL_RESULT_ALL_V2_T g_rBackupCalDataAllV2;
#endif
/*******************************************************************************
* P U B L I C D A T A
********************************************************************************
*/
/*******************************************************************************
* P R I V A T E D A T A
********************************************************************************
*/
/*******************************************************************************
* M A C R O S
********************************************************************************
*/
/* It is used for RLM module to judge if specific network is valid
* Note: Ad-hoc mode of AIS is not included now. (TBD)
*/
#define RLM_NET_PARAM_VALID(_prBssInfo) \
(IS_BSS_ACTIVE(_prBssInfo) && \
((_prBssInfo)->eConnectionState == PARAM_MEDIA_STATE_CONNECTED || \
(_prBssInfo)->eCurrentOPMode == OP_MODE_ACCESS_POINT || \
(_prBssInfo)->eCurrentOPMode == OP_MODE_IBSS || \
IS_BSS_BOW(_prBssInfo)) \
)
#define RLM_NET_IS_11N(_prBssInfo) \
((_prBssInfo)->ucPhyTypeSet & PHY_TYPE_SET_802_11N)
#define RLM_NET_IS_11GN(_prBssInfo) \
((_prBssInfo)->ucPhyTypeSet & PHY_TYPE_SET_802_11GN)
#if CFG_SUPPORT_802_11AC
#define RLM_NET_IS_11AC(_prBssInfo) \
((_prBssInfo)->ucPhyTypeSet & PHY_TYPE_SET_802_11AC)
#endif
/* The bandwidth modes are not used anymore. They represent if AP
* can use 20/40 bandwidth, not all modes. (20110411)
*/
#define RLM_AP_IS_BW_40_ALLOWED(_prAdapter, _prBssInfo) \
(((_prBssInfo)->eBand == BAND_2G4 && \
(_prAdapter)->rWifiVar.rConnSettings.uc2G4BandwidthMode \
== CONFIG_BW_20_40M) || \
((_prBssInfo)->eBand == BAND_5G && \
(_prAdapter)->rWifiVar.rConnSettings.uc5GBandwidthMode \
== CONFIG_BW_20_40M))
/*******************************************************************************
* F U N C T I O N D E C L A R A T I O N S
********************************************************************************
*/
VOID rlmFsmEventInit(P_ADAPTER_T prAdapter);
VOID rlmFsmEventUninit(P_ADAPTER_T prAdapter);
VOID rlmReqGeneratePowerCapIE(P_ADAPTER_T prAdapter, P_MSDU_INFO_T prMsduInfo);
VOID rlmReqGenerateSupportedChIE(P_ADAPTER_T prAdapter, P_MSDU_INFO_T prMsduInfo);
VOID rlmReqGenerateHtCapIE(P_ADAPTER_T prAdapter, P_MSDU_INFO_T prMsduInfo);
VOID rlmReqGenerateExtCapIE(P_ADAPTER_T prAdapter, P_MSDU_INFO_T prMsduInfo);
VOID rlmRspGenerateHtCapIE(P_ADAPTER_T prAdapter, P_MSDU_INFO_T prMsduInfo);
VOID rlmRspGenerateExtCapIE(P_ADAPTER_T prAdapter, P_MSDU_INFO_T prMsduInfo);
VOID rlmRspGenerateHtOpIE(P_ADAPTER_T prAdapter, P_MSDU_INFO_T prMsduInfo);
VOID rlmRspGenerateErpIE(P_ADAPTER_T prAdapter, P_MSDU_INFO_T prMsduInfo);
VOID rlmGenerateMTKOuiIE(P_ADAPTER_T prAdapter, P_MSDU_INFO_T prMsduInfo);
BOOLEAN rlmParseCheckMTKOuiIE(IN P_ADAPTER_T prAdapter, IN PUINT_8 pucBuf, IN PUINT_32 pu4Cap);
VOID rlmGenerateCsaIE(P_ADAPTER_T prAdapter, P_MSDU_INFO_T prMsduInfo);
VOID rlmProcessBcn(P_ADAPTER_T prAdapter, P_SW_RFB_T prSwRfb, PUINT_8 pucIE, UINT_16 u2IELength);
VOID rlmProcessAssocRsp(P_ADAPTER_T prAdapter, P_SW_RFB_T prSwRfb, PUINT_8 pucIE, UINT_16 u2IELength);
VOID rlmProcessHtAction(P_ADAPTER_T prAdapter, P_SW_RFB_T prSwRfb);
#if CFG_SUPPORT_802_11AC
VOID rlmProcessVhtAction(P_ADAPTER_T prAdapter, P_SW_RFB_T prSwRfb);
#endif
VOID rlmFillSyncCmdParam(P_CMD_SET_BSS_RLM_PARAM_T prCmdBody, P_BSS_INFO_T prBssInfo);
VOID rlmSyncOperationParams(P_ADAPTER_T prAdapter, P_BSS_INFO_T prBssInfo);
VOID rlmBssInitForAPandIbss(P_ADAPTER_T prAdapter, P_BSS_INFO_T prBssInfo);
VOID rlmProcessAssocReq(P_ADAPTER_T prAdapter, P_SW_RFB_T prSwRfb, PUINT_8 pucIE, UINT_16 u2IELength);
VOID rlmBssAborted(P_ADAPTER_T prAdapter, P_BSS_INFO_T prBssInfo);
#if CFG_SUPPORT_TDLS
UINT_32
rlmFillHtCapIEByParams(BOOLEAN fg40mAllowed,
BOOLEAN fgShortGIDisabled,
UINT_8 u8SupportRxSgi20,
UINT_8 u8SupportRxSgi40, UINT_8 u8SupportRxGf, ENUM_OP_MODE_T eCurrentOPMode, UINT_8 *pOutBuf);
UINT_32 rlmFillHtCapIEByAdapter(P_ADAPTER_T prAdapter, P_BSS_INFO_T prBssInfo, UINT_8 *pOutBuf);
UINT_32 rlmFillVhtCapIEByAdapter(P_ADAPTER_T prAdapter, P_BSS_INFO_T prBssInfo, UINT_8 *pOutBuf);
#endif
#if CFG_SUPPORT_802_11AC
VOID rlmReqGenerateVhtCapIE(P_ADAPTER_T prAdapter, P_MSDU_INFO_T prMsduInfo);
VOID rlmRspGenerateVhtCapIE(P_ADAPTER_T prAdapter, P_MSDU_INFO_T prMsduInfo);
VOID rlmRspGenerateVhtOpIE(P_ADAPTER_T prAdapter, P_MSDU_INFO_T prMsduInfo);
VOID rlmFillVhtOpIE(P_ADAPTER_T prAdapter, P_BSS_INFO_T prBssInfo, P_MSDU_INFO_T prMsduInfo);
VOID rlmRspGenerateVhtOpNotificationIE(P_ADAPTER_T prAdapter, P_MSDU_INFO_T prMsduInfo);
VOID rlmReqGenerateVhtOpNotificationIE(P_ADAPTER_T prAdapter, P_MSDU_INFO_T prMsduInfo);
#endif
#if CFG_SUPPORT_DFS
VOID rlmProcessSpecMgtAction(P_ADAPTER_T prAdapter, P_SW_RFB_T prSwRfb);
#endif
VOID
rlmSendOpModeNotificationFrame(P_ADAPTER_T prAdapter, P_STA_RECORD_T prStaRec, UINT_8 ucChannelWidth, UINT_8 ucNss);
VOID
rlmSendSmPowerSaveFrame(P_ADAPTER_T prAdapter, P_STA_RECORD_T prStaRec, UINT_8 ucNss);
VOID
rlmChangeVhtOpBwPara(P_ADAPTER_T prAdapter, UINT_8 ucBssIndex, UINT_8 ucChannelWidth);
BOOLEAN
rlmChangeOperationMode(P_ADAPTER_T prAdapter, UINT_8 ucBssIndex, UINT_8 ucChannelWidth, UINT_8 ucNss);
#if CFG_SUPPORT_CAL_RESULT_BACKUP_TO_HOST
WLAN_STATUS rlmCalBackup(
P_ADAPTER_T prAdapter,
UINT_8 ucReason,
UINT_8 ucAction,
UINT_8 ucRomRam
);
WLAN_STATUS rlmTriggerCalBackup(
P_ADAPTER_T prAdapter,
BOOLEAN fgIsCalDataBackuped
);
#endif
VOID rlmModifyVhtBwPara(PUINT_8 pucVhtChannelFrequencyS1, PUINT_8 pucVhtChannelFrequencyS2, PUINT_8 pucVhtChannelWidth);
VOID rlmReviseMaxBw(
P_ADAPTER_T prAdapter,
UINT_8 ucBssIndex,
P_ENUM_CHNL_EXT_T peExtend,
P_ENUM_CHANNEL_WIDTH_P peChannelWidth,
PUINT_8 pucS1,
PUINT_8 pucPrimaryCh);
/*******************************************************************************
* F U N C T I O N S
********************************************************************************
*/
#ifndef _lint
static __KAL_INLINE__ VOID rlmDataTypeCheck(VOID)
{
}
#endif /* _lint */
#endif /* _RLM_H */